@libxai/board 1.5.16 → 1.5.17

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
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 xf 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 Hh from'react-markdown';import zh from'remark-gfm';import Uh 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 m(...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 gf(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 ff=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 bf(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=ff,onRetry:l}=t,u,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(u=d,c===a||!n(u,c))return {error:u,attempts:i,success:false};let g=bf(c,r,o,s);if(l)try{l(u,c,g);}catch(h){console.error("Error in retry callback:",h);}await new Promise(h=>setTimeout(h,g));}}return {error:u||new Error("Unknown error"),attempts:i,success:false}}function hf(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 yf(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 Gc=(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))(Gc||{}),Do=class Do{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,u=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,u?n:"");break;case "INFO":console.info(l,o,u?n:"");break;case "WARN":console.warn(l,o,u?n:"");break;case "ERROR":console.error(l,o,u?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:Gc[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}},Vc=new al;function vf(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 wf(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(l=>l.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
2
  `)}async function kf(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 xf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),u=297,i=210,c=n.width/n.height,d=u-20,p=d/c;p>i-20&&(p=i-20,d=p*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,u,15,"F"),g.text(e.title||"Kanban Board",10,10);let h=(u-d)/2;return g.addImage(l,"PNG",h,20,d,p),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 l=e.cards.filter(u=>u.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.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):l.forEach(u=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(u.title,25,s),s+=6,u.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(u.description,160);o.text(c,25,s),s+=c.length*5;}let i=[];if(u.priority&&i.push(`Priority: ${u.priority}`),u.labels&&u.labels.length>0&&i.push(`Labels: ${u.labels.join(", ")}`),u.assignedUserIds&&u.assignedUserIds.length>0&&i.push(`Assigned: ${u.assignedUserIds.length} user(s)`),u.startDate||u.endDate){let c=[];u.startDate&&c.push(`Start: ${u.startDate}`),u.endDate&&c.push(`End: ${u.endDate}`),i.push(c.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.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
3
  `)?`"${e.replace(/"/g,'""')}"`:e}async function jc(e,t,a,r){switch(t){case "json":return vf(e,r);case "csv":return wf(e);case "pdf":return await kf(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"},l=new Blob([e],{type:n[t]}),u=URL.createObjectURL(l),i=document.createElement("a");i.href=u,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(u);}function Cf(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 Tf(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 l=Yc(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,h)=>{i[g]=l[h]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported: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 Cf(e);case "csv":return Tf(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 Bt({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:l,themeName:u}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":u,"data-gantt-portal":"true",style:i,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"}},Af="#BDC3C7",Lf=({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}),l=useRef(null),u=useRef(null),i=()=>{if(!u.current)return;let g=u.current.getBoundingClientRect(),h=window.innerHeight,y=window.innerWidth,v=160,f=220,x=4,k=g.right-v;k<10&&(k=g.left),k+v>y-10&&(k=y-v-10);let w=h-g.bottom,T=g.top,C;w>=f+x?C=g.bottom+x:T>=f+x?C=g.top-f-x:C=w>=T?g.bottom+x:Math.max(10,g.top-f-x),n({top:C,left:k}),o(true);};useEffect(()=>{let g=h=>{l.current&&!l.current.contains(h.target)&&!u.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);},d=e?ou[e]:null,p=d?.color||Af;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:u,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:d?.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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Bt,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(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:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsx(Lf,{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 If=[{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 Pn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),u=useRef(null),i=useRef(null),p=(Qo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let k=i.current.getBoundingClientRect(),w=window.innerHeight,T=window.innerWidth,C=320,S=380,N=4,I=k.left;I+C>T-10&&(I=T-C-10),I<10&&(I=10);let O=w-k.bottom,A=k.top,K;O>=S+N?K=k.bottom+N:A>=S+N?K=k.top-S-N:K=O>=A?k.bottom+N:Math.max(10,k.top-S-N),l({top:K,left:I}),s(true);};useEffect(()=>{let k=w=>{u.current&&!u.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]),useEffect(()=>{let k=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]);let h=k=>{let w=new Date,T=I=>{let O=I.getFullYear(),A=String(I.getMonth()+1).padStart(2,"0"),K=String(I.getDate()).padStart(2,"0");return `${O}-${A}-${K}`},C=T(w),S=new Date(w);S.setDate(S.getDate()+k);let N=T(S);a(C,N),s(false);},y=()=>{if(!e||!t)return "Set date";let k=S=>{if(S instanceof Date)return S;if(typeof S!="string"||!S.match(/^\d{4}-\d{2}-\d{2}$/))return null;let N=S.split("-").map(Number);if(N.length!==3||N.some(K=>isNaN(K)))return null;let I=N[0],O=N[1],A=N[2];return I===void 0||O===void 0||A===void 0?null:new Date(I,O-1,A)},w=k(e),T=k(t);if(!w||!T||isNaN(w.getTime())||isNaN(T.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[w.getMonth()]} ${w.getDate()} \u2013 ${C[T.getMonth()]} ${T.getDate()}`},v=e&&t,x=(()=>{if(!t)return false;let k=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),k<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,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:v?`${y()}`:"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:y()})]}),o&&jsx(Bt,{children:jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"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:p?"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:p?"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:If.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:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${p?"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:p?"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:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"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:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"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),[l,u]=useState(""),[i,c]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let x=p.current.getBoundingClientRect(),k=window.innerHeight,w=window.innerWidth,T=300,C=380,S=4,N=x.right-T;N<10&&(N=x.left),N+T>w-10&&(N=w-T-10);let I=k-x.bottom,O=x.top,A;I>=C+S?A=x.bottom+S:O>=C+S?A=x.top-C-S:A=I>=O?x.bottom+S:Math.max(10,x.top-C-S),c({top:A,left:N}),n(true);};useEffect(()=>{let x=k=>{d.current&&!d.current.contains(k.target)&&!p.current?.contains(k.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),useEffect(()=>{let x=k=>{k.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]);let h=x=>{let k=e.some(w=>w.id===x.id);a(k?e.filter(w=>w.id!==x.id):[...e,x]);},y=t.filter(x=>x.name.toLowerCase().includes(l.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,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:[v.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(Bt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange:x=>u(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:y.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"}):y.map(x=>{let k=e.some(w=>w.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:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor: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(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(u),false};return l(a)}function Ln({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,u]=useState(false),[i,c]=useState(""),[d,p]=useState(t.length>0),[g,h]=useState({top:0,left:0}),[y,v]=useState(null),f=useRef(null),x=useRef(null),k=()=>{if(!x.current)return;let N=x.current.getBoundingClientRect(),I=window.innerHeight,O=window.innerWidth,A=300,K=d?380:120,E=4,ce=N.right-A;ce<10&&(ce=N.left),ce+A>O-10&&(ce=O-A-10);let L=I-N.bottom,q=N.top,Ce;L>=K+E?Ce=N.bottom+E:q>=K+E?Ce=N.top-K-E:Ce=L>=q?N.bottom+E:Math.max(10,N.top-K-E),h({top:Ce,left:ce}),u(true);};useEffect(()=>{if(!l||!x.current)return;let N=x.current.getBoundingClientRect(),I=window.innerHeight,O=window.innerWidth,A=300,K=d?380:120,E=4,ce=N.right-A;ce<10&&(ce=N.left),ce+A>O-10&&(ce=O-A-10);let L=I-N.bottom,q=N.top,Ce;L>=K+E?Ce=N.bottom+E:q>=K+E?Ce=N.top-K-E:Ce=L>=q?N.bottom+E:Math.max(10,N.top-K-E),h({top:Ce,left:ce});},[d,l]),useEffect(()=>{let N=I=>{f.current&&!f.current.contains(I.target)&&!x.current?.contains(I.target)&&(u(false),c(""));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{let N=I=>{I.key==="Escape"&&(u(false),c(""));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l]);let w=N=>{let I=t.includes(N),O=a.find(A=>A.id===N);if(v(null),I){let A=t.filter(K=>K!==N);r(A),A.length===0&&p(false);}else {if(s&&Ns(a,N,e)){let K=`Cannot add "${O?.title||N}" as dependency - would create circular reference`;v(K),n?.(N,O?.title||N),setTimeout(()=>v(null),3e3);return}r([...t,N]),p(true);}},T=()=>{let N=!d;p(N),N||r([]);},C=a.filter(N=>N.id!==e).filter(N=>N.title.toLowerCase().includes(i.toLowerCase())||N.id.toLowerCase().includes(i.toLowerCase())),S=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:x,onClick:()=>l?u(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:S,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:S},children:t.length})]}),l&&jsx(Bt,{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:[y&&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:y})]}),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:T,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:N=>c(N.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:C.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"}):C.map(N=>{let I=t.includes(N.id);return jsxs("button",{onClick:()=>w(N.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: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"})})}),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:N.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:N.id})]})]},N.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),u(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:l=[],allCards:u=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:p,transition:g,isDragging:h}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),y={transform:ws.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:d,style:y,...i,...c,onClick:()=>a?.(e),children:t(e)});let v=l.filter(w=>e.assignedUserIds?.includes(w.id)),f=e.progress===100,x=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),k={...y,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:k,className:m("asakaa-card",h&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),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:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:x.slice(0,4).map((w,T)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}),T===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]})})]},w.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:w=>w.stopPropagation(),className:"priority-selector",children:jsx(So,{priority:e.priority,onChange:w=>n?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Pn,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,T)=>n?.(e.id,{startDate:w,endDate:T})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(Fo,{assignedUsers:v,availableUsers:l,onChange:w=>n?.(e.id,{assignedUserIds:w.map(T=>T.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(Ln,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:u,onChange:w=>n?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#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,l]=useState({top:0,left:0}),u=useRef(null),i=useRef(null),c=[...Object.entries(Ds).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ds).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=Ds[e];if(v)return {...v,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"}},p=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,k=180,w=280,T=4,C=v.right-k;C<10&&(C=v.left),C+k>x-10&&(C=x-k-10);let S=f-v.bottom,N=v.top,I;S>=w+T?I=v.bottom+T:N>=w+T?I=v.top-w-T:I=S>=N?v.bottom+T:Math.max(10,v.top-w-T),l({top:I,left:C}),s(true);};useEffect(()=>{let v=f=>{u.current&&!u.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},h=d(),y=h.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):p(),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:`${y}10`,boxShadow:`0 0 0 2px ${y}30 inset`},title:h.label,children:jsx(gu,{icon:h.icon,color:y})}),o&&jsx(Bt,{children:jsxs("div",{ref:u,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(v=>jsxs("button",{onClick:()=>g(v.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:v.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:v.icon,color:v.color}),jsx("span",{className:"font-semibold",children:v.label}),e===v.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"})})]},v.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,[l,u]=useState(false),[i,c]=useState(false),[d,p]=useState(e),[g,h]=useState({top:0,left:0}),y=useRef(null),v=useRef(null),f=useRef(null);useEffect(()=>{if(l&&v.current){let T=v.current.getBoundingClientRect();h({top:T.bottom+window.scrollY+8,left:T.left+window.scrollX});}},[l]),useEffect(()=>{let T=C=>{y.current&&!y.current.contains(C.target)&&!v.current?.contains(C.target)&&(u(false),c(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{let T=C=>{C.key==="Escape"&&(u(false),c(false),p(e));};if(l)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l,e]),useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let x=()=>{c(true),p(e);},k=()=>{let T=d.trim();T&&T!==e&&t(T),c(false),u(false),p(e);},w=T=>{T.key==="Enter"?k():T.key==="Escape"&&(c(false),p(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>u(!l),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"})]})}),l&&jsx(Bt,{children:jsx("div",{ref:y,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:i?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:d,onChange:T=>p(T.target.value),onKeyDown:w,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(),u(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:l,availableUsers:u,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:h,onColumnDelete:y,isDeletable:v=false,className:f,renderMetrics:x,locale:k})=>{let{setNodeRef:w,isOver:T}=useDroppable({id:e.id,data:{type:"column",column:e}}),C=useRef(null),S=c??Wc(t.length),N=useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>d,enabled:S});if(a)return jsx("div",{ref:w,className:f,children:a(e,t)});let O=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let E=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:E}:E>=80?{state:"warning",percentage:E}:E>=60?{state:"approaching",percentage:E}:{state:"ok",percentage:E}})(),A=O.state==="exceeded",K=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:m("asakaa-column",T&&"ring-2 ring-asakaa-accent-blue",A&&"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:m(K()),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||y)&&jsx(hu,{columnTitle:e.title,onRename:E=>h?.(e.id,E),onDelete:y?()=>y(e.id):void 0,isDeletable:v,locale:k}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),x&&x(e,t),!p&&jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:S?"600px":void 0},children:jsx(SortableContext,{items:t.map(E=>E.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"})}):S?jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(E=>{let ce=t[E.index];return ce?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:jsx(Yr,{card:ce,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i})},ce.id):null})}):t.map(E=>jsx(Yr,{card:E,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i},E.id))})})]})});tn.displayName="Column";function dl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let u=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?u():c.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:u,onKeyDown:i,className:m("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:m("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function eb(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(l=>{let u=l.name.toLowerCase(),i=u.replace(/\s+/g,""),c=u.split(/\s+/);return !!(i===s||u===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function tb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ab(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var rb=["\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:l="dark",locale:u="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:h,maxFileSizeMB:y=10}){let v=l==="dark",[f,x]=useState(false),[k,w]=useState([]),[T,C]=useState(0),[S,N]=useState(null),[I,O]=useState(false),A=useRef(null),K=useRef(null),E=useRef(null),ce=useRef(null),L=useCallback((z,te)=>{let X=eb(z,te);if(N(X),X){let Me=r.filter(be=>be.name.toLowerCase().includes(X.query)||be.email&&be.email.toLowerCase().includes(X.query)).slice(0,5);w(Me),x(Me.length>0),C(0);}else x(false),w([]);},[r]),q=z=>{let te=z.target.value;if(t(te),L(te,z.target.selectionStart||0),A.current){A.current.style.height="24px";let X=A.current.scrollHeight,Me=280,be=Math.min(X,Me);A.current.style.height=`${be}px`,A.current.style.overflowY=X>Me?"auto":"hidden";}},Ce=()=>{A.current&&L(e,A.current.selectionStart||0);},je=useCallback(z=>{if(!S||!A.current)return;let te=e.slice(0,S.start),X=e.slice(S.end),Me=`@${z.name.replace(/\s+/g,"")} `,be=te+Me+X;t(be),x(false),N(null),setTimeout(()=>{if(A.current){let $e=S.start+Me.length;A.current.selectionStart=$e,A.current.selectionEnd=$e,A.current.focus();}},0);},[S,e,t]),M=z=>{if(f&&k.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),C(te=>te<k.length-1?te+1:0);break;case "ArrowUp":z.preventDefault(),C(te=>te>0?te-1:k.length-1);break;case "Enter":{z.preventDefault();let te=k[T];te&&je(te);break}case "Tab":{z.preventDefault();let te=k[T];te&&je(te);break}case "Escape":z.preventDefault(),x(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};useEffect(()=>{let z=te=>{K.current&&!K.current.contains(te.target)&&A.current&&!A.current.contains(te.target)&&x(false),ce.current&&!ce.current.contains(te.target)&&O(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let V=useCallback(z=>{if(!A.current)return;let te=A.current.selectionStart||e.length,X=e.slice(0,te)+z+e.slice(te);t(X),O(false),setTimeout(()=>{if(A.current){let Me=te+z.length;A.current.selectionStart=Me,A.current.selectionEnd=Me,A.current.focus();}},0);},[e,t]),fe=useCallback(z=>{if(!g||!z.target.files)return;let te=Array.from(z.target.files),X=y*1024*1024,Me=te.filter(be=>be.size>X?(console.warn(`File ${be.name} exceeds max size of ${y}MB`),false):true);Me.length>0&&g(Me),z.target.value="";},[g,y]),We=useCallback(z=>z.type.startsWith("image/")?Image:z.type.includes("pdf")||z.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&K.current){let z=K.current.children[T];z&&z.scrollIntoView({block:"nearest"});}},[T,f]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(z=>{let te=We(z.file),X$1=z.file.type.startsWith("image/");return jsxs("div",{className:m("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[X$1&&z.preview?jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(te,{className:m("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:m("text-xs truncate",v?"text-white":"text-gray-900"),children:z.file.name}),jsx("p",{className:m("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:ab(z.file.size)})]}),h&&jsx("button",{onClick:()=>h(z.id),className:m("p-0.5 rounded-full transition-colors",v?"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"})})]},z.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:m("flex-1 relative min-w-0"),children:[jsxs("div",{className:m("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>O(!I),disabled:s||n,className:m("p-1 rounded transition-colors flex-shrink-0",v?"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:I&&jsx(motion.div,{ref:ce,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"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:rb.map(z=>jsx("button",{type:"button",onClick:()=>V(z),className:m("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:z},z))})})})]}),d&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>E.current?.click(),disabled:s||n,className:m("p-1.5 rounded transition-colors",v?"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:u==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:E,type:"file",multiple:true,onChange:fe,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:A,value:e,onChange:q,onSelect:Ce,onKeyDown:M,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:m("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"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()&&p.length===0||s,className:m("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"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:K,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:k.map((z,te)=>jsxs("button",{type:"button",onClick:()=>je(z),className:m("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",te===T?v?"bg-white/10":"bg-gray-100":v?"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:z.color||"#8B5CF6"},children:tb(z.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:m("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:z.name}),z.email&&jsx("p",{className:m("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.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((l,u)=>l.type==="mention"?jsx("span",{className:m("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:l.value},u):jsx("span",{children:l.value},u))})}var Ps=["#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[l,u]=useState(false),[i,c]=useState(""),[d,p]=useState(false),[g,h]=useState(Ps[10]||"#2E94FF"),[y,v]=useState({top:0,left:0}),f=useRef(null),x=useRef(null),k=useRef(null),w=useRef(null),T=t.filter(A=>A.name.toLowerCase().includes(i.toLowerCase())),C=t.some(A=>A.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&x.current){let A=x.current.getBoundingClientRect();v({top:A.bottom+6,left:A.left});}},[l]),useEffect(()=>{let A=K=>{let E=K.target,ce=f.current?.contains(E),L=k.current?.contains(E);!ce&&!L&&(u(false),c(""),p(false));};if(l)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let S=A=>{let K=e.some(E=>E.id===A.id);a(K?e.filter(E=>E.id!==A.id):[...e,A]);},N=async()=>{if(!(!r||!i.trim())){p(true);try{let A=await r(i.trim(),g);A&&(a([...e,A]),c(""),h(Ps[Math.floor(Math.random()*Ps.length)]||"#2E94FF"));}finally{p(false);}}},I=(A,K)=>{K.stopPropagation(),a(e.filter(E=>E.id!==A));},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&&u(!l),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(A=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.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:l&&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:y.top,left:y.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:w,type:"text",value:i,onChange:A=>c(A.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:A=>{A.key==="Enter"&&i.trim()&&!C&&r&&N();}})}),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(A=>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:`${A.color}20`,color:A.color},onClick:K=>I(A.id,K),children:[A.name,jsx(X,{className:"w-3 h-3"})]},A.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(A=>{let K=e.some(E=>E.id===A.id);return jsxs("button",{type:"button",onClick:()=>S(A),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:K?`${A.color}15`:"transparent",color:o.textPrimary},onMouseEnter:E=>{K||(E.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:E=>{K||(E.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:A.color}}),jsx("span",{className:"flex-1 text-left",children:A.name}),K&&jsx(Check,{className:"w-4 h-4",style:{color:A.color}})]},A.id)}):i.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"})}),i.trim()&&!C&&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:Ps.map(A=>jsx("button",{type:"button",onClick:()=>h(A),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:A,outline:g===A?`2px solid ${A}`:"none",outlineOffset:"2px"}},A))}),jsxs("button",{type:"button",onClick:N,disabled:d,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:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function 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 Po=[{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 pb(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 mb({className:e}){return jsxs("svg",{className:m("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=pb(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"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},u=Eu(e.loggedMinutes),i=e.estimateMinutes?Eu(e.estimateMinutes):null,c=a&&i?`${u} / ${i}`:u;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:m("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(mb,{className:l[t]}),jsx("span",{children:c})]})}function gb(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=gb(e);return t!==null?String(t):e}function Mu(e){let a=Ls(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||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,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}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 hb(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 yb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function xb({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 vb({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:l,onStopTimer:u,onDiscardTimer:i,onClose:c,className:d}){let[p,g]=useState(""),[h,y]=useState(t.estimateMinutes?Is(t.estimateMinutes):""),[v,f]=useState(""),[x,k]=useState(false),[w,T]=useState(false),C=useRef(null);useEffect(()=>{C.current?.focus();},[]);let S=async()=>{let O=Mu(p);if(!(O<=0||!s)){k(true);try{await s({durationMinutes:O,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{k(false);}}},N=async()=>{if(!n)return;let O=h.trim()?Mu(h):null;await n(O),T(false);},I=O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),S()),O.key==="Escape"&&c?.();};return jsxs("div",{className:m("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",d),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:hb(o)})]}),jsx("button",{onClick:u,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(xb,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Pu,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:m("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(yb,{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(vb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:C,type:"text",value:p,onChange:O=>g(O.target.value),onKeyDown:I,placeholder:"8 (=8h), 2h 30m",className:m("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:S,disabled:x||!p.trim(),className:m("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:v,onChange:O=>f(O.target.value),onKeyDown:I,placeholder:"Note (optional)",className:m("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"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:h,onChange:O=>y(O.target.value),onKeyDown:O=>{O.key==="Enter"&&N(),O.key==="Escape"&&T(false);},onBlur:N,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:()=>T(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:m("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:m("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 Nb(e){let a=Ls(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||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,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Db(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 $r({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,u]=useState(Db(r)),[i,c]=useState(""),[d,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let h=async()=>{p(true);let k=Nb(l);await o(k&&k>0?k:null,i||void 0),p(false);},y=async()=>{p(true),await o(null),p(false);},v=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:m("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:l,onChange:k=>u(k.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:k=>c(k.target.value),onKeyDown:v,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:d||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?x?"Guardando...":"Saving...":x?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:y,disabled:d,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 Sb(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 Eb(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=Sb(e.health),s=Eb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,u=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:m("flex items-center gap-2",r),children:[jsx("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:m("h-full w-1/4",o)})}),t&&jsx("span",{className:m("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxs("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:m("h-full transition-all duration-300",o),style:{width:`${u}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:m("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}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 Mb(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 Ab(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 Lb({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",l=a?"text-[#9CA3AF]":"text-gray-500",u=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:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:m("text-2xl font-bold",o),children:[r?"+":"",an(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:m("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:m("font-medium",u),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:m("font-medium",u),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:m("font-medium",u),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:m("font-medium",u),children:an(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:m("font-medium",u),children:an(e.totalLoggedMinutes)})]}),jsxs("div",{className:m("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:m("font-medium",u),children:e.totalTasksWithEstimate})]})]})]})]})}function Ib({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",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:m("border-b",s,r&&m("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:m("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:m("text-xs mt-1",l),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:m("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),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:m("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:m("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Pb(e.status,a),Mb(e.status,a)),children:Ab(e.status,t)})})]})}function bl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",u=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",c=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",p=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((h,y)=>h.varianceMinutes===null?1:y.varianceMinutes===null?-1:y.varianceMinutes-h.varianceMinutes):[],[e]);return t?jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:m("space-y-6 p-6",l,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:m("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:m("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Lb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:m("rounded-lg border overflow-hidden",u,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:p,children:jsxs("tr",{children:[jsx("th",{className:m("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:m("divide-y",i),children:g.map(h=>jsx(Ib,{task:h,locale:a,isDark:n,onClick:s},h.taskId))})]})})}),jsx("div",{className:m("text-xs text-center",d),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 Yb(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 qb(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:l=[],availableTags:u=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:h=[],onAddComment:y,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:x,enableTimeTracking:k=false,timeTrackingSummary:w,timeEntries:T=[],isTimerRunning:C=false,timerElapsedSeconds:S=0,onTimeLog:N,onEstimateUpdate:I,onSoldEffortUpdate:O,onTimerStart:A,onTimerStop:K,onTimerDiscard:E,blurFinancials:ce=false}){let L=s==="dark",q={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},Ce=e&&"title"in e&&!("name"in e),je=e,[M,V]=useState(e?Uu(e,l):null),[fe,We]=useState(false),[z,te]=useState(false),[X$1,Me]=useState(false),[be,$e]=useState(null),[De,Xe]=useState(new Date),[Z,Je]=useState(false),[ue,Qe]=useState(false),[ct,wt]=useState(""),[ye,ut]=useState(false),[tt,qe]=useState(false),[$,se]=useState(false),[D,Y]=useState(false),[ie,we]=useState(""),W=useRef(null),ee=useRef(null),[Le,Te]=useState(""),Be=useRef(null),[Ne,Ge]=useState(""),[pt,it]=useState(false),[at,Ze]=useState([]),[At,Dt]=useState(""),[mt,bt]=useState(false),lt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=Uu(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),V(P),we(P.description||""),Te(P.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!ie)return;let P=setTimeout(()=>{let me=ee.current;me&&(me.style.height="auto",me.style.height=`${Math.max(100,me.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,ie]),useEffect(()=>()=>{W.current&&clearTimeout(W.current),Be.current&&clearTimeout(Be.current);},[]),useEffect(()=>{t&&lt.current&&h.length>0&&setTimeout(()=>{lt.current&&(lt.current.scrollTop=lt.current.scrollHeight);},100);},[t,h.length]);let St=useCallback(P=>{V(P),Ce&&o&&je?o(qb(P,je)):r&&r(P);},[Ce,je,o,r]),Re=useCallback(()=>{We(false),te(false),Me(false),$e(null),Qe(false),wt(""),ut(false);},[]),Ae=useCallback((P,me)=>{if(!M)return;let He={...M,[P]:me};St(He);},[M,St]),ot=useCallback(()=>{let P=ee.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),ae=useCallback(P=>{we(P),setTimeout(ot,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(M){let me={...M,description:P};St(me);}},800);},[M,St,ot]),ge=useCallback(P=>{Te(P),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{if(M&&P.trim()){let me={...M,name:P.trim()};St(me);}},800);},[M,St]),b=useCallback(P=>{let me=P.map(He=>{let Ye={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:He};return He.type.startsWith("image/")&&(Ye.preview=URL.createObjectURL(He)),Ye});Ze(He=>[...He,...me]);},[]),B=useCallback(P=>{Ze(me=>{let He=me.find(Ye=>Ye.id===P);return He?.preview&&URL.revokeObjectURL(He.preview),me.filter(Ye=>Ye.id!==P)});},[]),H=useCallback(async()=>{if(!(!M||!Ne.trim()&&at.length===0||!y)){it(true);try{let P=Cu(Ne,f),me=[];if(at.length>0&&x){let He=at.map(Ye=>Ye.file);me=await x(He);}await y(M.id,Ne.trim(),P.length>0?P:void 0,me.length>0?me:void 0),Ge(""),at.forEach(He=>{He.preview&&URL.revokeObjectURL(He.preview);}),Ze([]);}finally{it(false);}}},[M,Ne,at,y,f,x]),_=useCallback(()=>{if(!M||!At.trim())return;let P=M.subtasks||[],me={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:At.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},He=[...P,me],Ye={...M,subtasks:He};St(Ye),Dt(""),bt(false);},[M,At,St]),ne=useCallback(P=>{if(!M?.subtasks)return;let me=M.subtasks.map(Ye=>Ye.id===P?{...Ye,progress:Ye.progress===100?0:100}:Ye),He={...M,subtasks:me};St(He);},[M,St]),he=useCallback(P=>{if(!M?.subtasks)return;let me=M.subtasks.filter(Ye=>Ye.id!==P),He={...M,subtasks:me};St(He);},[M,St]),J=useCallback(P=>{let me=typeof P=="string"?new Date(P):P,Ye=new Date().getTime()-me.getTime(),qt=Math.floor(Ye/6e4),Lt=Math.floor(Ye/36e5),Da=Math.floor(Ye/864e5);return qt<1?n==="es"?"Ahora":"Just now":qt<60?n==="es"?`Hace ${qt} min`:`${qt}m ago`:Lt<24?n==="es"?`Hace ${Lt}h`:`${Lt}h ago`:Da<7?n==="es"?`Hace ${Da}d`:`${Da}d ago`:me.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),de=useCallback(P=>{if(!M)return;let me=M.progress||0;P==="completed"?me=100:P==="in-progress"&&me===0?me=10:P==="todo"&&(me=0);let He={...M,status:P,progress:me};St(He),We(false);},[M,St]),_e=useCallback((P,me)=>{if(!M)return;let He={...M,startDate:P,endDate:me};St(He);},[M,St]),Ke=useCallback(()=>{let P=De.getFullYear(),me=De.getMonth(),He=new Date(P,me,1),qt=new Date(P,me+1,0).getDate(),Lt=He.getDay(),Da=[],Ba=new Date(P,me,0).getDate();for(let fa=Lt-1;fa>=0;fa--)Da.push({date:new Date(P,me-1,Ba-fa),isCurrentMonth:false});for(let fa=1;fa<=qt;fa++)Da.push({date:new Date(P,me,fa),isCurrentMonth:true});let Ra=42-Da.length;for(let fa=1;fa<=Ra;fa++)Da.push({date:new Date(P,me+1,fa),isCurrentMonth:false});return Da},[De]),gt=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),se(false),!M||!d)return;let me=Array.from(P.dataTransfer.files);if(me.length!==0){Y(true);try{await d(M.id,me);}finally{Y(false);}}},[M,d]),Ot=useCallback(async P=>{if(!M||!d||!P.target.files)return;let me=Array.from(P.target.files);if(me.length!==0){Y(true);try{await d(M.id,me);}finally{Y(false);}P.target.value="";}},[M,d]),Ht=useCallback(P=>{P.preventDefault(),P.stopPropagation(),se(true);},[]),U=useCallback(P=>{P.preventDefault(),P.stopPropagation(),se(false);},[]),oe=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Oe=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]);return !t||!M?null:jsx(AnimatePresence,{children:t&&M&&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:m("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:m("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:m("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:m("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:m("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:M.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 P=M.progress===100?0:100,He={...M,progress:P,status:P===100?"completed":"todo"};St(He);},className:m("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",M.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Le,onChange:P=>ge(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:m("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",M.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Re(),We(!fe);},className:m("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",M.progress===100||M.status==="completed"?"bg-green-500/20 text-green-400":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/20 text-blue-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.progress===100||M.status==="completed"?n==="es"?"COMPLETADO":"DONE":M.progress&&M.progress>0||M.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:fe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>We(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label: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(P=>jsxs("button",{onClick:()=>de(P.id),className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",M.status===P.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Re(),Me(!X$1);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[M.assignees&&M.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[M.assignees.slice(0,3).map((P,me)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},me)),M.assignees.length>3&&jsxs("span",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",M.assignees.length-3]})]}):jsx("span",{className:m("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:m("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:X$1&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Me(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(P=>{let me=M.assignees?.some(He=>He.name===P.name);return jsxs("button",{onClick:()=>{let He=M.assignees||[],Ye;me?Ye=He.filter(qt=>qt.name!==P.name):Ye=[...He,P],Ae("assignees",Ye);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",me&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsx("span",{className:m("flex-1",L?"text-white":"text-gray-900"),children:P.name}),me&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsx("div",{className:m("px-3 py-4 text-sm text-center",L?"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:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{$e(be?null:"start"),Xe(M.startDate||new Date);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[M.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:m("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),M.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$e(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:m("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:m("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,me=new Date(P);me.setDate(P.getDate()+1);let He=new Date(P);He.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Ye=new Date(P);Ye.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let qt=new Date(P);qt.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let Lt=new Date(P);Lt.setDate(P.getDate()+14);let Da=new Date(P);return Da.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:me,display:me.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:He,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ye,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:qt,display:qt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Lt,display:Lt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Da,display:Da.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ra,fa)=>jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(be==="start"){let ir=M.endDate&&Ra.date>M.endDate?Ra.date:M.endDate;_e(Ra.date,ir),$e("end");}else {let ir=M.startDate&&Ra.date<M.startDate?Ra.date:M.startDate;_e(ir,Ra.date),$e(null);}},children:[jsx("span",{children:Ra.label}),jsx("span",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Ra.display})]},fa))})(),jsx("div",{className:m("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{_e(void 0,void 0),$e(null);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:m("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:be==="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:m("font-medium",L?"text-white":"text-gray-900"),children:De.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Xe(new Date),className:m("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Xe(new Date(De.getFullYear(),De.getMonth()-1)),className:m("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>Xe(new Date(De.getFullYear(),De.getMonth()+1)),className:m("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ke().map((P,me)=>{let He=P.date.toDateString()===new Date().toDateString(),Ye=M.startDate?.toDateString()===P.date.toDateString(),qt=M.endDate?.toDateString()===P.date.toDateString(),Lt=Ye||qt,Da=M.startDate&&M.endDate&&P.date>=M.startDate&&P.date<=M.endDate;return jsx("button",{onClick:()=>{let Ba=new Date(P.date);if(be==="start"){let Ra=M.endDate&&Ba>M.endDate?Ba:M.endDate;_e(Ba,Ra),$e("end");}else {let Ra=M.startDate&&Ba<M.startDate?Ba:M.startDate;_e(Ra,Ba),$e(null);}},className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(L?"text-white":"text-gray-900"),He&&"ring-2 ring-[#2E94FF]",Ye&&"bg-[#2E94FF] text-white",qt&&!Ye&&"bg-[#7C3AED] text-white",Da&&!Lt&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!Lt&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},me)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Re(),te(!z);},className:m("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",M.priority==="high"||M.priority==="urgent"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":M.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.priority?M.priority==="high"||M.priority==="urgent"?n==="es"?"Alta":"High":M.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:z&&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:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label: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(P=>jsxs("button",{onClick:()=>{Ae("priority",P.id),te(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",M.priority===P.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:m("text-sm",L?"text-white":"text-gray-900"),children:M.startDate&&M.endDate?`${Math.ceil((M.endDate.getTime()-M.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:m("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Z?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:M.progress||0,onChange:P=>{let me=parseInt(P.target.value),He=M.status;me===100?He="completed":me>0?He="in-progress":He="todo";let Ye={...M,progress:me,status:He};St(Ye);},onBlur:()=>Je(false),className:m("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Je(true),className:m("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:m("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${M.progress||0}%`}})}),jsxs("span",{className:m("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[M.progress||0,"%"]})]})]}),k&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:M.status==="completed"||M.progress===100?jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?rn(w.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>qe("estimate"),className:m("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:rn(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>qe("estimate"),className:m("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:tt==="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($r,{mode:"estimate",locale:n,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async P=>{await I?.(M.id,P),qe(false);},onClose:()=>qe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"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:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"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"}):M.status==="completed"||M.progress===100?jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:M.quotedMinutes?rn(M.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):M.quotedMinutes?jsx("button",{type:"button",onClick:()=>qe("quoted"),className:m("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:rn(M.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>qe("quoted"),className:m("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:tt==="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($r,{mode:"quoted",locale:n,isDark:L,currentValue:M.quotedMinutes||null,onSave:async P=>{O?(await O(M.id,P),V(me=>me?{...me,quotedMinutes:P}:null)):Ae("quotedMinutes",P),qe(false);},onClose:()=>qe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[M.status==="completed"||M.progress===100?jsx("div",{className:m("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):C?jsxs("button",{type:"button",onClick:()=>K?.(M.id),className:m("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"}),Yb(S||0)]}):jsx("button",{type:"button",onClick:()=>A?.(M.id),className:m("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),M.status==="completed"||M.progress===100?jsxs("div",{className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"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:()=>qe("log"),className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:m("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[rn(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:m("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",rn(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:m("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:tt==="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($r,{mode:"log",locale:n,isDark:L,currentValue:null,onSave:async(P,me)=>{P&&await N?.(M.id,{durationMinutes:P,note:me,source:"manual"}),qe(false);},onClose:()=>qe(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(lo,{selectedTags:M.tags||[],availableTags:u,onChange:P=>{Ae("tags",P);},onCreateTag:i,theme:q})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:m("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[M.dependencies&&M.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:M.dependencies.map(P=>{let me=g.find(He=>He.id===P);return jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[me?.name||P.slice(0,8),jsx("button",{onClick:()=>{let He=(M.dependencies||[]).filter(Ye=>Ye!==P);Ae("dependencies",He);},className:m("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{Re(),Qe(!ue);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:m("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:ue&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Qe(false),wt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:m("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ct,onChange:P=>wt(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:m("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(P=>P.id!==M.id).filter(P=>ct===""||P.name.toLowerCase().includes(ct.toLowerCase())).map(P=>{let me=M.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let He=M.dependencies||[],Ye;me?Ye=He.filter(qt=>qt!==P.id):Ye=[...He,P.id],Ae("dependencies",Ye);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",me&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",me?"bg-blue-500 border-blue-500":L?"border-white/30":"border-gray-300"),children:me&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:m("block truncate",L?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:m("px-3 py-4 text-sm text-center",L?"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:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Re(),ut(!ye);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:M.color||"#6366F1"}}),jsx("span",{className:m("text-sm",L?"text-white":"text-gray-900"),children:Po.find(P=>P.value===M.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:m("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ye&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ut(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Po.map(P=>{let me=M.color===P.value;return jsx("button",{onClick:()=>{Ae("color",P.value),ut(false);},className:m("w-7 h-7 rounded-full flex items-center justify-center transition-all",me&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:me?P.value:void 0},title:P.name,children:me&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"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:M.isMilestone||false,onChange:P=>Ae("isMilestone",P.target.checked),className:m("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",M.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:m("text-sm",L?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:m("text-sm font-semibold",L?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ee,value:ie,onChange:P=>ae(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:m("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:m("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",M.subtasks&&M.subtasks.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",M.subtasks.filter(P=>P.progress===100).length,"/",M.subtasks.length,")"]})]})}),M.subtasks&&M.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...M.subtasks].sort((P,me)=>(P.position??0)-(me.position??0)).map(P=>jsxs("div",{className:m("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>ne(P.id),className:m("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:m("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:P.name}),jsx("button",{onClick:()=>he(P.id),className:m("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},P.id))}),mt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:At,onChange:P=>Dt(P.target.value),onKeyDown:P=>{P.key==="Enter"&&At.trim()?_():P.key==="Escape"&&(bt(false),Dt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:m("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:_,disabled:!At.trim(),className:m("px-3 py-2 rounded-lg text-sm font-medium transition-colors",At.trim()?"bg-blue-500 hover:bg-blue-600 text-white":L?"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:()=>{bt(false),Dt("");},className:m("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>bt(true),className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:m("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let me=Oe(P.type),He=P.type.startsWith("image/");return jsxs("div",{className:m("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[He&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:m("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsx(me,{className:m("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:m("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:oe(P.size)})]}),p&&jsx("button",{onClick:()=>p(P.id),className:m("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxs("div",{onDragOver:Ht,onDragLeave:U,onDrop:gt,className:m("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",$?L?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":L?"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:Ot,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||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:m("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:m("w-6 h-6 mx-auto mb-2",$?"text-blue-500":L?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:m("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:$?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"})]})}),!d&&jsx("p",{className:m("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:m("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:m("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",h.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",h.length,")"]})]}),jsx("button",{onClick:a,className:m("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
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 l=Yc(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,h)=>{i[g]=l[h]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported: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 Cf(e);case "csv":return Tf(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 Bt({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:l,themeName:u}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":u,"data-gantt-portal":"true",style:i,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"}},Af="#BDC3C7",Lf=({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}),l=useRef(null),u=useRef(null),i=()=>{if(!u.current)return;let g=u.current.getBoundingClientRect(),h=window.innerHeight,y=window.innerWidth,v=160,f=220,x=4,k=g.right-v;k<10&&(k=g.left),k+v>y-10&&(k=y-v-10);let w=h-g.bottom,T=g.top,C;w>=f+x?C=g.bottom+x:T>=f+x?C=g.top-f-x:C=w>=T?g.bottom+x:Math.max(10,g.top-f-x),n({top:C,left:k}),o(true);};useEffect(()=>{let g=h=>{l.current&&!l.current.contains(h.target)&&!u.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);},d=e?ou[e]:null,p=d?.color||Af;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:u,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:d?.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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Bt,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(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:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsx(Lf,{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 If=[{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 Pn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),u=useRef(null),i=useRef(null),p=(Qo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let k=i.current.getBoundingClientRect(),w=window.innerHeight,T=window.innerWidth,C=320,S=380,N=4,I=k.left;I+C>T-10&&(I=T-C-10),I<10&&(I=10);let O=w-k.bottom,A=k.top,K;O>=S+N?K=k.bottom+N:A>=S+N?K=k.top-S-N:K=O>=A?k.bottom+N:Math.max(10,k.top-S-N),l({top:K,left:I}),s(true);};useEffect(()=>{let k=w=>{u.current&&!u.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]),useEffect(()=>{let k=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]);let h=k=>{let w=new Date,T=I=>{let O=I.getFullYear(),A=String(I.getMonth()+1).padStart(2,"0"),K=String(I.getDate()).padStart(2,"0");return `${O}-${A}-${K}`},C=T(w),S=new Date(w);S.setDate(S.getDate()+k);let N=T(S);a(C,N),s(false);},y=()=>{if(!e||!t)return "Set date";let k=S=>{if(S instanceof Date)return S;if(typeof S!="string"||!S.match(/^\d{4}-\d{2}-\d{2}$/))return null;let N=S.split("-").map(Number);if(N.length!==3||N.some(K=>isNaN(K)))return null;let I=N[0],O=N[1],A=N[2];return I===void 0||O===void 0||A===void 0?null:new Date(I,O-1,A)},w=k(e),T=k(t);if(!w||!T||isNaN(w.getTime())||isNaN(T.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[w.getMonth()]} ${w.getDate()} \u2013 ${C[T.getMonth()]} ${T.getDate()}`},v=e&&t,x=(()=>{if(!t)return false;let k=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),k<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,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:v?`${y()}`:"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:y()})]}),o&&jsx(Bt,{children:jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"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:p?"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:p?"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:If.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:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${p?"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:p?"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:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"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:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"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),[l,u]=useState(""),[i,c]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let x=p.current.getBoundingClientRect(),k=window.innerHeight,w=window.innerWidth,T=300,C=380,S=4,N=x.right-T;N<10&&(N=x.left),N+T>w-10&&(N=w-T-10);let I=k-x.bottom,O=x.top,A;I>=C+S?A=x.bottom+S:O>=C+S?A=x.top-C-S:A=I>=O?x.bottom+S:Math.max(10,x.top-C-S),c({top:A,left:N}),n(true);};useEffect(()=>{let x=k=>{d.current&&!d.current.contains(k.target)&&!p.current?.contains(k.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),useEffect(()=>{let x=k=>{k.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]);let h=x=>{let k=e.some(w=>w.id===x.id);a(k?e.filter(w=>w.id!==x.id):[...e,x]);},y=t.filter(x=>x.name.toLowerCase().includes(l.toLowerCase())),v=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,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:[v.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(Bt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange:x=>u(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:y.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"}):y.map(x=>{let k=e.some(w=>w.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:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor: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(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(u),false};return l(a)}function Ln({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,u]=useState(false),[i,c]=useState(""),[d,p]=useState(t.length>0),[g,h]=useState({top:0,left:0}),[y,v]=useState(null),f=useRef(null),x=useRef(null),k=()=>{if(!x.current)return;let N=x.current.getBoundingClientRect(),I=window.innerHeight,O=window.innerWidth,A=300,K=d?380:120,E=4,ce=N.right-A;ce<10&&(ce=N.left),ce+A>O-10&&(ce=O-A-10);let L=I-N.bottom,q=N.top,Ce;L>=K+E?Ce=N.bottom+E:q>=K+E?Ce=N.top-K-E:Ce=L>=q?N.bottom+E:Math.max(10,N.top-K-E),h({top:Ce,left:ce}),u(true);};useEffect(()=>{if(!l||!x.current)return;let N=x.current.getBoundingClientRect(),I=window.innerHeight,O=window.innerWidth,A=300,K=d?380:120,E=4,ce=N.right-A;ce<10&&(ce=N.left),ce+A>O-10&&(ce=O-A-10);let L=I-N.bottom,q=N.top,Ce;L>=K+E?Ce=N.bottom+E:q>=K+E?Ce=N.top-K-E:Ce=L>=q?N.bottom+E:Math.max(10,N.top-K-E),h({top:Ce,left:ce});},[d,l]),useEffect(()=>{let N=I=>{f.current&&!f.current.contains(I.target)&&!x.current?.contains(I.target)&&(u(false),c(""));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{let N=I=>{I.key==="Escape"&&(u(false),c(""));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l]);let w=N=>{let I=t.includes(N),O=a.find(A=>A.id===N);if(v(null),I){let A=t.filter(K=>K!==N);r(A),A.length===0&&p(false);}else {if(s&&Ns(a,N,e)){let K=`Cannot add "${O?.title||N}" as dependency - would create circular reference`;v(K),n?.(N,O?.title||N),setTimeout(()=>v(null),3e3);return}r([...t,N]),p(true);}},T=()=>{let N=!d;p(N),N||r([]);},C=a.filter(N=>N.id!==e).filter(N=>N.title.toLowerCase().includes(i.toLowerCase())||N.id.toLowerCase().includes(i.toLowerCase())),S=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:x,onClick:()=>l?u(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:S,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:S},children:t.length})]}),l&&jsx(Bt,{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:[y&&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:y})]}),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:T,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:N=>c(N.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:C.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"}):C.map(N=>{let I=t.includes(N.id);return jsxs("button",{onClick:()=>w(N.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: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"})})}),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:N.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:N.id})]})]},N.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),u(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:l=[],allCards:u=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:p,transition:g,isDragging:h}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),y={transform:ws.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:d,style:y,...i,...c,onClick:()=>a?.(e),children:t(e)});let v=l.filter(w=>e.assignedUserIds?.includes(w.id)),f=e.progress===100,x=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),k={...y,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:k,className:m("asakaa-card",h&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),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:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:x.slice(0,4).map((w,T)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}),T===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]})})]},w.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:w=>w.stopPropagation(),className:"priority-selector",children:jsx(So,{priority:e.priority,onChange:w=>n?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Pn,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,T)=>n?.(e.id,{startDate:w,endDate:T})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(Fo,{assignedUsers:v,availableUsers:l,onChange:w=>n?.(e.id,{assignedUserIds:w.map(T=>T.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(Ln,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:u,onChange:w=>n?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#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,l]=useState({top:0,left:0}),u=useRef(null),i=useRef(null),c=[...Object.entries(Ds).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ds).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let v=Ds[e];if(v)return {...v,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"}},p=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,k=180,w=280,T=4,C=v.right-k;C<10&&(C=v.left),C+k>x-10&&(C=x-k-10);let S=f-v.bottom,N=v.top,I;S>=w+T?I=v.bottom+T:N>=w+T?I=v.top-w-T:I=S>=N?v.bottom+T:Math.max(10,v.top-w-T),l({top:I,left:C}),s(true);};useEffect(()=>{let v=f=>{u.current&&!u.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},h=d(),y=h.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):p(),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:`${y}10`,boxShadow:`0 0 0 2px ${y}30 inset`},title:h.label,children:jsx(gu,{icon:h.icon,color:y})}),o&&jsx(Bt,{children:jsxs("div",{ref:u,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(v=>jsxs("button",{onClick:()=>g(v.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:v.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:v.icon,color:v.color}),jsx("span",{className:"font-semibold",children:v.label}),e===v.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"})})]},v.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,[l,u]=useState(false),[i,c]=useState(false),[d,p]=useState(e),[g,h]=useState({top:0,left:0}),y=useRef(null),v=useRef(null),f=useRef(null);useEffect(()=>{if(l&&v.current){let T=v.current.getBoundingClientRect();h({top:T.bottom+window.scrollY+8,left:T.left+window.scrollX});}},[l]),useEffect(()=>{let T=C=>{y.current&&!y.current.contains(C.target)&&!v.current?.contains(C.target)&&(u(false),c(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{let T=C=>{C.key==="Escape"&&(u(false),c(false),p(e));};if(l)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l,e]),useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let x=()=>{c(true),p(e);},k=()=>{let T=d.trim();T&&T!==e&&t(T),c(false),u(false),p(e);},w=T=>{T.key==="Enter"?k():T.key==="Escape"&&(c(false),p(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>u(!l),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"})]})}),l&&jsx(Bt,{children:jsx("div",{ref:y,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:i?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:d,onChange:T=>p(T.target.value),onKeyDown:w,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(),u(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:l,availableUsers:u,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:h,onColumnDelete:y,isDeletable:v=false,className:f,renderMetrics:x,locale:k})=>{let{setNodeRef:w,isOver:T}=useDroppable({id:e.id,data:{type:"column",column:e}}),C=useRef(null),S=c??Wc(t.length),N=useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>d,enabled:S});if(a)return jsx("div",{ref:w,className:f,children:a(e,t)});let O=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let E=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:E}:E>=80?{state:"warning",percentage:E}:E>=60?{state:"approaching",percentage:E}:{state:"ok",percentage:E}})(),A=O.state==="exceeded",K=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:m("asakaa-column",T&&"ring-2 ring-asakaa-accent-blue",A&&"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:m(K()),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||y)&&jsx(hu,{columnTitle:e.title,onRename:E=>h?.(e.id,E),onDelete:y?()=>y(e.id):void 0,isDeletable:v,locale:k}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),x&&x(e,t),!p&&jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:S?"600px":void 0},children:jsx(SortableContext,{items:t.map(E=>E.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"})}):S?jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(E=>{let ce=t[E.index];return ce?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:jsx(Yr,{card:ce,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i})},ce.id):null})}):t.map(E=>jsx(Yr,{card:E,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i},E.id))})})]})});tn.displayName="Column";function dl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let u=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?u():c.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:u,onKeyDown:i,className:m("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:m("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function eb(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(l=>{let u=l.name.toLowerCase(),i=u.replace(/\s+/g,""),c=u.split(/\s+/);return !!(i===s||u===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function tb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ab(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var rb=["\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:l="dark",locale:u="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:h,maxFileSizeMB:y=10}){let v=l==="dark",[f,x]=useState(false),[k,w]=useState([]),[T,C]=useState(0),[S,N]=useState(null),[I,O]=useState(false),A=useRef(null),K=useRef(null),E=useRef(null),ce=useRef(null),L=useCallback((z,te)=>{let X=eb(z,te);if(N(X),X){let Me=r.filter(be=>be.name.toLowerCase().includes(X.query)||be.email&&be.email.toLowerCase().includes(X.query)).slice(0,5);w(Me),x(Me.length>0),C(0);}else x(false),w([]);},[r]),q=z=>{let te=z.target.value;if(t(te),L(te,z.target.selectionStart||0),A.current){A.current.style.height="24px";let X=A.current.scrollHeight,Me=280,be=Math.min(X,Me);A.current.style.height=`${be}px`,A.current.style.overflowY=X>Me?"auto":"hidden";}},Ce=()=>{A.current&&L(e,A.current.selectionStart||0);},je=useCallback(z=>{if(!S||!A.current)return;let te=e.slice(0,S.start),X=e.slice(S.end),Me=`@${z.name.replace(/\s+/g,"")} `,be=te+Me+X;t(be),x(false),N(null),setTimeout(()=>{if(A.current){let $e=S.start+Me.length;A.current.selectionStart=$e,A.current.selectionEnd=$e,A.current.focus();}},0);},[S,e,t]),M=z=>{if(f&&k.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),C(te=>te<k.length-1?te+1:0);break;case "ArrowUp":z.preventDefault(),C(te=>te>0?te-1:k.length-1);break;case "Enter":{z.preventDefault();let te=k[T];te&&je(te);break}case "Tab":{z.preventDefault();let te=k[T];te&&je(te);break}case "Escape":z.preventDefault(),x(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};useEffect(()=>{let z=te=>{K.current&&!K.current.contains(te.target)&&A.current&&!A.current.contains(te.target)&&x(false),ce.current&&!ce.current.contains(te.target)&&O(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let V=useCallback(z=>{if(!A.current)return;let te=A.current.selectionStart||e.length,X=e.slice(0,te)+z+e.slice(te);t(X),O(false),setTimeout(()=>{if(A.current){let Me=te+z.length;A.current.selectionStart=Me,A.current.selectionEnd=Me,A.current.focus();}},0);},[e,t]),fe=useCallback(z=>{if(!g||!z.target.files)return;let te=Array.from(z.target.files),X=y*1024*1024,Me=te.filter(be=>be.size>X?(console.warn(`File ${be.name} exceeds max size of ${y}MB`),false):true);Me.length>0&&g(Me),z.target.value="";},[g,y]),We=useCallback(z=>z.type.startsWith("image/")?Image:z.type.includes("pdf")||z.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&K.current){let z=K.current.children[T];z&&z.scrollIntoView({block:"nearest"});}},[T,f]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(z=>{let te=We(z.file),X$1=z.file.type.startsWith("image/");return jsxs("div",{className:m("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[X$1&&z.preview?jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(te,{className:m("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:m("text-xs truncate",v?"text-white":"text-gray-900"),children:z.file.name}),jsx("p",{className:m("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:ab(z.file.size)})]}),h&&jsx("button",{onClick:()=>h(z.id),className:m("p-0.5 rounded-full transition-colors",v?"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"})})]},z.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:m("flex-1 relative min-w-0"),children:[jsxs("div",{className:m("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>O(!I),disabled:s||n,className:m("p-1 rounded transition-colors flex-shrink-0",v?"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:I&&jsx(motion.div,{ref:ce,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"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:rb.map(z=>jsx("button",{type:"button",onClick:()=>V(z),className:m("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:z},z))})})})]}),d&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>E.current?.click(),disabled:s||n,className:m("p-1.5 rounded transition-colors",v?"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:u==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:E,type:"file",multiple:true,onChange:fe,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:A,value:e,onChange:q,onSelect:Ce,onKeyDown:M,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:m("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"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()&&p.length===0||s,className:m("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"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:K,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:k.map((z,te)=>jsxs("button",{type:"button",onClick:()=>je(z),className:m("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",te===T?v?"bg-white/10":"bg-gray-100":v?"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:z.color||"#8B5CF6"},children:tb(z.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:m("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:z.name}),z.email&&jsx("p",{className:m("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.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((l,u)=>l.type==="mention"?jsx("span",{className:m("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:l.value},u):jsx("span",{children:l.value},u))})}var Ps=["#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[l,u]=useState(false),[i,c]=useState(""),[d,p]=useState(false),[g,h]=useState(Ps[10]||"#2E94FF"),[y,v]=useState({top:0,left:0}),f=useRef(null),x=useRef(null),k=useRef(null),w=useRef(null),T=t.filter(A=>A.name.toLowerCase().includes(i.toLowerCase())),C=t.some(A=>A.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&x.current){let A=x.current.getBoundingClientRect();v({top:A.bottom+6,left:A.left});}},[l]),useEffect(()=>{let A=K=>{let E=K.target,ce=f.current?.contains(E),L=k.current?.contains(E);!ce&&!L&&(u(false),c(""),p(false));};if(l)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let S=A=>{let K=e.some(E=>E.id===A.id);a(K?e.filter(E=>E.id!==A.id):[...e,A]);},N=async()=>{if(!(!r||!i.trim())){p(true);try{let A=await r(i.trim(),g);A&&(a([...e,A]),c(""),h(Ps[Math.floor(Math.random()*Ps.length)]||"#2E94FF"));}finally{p(false);}}},I=(A,K)=>{K.stopPropagation(),a(e.filter(E=>E.id!==A));},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&&u(!l),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(A=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${A.color}20`,color:A.color},children:A.name},A.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:l&&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:y.top,left:y.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:w,type:"text",value:i,onChange:A=>c(A.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:A=>{A.key==="Enter"&&i.trim()&&!C&&r&&N();}})}),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(A=>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:`${A.color}20`,color:A.color},onClick:K=>I(A.id,K),children:[A.name,jsx(X,{className:"w-3 h-3"})]},A.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(A=>{let K=e.some(E=>E.id===A.id);return jsxs("button",{type:"button",onClick:()=>S(A),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:K?`${A.color}15`:"transparent",color:o.textPrimary},onMouseEnter:E=>{K||(E.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:E=>{K||(E.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:A.color}}),jsx("span",{className:"flex-1 text-left",children:A.name}),K&&jsx(Check,{className:"w-4 h-4",style:{color:A.color}})]},A.id)}):i.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"})}),i.trim()&&!C&&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:Ps.map(A=>jsx("button",{type:"button",onClick:()=>h(A),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:A,outline:g===A?`2px solid ${A}`:"none",outlineOffset:"2px"}},A))}),jsxs("button",{type:"button",onClick:N,disabled:d,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:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function 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 Po=[{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 pb(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 mb({className:e}){return jsxs("svg",{className:m("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=pb(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"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},u=Eu(e.loggedMinutes),i=e.estimateMinutes?Eu(e.estimateMinutes):null,c=a&&i?`${u} / ${i}`:u;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:m("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(mb,{className:l[t]}),jsx("span",{children:c})]})}function gb(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=gb(e);return t!==null?String(t):e}function Mu(e){let a=Ls(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||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,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}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 hb(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 yb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function xb({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 vb({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:l,onStopTimer:u,onDiscardTimer:i,onClose:c,className:d}){let[p,g]=useState(""),[h,y]=useState(t.estimateMinutes?Is(t.estimateMinutes):""),[v,f]=useState(""),[x,k]=useState(false),[w,T]=useState(false),C=useRef(null);useEffect(()=>{C.current?.focus();},[]);let S=async()=>{let O=Mu(p);if(!(O<=0||!s)){k(true);try{await s({durationMinutes:O,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{k(false);}}},N=async()=>{if(!n)return;let O=h.trim()?Mu(h):null;await n(O),T(false);},I=O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),S()),O.key==="Escape"&&c?.();};return jsxs("div",{className:m("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",d),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:hb(o)})]}),jsx("button",{onClick:u,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(xb,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Pu,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:m("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(yb,{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(vb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:C,type:"text",value:p,onChange:O=>g(O.target.value),onKeyDown:I,placeholder:"8 (=8h), 2h 30m",className:m("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:S,disabled:x||!p.trim(),className:m("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:v,onChange:O=>f(O.target.value),onKeyDown:I,placeholder:"Note (optional)",className:m("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"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:h,onChange:O=>y(O.target.value),onKeyDown:O=>{O.key==="Enter"&&N(),O.key==="Escape"&&T(false);},onBlur:N,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:()=>T(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:m("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:m("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 Nb(e){let a=Ls(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||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,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Db(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 $r({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,u]=useState(Db(r)),[i,c]=useState(""),[d,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let h=async()=>{p(true);let k=Nb(l);await o(k&&k>0?k:null,i||void 0),p(false);},y=async()=>{p(true),await o(null),p(false);},v=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:m("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:l,onChange:k=>u(k.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:k=>c(k.target.value),onKeyDown:v,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:d||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?x?"Guardando...":"Saving...":x?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:y,disabled:d,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 Sb(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 Eb(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=Sb(e.health),s=Eb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,u=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:m("flex items-center gap-2",r),children:[jsx("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:m("h-full w-1/4",o)})}),t&&jsx("span",{className:m("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxs("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:m("h-full transition-all duration-300",o),style:{width:`${u}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:m("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}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 Mb(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 Ab(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 Lb({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",l=a?"text-[#9CA3AF]":"text-gray-500",u=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:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:m("text-2xl font-bold",o),children:[r?"+":"",an(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:m("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:m("font-medium",u),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:m("font-medium",u),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:m("font-medium",u),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:m("font-medium",u),children:an(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:m("font-medium",u),children:an(e.totalLoggedMinutes)})]}),jsxs("div",{className:m("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:m("font-medium",u),children:e.totalTasksWithEstimate})]})]})]})]})}function Ib({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",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:m("border-b",s,r&&m("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:m("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:m("text-xs mt-1",l),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:m("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),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:m("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:m("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Pb(e.status,a),Mb(e.status,a)),children:Ab(e.status,t)})})]})}function bl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",u=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",c=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",p=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((h,y)=>h.varianceMinutes===null?1:y.varianceMinutes===null?-1:y.varianceMinutes-h.varianceMinutes):[],[e]);return t?jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:m("space-y-6 p-6",l,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:m("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:m("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Lb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:m("rounded-lg border overflow-hidden",u,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:p,children:jsxs("tr",{children:[jsx("th",{className:m("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:m("divide-y",i),children:g.map(h=>jsx(Ib,{task:h,locale:a,isDark:n,onClick:s},h.taskId))})]})})}),jsx("div",{className:m("text-xs text-center",d),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 Yb(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 qb(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:l=[],availableTags:u=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:h=[],onAddComment:y,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:x,enableTimeTracking:k=false,timeTrackingSummary:w,timeEntries:T=[],isTimerRunning:C=false,timerElapsedSeconds:S=0,onTimeLog:N,onEstimateUpdate:I,onSoldEffortUpdate:O,onTimerStart:A,onTimerStop:K,onTimerDiscard:E,blurFinancials:ce=false}){let L=s==="dark",q={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},Ce=e&&"title"in e&&!("name"in e),je=e,[M,V]=useState(e?Uu(e,l):null),[fe,We]=useState(false),[z,te]=useState(false),[X$1,Me]=useState(false),[be,$e]=useState(null),[De,Xe]=useState(new Date),[Z,Je]=useState(false),[ue,Qe]=useState(false),[ct,wt]=useState(""),[ye,ut]=useState(false),[tt,qe]=useState(false),[$,se]=useState(false),[D,Y]=useState(false),[ie,we]=useState(""),W=useRef(null),ee=useRef(null),[Le,Te]=useState(""),Be=useRef(null),[Ne,Ge]=useState(""),[pt,it]=useState(false),[at,Ze]=useState([]),[At,Dt]=useState(""),[mt,bt]=useState(false),lt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=Uu(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),V(P),we(P.description||""),Te(P.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!ie)return;let P=setTimeout(()=>{let ge=ee.current;ge&&(ge.style.height="auto",ge.style.height=`${Math.max(100,ge.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,ie]),useEffect(()=>()=>{W.current&&clearTimeout(W.current),Be.current&&clearTimeout(Be.current);},[]),useEffect(()=>{t&&lt.current&&h.length>0&&setTimeout(()=>{lt.current&&(lt.current.scrollTop=lt.current.scrollHeight);},100);},[t,h.length]);let St=useCallback(P=>{V(P),Ce&&o&&je?o(qb(P,je)):r&&r(P);},[Ce,je,o,r]),Re=useCallback(()=>{We(false),te(false),Me(false),$e(null),Qe(false),wt(""),ut(false);},[]),Ae=useCallback((P,ge)=>{if(!M)return;let He={...M,[P]:ge};St(He);},[M,St]),ot=useCallback(()=>{let P=ee.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),ae=useCallback(P=>{we(P),setTimeout(ot,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(M){let ge={...M,description:P};St(ge);}},800);},[M,St,ot]),me=useCallback(P=>{Te(P),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{if(M&&P.trim()){let ge={...M,name:P.trim()};St(ge);}},800);},[M,St]),b=useCallback(P=>{let ge=P.map(He=>{let Ye={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:He};return He.type.startsWith("image/")&&(Ye.preview=URL.createObjectURL(He)),Ye});Ze(He=>[...He,...ge]);},[]),B=useCallback(P=>{Ze(ge=>{let He=ge.find(Ye=>Ye.id===P);return He?.preview&&URL.revokeObjectURL(He.preview),ge.filter(Ye=>Ye.id!==P)});},[]),H=useCallback(async()=>{if(!(!M||!Ne.trim()&&at.length===0||!y)){it(true);try{let P=Cu(Ne,f),ge=[];if(at.length>0&&x){let He=at.map(Ye=>Ye.file);ge=await x(He);}await y(M.id,Ne.trim(),P.length>0?P:void 0,ge.length>0?ge:void 0),Ge(""),at.forEach(He=>{He.preview&&URL.revokeObjectURL(He.preview);}),Ze([]);}finally{it(false);}}},[M,Ne,at,y,f,x]),_=useCallback(()=>{if(!M||!At.trim())return;let P=M.subtasks||[],ge={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:At.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},He=[...P,ge],Ye={...M,subtasks:He};St(Ye),Dt(""),bt(false);},[M,At,St]),ne=useCallback(P=>{if(!M?.subtasks)return;let ge=M.subtasks.map(Ye=>Ye.id===P?{...Ye,progress:Ye.progress===100?0:100}:Ye),He={...M,subtasks:ge};St(He);},[M,St]),he=useCallback(P=>{if(!M?.subtasks)return;let ge=M.subtasks.filter(Ye=>Ye.id!==P),He={...M,subtasks:ge};St(He);},[M,St]),J=useCallback(P=>{let ge=typeof P=="string"?new Date(P):P,Ye=new Date().getTime()-ge.getTime(),qt=Math.floor(Ye/6e4),Lt=Math.floor(Ye/36e5),Da=Math.floor(Ye/864e5);return qt<1?n==="es"?"Ahora":"Just now":qt<60?n==="es"?`Hace ${qt} min`:`${qt}m ago`:Lt<24?n==="es"?`Hace ${Lt}h`:`${Lt}h ago`:Da<7?n==="es"?`Hace ${Da}d`:`${Da}d ago`:ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),de=useCallback(P=>{if(!M)return;let ge=M.progress||0;P==="completed"?ge=100:P==="in-progress"&&ge===0?ge=10:P==="todo"&&(ge=0);let He={...M,status:P,progress:ge};St(He),We(false);},[M,St]),_e=useCallback((P,ge)=>{if(!M)return;let He={...M,startDate:P,endDate:ge};St(He);},[M,St]),Ke=useCallback(()=>{let P=De.getFullYear(),ge=De.getMonth(),He=new Date(P,ge,1),qt=new Date(P,ge+1,0).getDate(),Lt=He.getDay(),Da=[],Ba=new Date(P,ge,0).getDate();for(let fa=Lt-1;fa>=0;fa--)Da.push({date:new Date(P,ge-1,Ba-fa),isCurrentMonth:false});for(let fa=1;fa<=qt;fa++)Da.push({date:new Date(P,ge,fa),isCurrentMonth:true});let Ra=42-Da.length;for(let fa=1;fa<=Ra;fa++)Da.push({date:new Date(P,ge+1,fa),isCurrentMonth:false});return Da},[De]),gt=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),se(false),!M||!d)return;let ge=Array.from(P.dataTransfer.files);if(ge.length!==0){Y(true);try{await d(M.id,ge);}finally{Y(false);}}},[M,d]),Ot=useCallback(async P=>{if(!M||!d||!P.target.files)return;let ge=Array.from(P.target.files);if(ge.length!==0){Y(true);try{await d(M.id,ge);}finally{Y(false);}P.target.value="";}},[M,d]),Ht=useCallback(P=>{P.preventDefault(),P.stopPropagation(),se(true);},[]),U=useCallback(P=>{P.preventDefault(),P.stopPropagation(),se(false);},[]),oe=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Oe=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]);return !t||!M?null:jsx(AnimatePresence,{children:t&&M&&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:m("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:m("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:m("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:m("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:m("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:M.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 P=M.progress===100?0:100,He={...M,progress:P,status:P===100?"completed":"todo"};St(He);},className:m("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",M.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Le,onChange:P=>me(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:m("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",M.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Re(),We(!fe);},className:m("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",M.progress===100||M.status==="completed"?"bg-green-500/20 text-green-400":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/20 text-blue-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.progress===100||M.status==="completed"?n==="es"?"COMPLETADO":"DONE":M.progress&&M.progress>0||M.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:fe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>We(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label: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(P=>jsxs("button",{onClick:()=>de(P.id),className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",M.status===P.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Re(),Me(!X$1);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[M.assignees&&M.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[M.assignees.slice(0,3).map((P,ge)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},ge)),M.assignees.length>3&&jsxs("span",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",M.assignees.length-3]})]}):jsx("span",{className:m("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:m("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:X$1&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Me(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(P=>{let ge=M.assignees?.some(He=>He.name===P.name);return jsxs("button",{onClick:()=>{let He=M.assignees||[],Ye;ge?Ye=He.filter(qt=>qt.name!==P.name):Ye=[...He,P],Ae("assignees",Ye);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",ge&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsx("span",{className:m("flex-1",L?"text-white":"text-gray-900"),children:P.name}),ge&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsx("div",{className:m("px-3 py-4 text-sm text-center",L?"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:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{$e(be?null:"start"),Xe(M.startDate||new Date);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[M.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:m("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),M.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$e(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:m("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:m("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,ge=new Date(P);ge.setDate(P.getDate()+1);let He=new Date(P);He.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Ye=new Date(P);Ye.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let qt=new Date(P);qt.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let Lt=new Date(P);Lt.setDate(P.getDate()+14);let Da=new Date(P);return Da.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ge,display:ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:He,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ye,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:qt,display:qt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Lt,display:Lt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Da,display:Da.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ra,fa)=>jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(be==="start"){let ir=M.endDate&&Ra.date>M.endDate?Ra.date:M.endDate;_e(Ra.date,ir),$e("end");}else {let ir=M.startDate&&Ra.date<M.startDate?Ra.date:M.startDate;_e(ir,Ra.date),$e(null);}},children:[jsx("span",{children:Ra.label}),jsx("span",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Ra.display})]},fa))})(),jsx("div",{className:m("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{_e(void 0,void 0),$e(null);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:m("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:be==="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:m("font-medium",L?"text-white":"text-gray-900"),children:De.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Xe(new Date),className:m("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Xe(new Date(De.getFullYear(),De.getMonth()-1)),className:m("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>Xe(new Date(De.getFullYear(),De.getMonth()+1)),className:m("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(P=>jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ke().map((P,ge)=>{let He=P.date.toDateString()===new Date().toDateString(),Ye=M.startDate?.toDateString()===P.date.toDateString(),qt=M.endDate?.toDateString()===P.date.toDateString(),Lt=Ye||qt,Da=M.startDate&&M.endDate&&P.date>=M.startDate&&P.date<=M.endDate;return jsx("button",{onClick:()=>{let Ba=new Date(P.date);if(be==="start"){let Ra=M.endDate&&Ba>M.endDate?Ba:M.endDate;_e(Ba,Ra),$e("end");}else {let Ra=M.startDate&&Ba<M.startDate?Ba:M.startDate;_e(Ra,Ba),$e(null);}},className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(L?"text-white":"text-gray-900"),He&&"ring-2 ring-[#2E94FF]",Ye&&"bg-[#2E94FF] text-white",qt&&!Ye&&"bg-[#7C3AED] text-white",Da&&!Lt&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!Lt&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},ge)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Re(),te(!z);},className:m("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",M.priority==="high"||M.priority==="urgent"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":M.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.priority?M.priority==="high"||M.priority==="urgent"?n==="es"?"Alta":"High":M.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:z&&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:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label: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(P=>jsxs("button",{onClick:()=>{Ae("priority",P.id),te(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",M.priority===P.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:m("text-sm",L?"text-white":"text-gray-900"),children:M.startDate&&M.endDate?`${Math.ceil((M.endDate.getTime()-M.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:m("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Z?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:M.progress||0,onChange:P=>{let ge=parseInt(P.target.value),He=M.status;ge===100?He="completed":ge>0?He="in-progress":He="todo";let Ye={...M,progress:ge,status:He};St(Ye);},onBlur:()=>Je(false),className:m("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Je(true),className:m("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:m("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${M.progress||0}%`}})}),jsxs("span",{className:m("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[M.progress||0,"%"]})]})]}),k&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:M.status==="completed"||M.progress===100?jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?rn(w.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>qe("estimate"),className:m("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:rn(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>qe("estimate"),className:m("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:tt==="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($r,{mode:"estimate",locale:n,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async P=>{await I?.(M.id,P),qe(false);},onClose:()=>qe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"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:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"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"}):M.status==="completed"||M.progress===100?jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:M.quotedMinutes?rn(M.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):M.quotedMinutes?jsx("button",{type:"button",onClick:()=>qe("quoted"),className:m("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:rn(M.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>qe("quoted"),className:m("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:tt==="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($r,{mode:"quoted",locale:n,isDark:L,currentValue:M.quotedMinutes||null,onSave:async P=>{O?(await O(M.id,P),V(ge=>ge?{...ge,quotedMinutes:P}:null)):Ae("quotedMinutes",P),qe(false);},onClose:()=>qe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[M.status==="completed"||M.progress===100?jsx("div",{className:m("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):C?jsxs("button",{type:"button",onClick:()=>K?.(M.id),className:m("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"}),Yb(S||0)]}):jsx("button",{type:"button",onClick:()=>A?.(M.id),className:m("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),M.status==="completed"||M.progress===100?jsxs("div",{className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"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:()=>qe("log"),className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:m("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[rn(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:m("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",rn(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:m("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:tt==="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($r,{mode:"log",locale:n,isDark:L,currentValue:null,onSave:async(P,ge)=>{P&&await N?.(M.id,{durationMinutes:P,note:ge,source:"manual"}),qe(false);},onClose:()=>qe(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(lo,{selectedTags:M.tags||[],availableTags:u,onChange:P=>{Ae("tags",P);},onCreateTag:i,theme:q})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:m("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[M.dependencies&&M.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:M.dependencies.map(P=>{let ge=g.find(He=>He.id===P);return jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ge?.name||P.slice(0,8),jsx("button",{onClick:()=>{let He=(M.dependencies||[]).filter(Ye=>Ye!==P);Ae("dependencies",He);},className:m("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{Re(),Qe(!ue);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:m("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:ue&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Qe(false),wt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:m("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ct,onChange:P=>wt(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:m("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(P=>P.id!==M.id).filter(P=>ct===""||P.name.toLowerCase().includes(ct.toLowerCase())).map(P=>{let ge=M.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let He=M.dependencies||[],Ye;ge?Ye=He.filter(qt=>qt!==P.id):Ye=[...He,P.id],Ae("dependencies",Ye);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",ge&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ge?"bg-blue-500 border-blue-500":L?"border-white/30":"border-gray-300"),children:ge&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:m("block truncate",L?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:m("px-3 py-4 text-sm text-center",L?"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:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Re(),ut(!ye);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:M.color||"#6366F1"}}),jsx("span",{className:m("text-sm",L?"text-white":"text-gray-900"),children:Po.find(P=>P.value===M.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:m("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ye&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ut(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Po.map(P=>{let ge=M.color===P.value;return jsx("button",{onClick:()=>{Ae("color",P.value),ut(false);},className:m("w-7 h-7 rounded-full flex items-center justify-center transition-all",ge&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:ge?P.value:void 0},title:P.name,children:ge&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",L?"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:M.isMilestone||false,onChange:P=>Ae("isMilestone",P.target.checked),className:m("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",M.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:m("text-sm",L?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:m("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:m("text-sm font-semibold",L?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ee,value:ie,onChange:P=>ae(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:m("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:m("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",M.subtasks&&M.subtasks.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",M.subtasks.filter(P=>P.progress===100).length,"/",M.subtasks.length,")"]})]})}),M.subtasks&&M.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...M.subtasks].sort((P,ge)=>(P.position??0)-(ge.position??0)).map(P=>jsxs("div",{className:m("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>ne(P.id),className:m("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:m("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:P.name}),jsx("button",{onClick:()=>he(P.id),className:m("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},P.id))}),mt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:At,onChange:P=>Dt(P.target.value),onKeyDown:P=>{P.key==="Enter"&&At.trim()?_():P.key==="Escape"&&(bt(false),Dt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:m("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:_,disabled:!At.trim(),className:m("px-3 py-2 rounded-lg text-sm font-medium transition-colors",At.trim()?"bg-blue-500 hover:bg-blue-600 text-white":L?"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:()=>{bt(false),Dt("");},className:m("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>bt(true),className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:m("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let ge=Oe(P.type),He=P.type.startsWith("image/");return jsxs("div",{className:m("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[He&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:m("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsx(ge,{className:m("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:m("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:oe(P.size)})]}),p&&jsx("button",{onClick:()=>p(P.id),className:m("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxs("div",{onDragOver:Ht,onDragLeave:U,onDrop:gt,className:m("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",$?L?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":L?"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:Ot,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||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:m("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:m("w-6 h-6 mx-auto mb-2",$?"text-blue-500":L?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:m("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:$?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"})]})}),!d&&jsx("p",{className:m("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:m("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:m("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",h.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",h.length,")"]})]}),jsx("button",{onClick:a,className:m("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
5
5
  .activity-comments-scroll::-webkit-scrollbar {
6
6
  width: 4px !important;
7
7
  }
@@ -15,7 +15,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
15
15
  .activity-comments-scroll:hover::-webkit-scrollbar-thumb {
16
16
  background: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsx("div",{ref:lt,className:m("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:h.length>0?jsx("div",{className:"space-y-4",children:[...h].sort((P,me)=>{let He=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,Ye=typeof me.createdAt=="string"?new Date(me.createdAt):me.createdAt;return He.getTime()-Ye.getTime()}).map(P=>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:P.user?.color||"#8B5CF6"},children:P.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:m("text-sm font-medium",L?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:J(P.createdAt)})]}),jsx("div",{className:m("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Nu,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(me=>{let He=me.type.startsWith("image/");return jsxs("a",{href:me.url,target:"_blank",rel:"noopener noreferrer",className:m("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[He?jsx(Image,{className:m("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:m("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:m("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:me.name})]},me.id)})})]})]},P.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:m("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:m("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:m("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsx(Tu,{value:Ne,onChange:Ge,onSubmit:H,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!y,isSubmitting:pt,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!x,pendingFiles:at,onFilesSelect:b,onRemoveFile:B})})]})]})]})})}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:l,isLoading:u,error:i,children:c,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:h,onDeleteAttachment:y,comments:v,onAddComment:f,currentUser:x,mentionableUsers:k,onTaskOpen:w,onUploadCommentAttachments:T,enableTimeTracking:C,timeTrackingSummary:S,timeEntries:N,timerState:I,onLogTime:O,onUpdateEstimate:A,onUpdateSoldEffort:K,onStartTimer:E,onStopTimer:ce,onDiscardTimer:L,blurFinancials:q=false,sidePanel:Ce,renderColumnMetrics:je,suppressDetailModal:M=false}){let[V,fe]=yl(),[We,z]=useState(null),[te,X]=useState(false),Me=useRef(null),be=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),$e=o?.theme||"dark",De=$e==="dark"||$e==="neutral",Xe=De?"dark":"",Z=useCallback((D,Y)=>{t.onCardUpdate?.(D,Y);},[t]),Je=useCallback((D,Y)=>{t.onColumnUpdate?.(D,{title:Y});},[t]),ue=useCallback(D=>{t.onColumnDelete?.(D);},[t]),Qe=["todo","in-progress","completed"],ct=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),wt=useMemo(()=>{let D=new Map;return e.columns.forEach(Y=>{let ie=Y.cardIds.map(we=>e.cards.find(W=>W.id===we)).filter(we=>we!==void 0).sort((we,W)=>we.position-W.position);D.set(Y.id,ie);}),D},[e.cards,e.columns]);useEffect(()=>{let D=Me.current;if(!D)return;let Y=ee=>{let Le=ee.target,Te=ee.button===1,Be=Le===D||Le.classList.contains("asakaa-column")&&!Le.closest(".asakaa-card");(Te||ee.button===0&&Be&&!V.isDragging)&&(ee.preventDefault(),X(true),be.current={x:ee.clientX,y:ee.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},ie=ee=>{if(!te)return;let Le=ee.clientX-be.current.x,Te=ee.clientY-be.current.y;D.scrollLeft=be.current.scrollLeft-Le,D.scrollTop=be.current.scrollTop-Te;},we=()=>{te&&(X(false),D.style.cursor="",D.style.userSelect="");},W=()=>{te&&(X(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",Y),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",we),D.addEventListener("mouseleave",W),()=>{D.removeEventListener("mousedown",Y),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",we),D.removeEventListener("mouseleave",W);}},[te,V.isDragging]);let ye=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(Y=>typeof Y=="string"?Y:Y.taskId):[]})),[e.cards]),ut=useCallback(D=>{let{active:Y}=D,ie=e.cards.find(we=>we.id===Y.id);ie&&fe({isDragging:true,draggedCardId:ie.id,sourceColumnId:ie.columnId,targetColumnId:ie.columnId});},[e.cards,fe]),tt=useCallback(D=>{let{active:Y,over:ie}=D;if(!ie||!e.cards.find(ee=>ee.id===Y.id))return;let W=null;ie.data.current?.type==="column"?W=ie.id:ie.data.current?.type==="card"&&(W=e.cards.find(Le=>Le.id===ie.id)?.columnId||null),W&&W!==V.targetColumnId&&fe({...V,targetColumnId:W});},[e.cards,V,fe]),qe=useCallback(async D=>{let{active:Y,over:ie}=D;if(fe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ie)return;let we=e.cards.find(Te=>Te.id===Y.id);if(!we)return;let W,ee;if(ie.data.current?.type==="column"){W=ie.id;let Te=wt.get(W)||[];ee=el(Te,0);}else {let Te=e.cards.find(Ge=>Ge.id===ie.id);if(!Te)return;W=Te.columnId;let Be=wt.get(W)||[],Ne=Be.findIndex(Ge=>Ge.id===ie.id);ee=el(Be,Ne);}let Le=e.columns.find(Te=>Te.id===W);if(Le&&Le.wipLimit&&Le.wipLimitType==="hard"){let Te=wt.get(W)||[];if(we.columnId!==W&&Te.length>=Le.wipLimit){t.onWipLimitExceeded?.(Le,we);return}}(we.columnId!==W||we.position!==ee)&&await t.onCardMove?.(we.id,W,ee);},[e.cards,e.columns,wt,t,fe]),$=useCallback(D=>{M||z(D),a?.(D),w?.(D.id);},[a,w,M]),se=useCallback(D=>{t.onCardUpdate?.(D.id,D),z(D);},[t]);return u?jsx("div",{className:m("asakaa-board",Xe,n),style:l,children:jsx(ih,{columnCount:3})}):i?jsx("div",{className:m("asakaa-board",Xe,n),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Zc,{themeName:$e,children:[jsxs("div",{className:m("flex h-full overflow-hidden",Ce?"flex-row":""),children:[jsxs(DndContext,{sensors:ct,collisionDetection:closestCorners,onDragStart:ut,onDragOver:tt,onDragEnd:qe,children:[jsxs("div",{ref:Me,className:m("asakaa-board",Ce?"flex-1":"",Xe,n),style:{...l,cursor:te?"grabbing":void 0},"data-theme":$e,children:[e.columns.sort((D,Y)=>D.position-Y.position).map(D=>{let Y=wt.get(D.id)||[],ie=!Qe.includes(D.id),we=r?.renderColumnFooter?.(D);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(tn,{column:D,cards:Y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:je?(W,ee)=>je(W,ee):void 0,onCardClick:$,onCardUpdate:Z,onColumnRename:t.onColumnUpdate?Je:void 0,onColumnDelete:t.onColumnDelete?ue:void 0,isDeletable:ie,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),we]},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})]}),Ce]}),!M&&jsx(Xr,{task:We,isOpen:!!We,onClose:()=>z(null),onCardUpdate:se,theme:De?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:We?g?.get(We.id)||[]:[],onUploadAttachments:h,onDeleteAttachment:y,availableTasks:ye,comments:v,onAddComment:f,currentUser:x,mentionableUsers:k,onUploadCommentAttachments:T,enableTimeTracking:C,timeTrackingSummary:S,timeEntries:N,isTimerRunning:I?.isRunning,timerElapsedSeconds:I?.elapsedSeconds,onTimeLog:O,onEstimateUpdate:A,onSoldEffortUpdate:K,onTimerStart:E,onTimerStop:ce,onTimerDiscard:L,blurFinancials:q})]})}function ih({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 ph={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)"},mh={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)"},gh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},fh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function bh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),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:{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((i,c)=>i.position-c.position).map((i,c)=>jsxs(motion.button,{onClick:()=>u(i.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:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function hh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,u]=useState(null),i=useRef(null);if(useEffect(()=>{let g=h=>{i.current&&!i.current.contains(h.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,h)=>{if(h){u(g);try{await h();}catch(y){console.error(`Export ${g} failed:`,y);}finally{u(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,h)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:h<d.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:l===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 yh({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:l,onExportExcel:u,translations:i,toolbarRightContent:c}){let d=r==="dark"?ph:mh,p={...o==="es"?gh:fh,...i},g=n||l||u;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxs("div",{className:"flex items-center gap-3",children:[c&&jsxs(Fragment,{children:[c,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(hh,{theme:d,t:p,onExportCSV:n,onExportJSON:l,onExportExcel:u}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsx(bh,{columns:e,onSelect:t,theme:d,t:p,createTaskLabel:a}):jsx(yh,{onClick:()=>t(),label:a||p.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),[l,u]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),u(""),n(false));},[l,e]),c=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(u(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsx("div",{className:m("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:p=>u(p.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{u(""),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:m("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:l="up"}){let[u,i]=useState(""),[c,d]=useState(void 0),[p,g]=useState(null),[h,y]=useState(null),[v,f]=useState(false),[x,k]=useState(false),[w,T]=useState(false),[C,S]=useState(s||new Date),N=useRef(null),I=o==="es",O=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{N.current?.focus();},[]);let A=useCallback(()=>{f(false),k(false),T(false);},[]),K=useCallback(()=>{i(""),d(void 0),g(null),y(null),A(),t();},[t,A]),E=useCallback(()=>{let q=u.trim();if(!q)return;let Ce=a.find(M=>M.id===p),je=h||s;e({name:q,priority:c,assignee:Ce||void 0,assigneeId:p,startDate:je,endDate:je}),i(""),d(void 0),g(null),y(null),A(),N.current?.focus();},[u,c,p,h,s,a,e,A]),ce=useCallback(q=>{q.key==="Enter"&&u.trim()&&(q.preventDefault(),E()),q.key==="Escape"&&K();},[E,K,u]),L=h||s||new Date;return jsxs("div",{className:m("quick-task-create",n),onClick:()=>A(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:N,type:"text",value:u,onChange:q=>i(q.target.value),placeholder:I?"Nombre de la tarea...":"Task name...",className:m("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:m("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(!v),k(false),T(false);},type:"button",className:m("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:v&&jsx(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:m("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:I?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:I?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:I?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:I?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:I?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxs("button",{onClick:()=>{d(q.id),f(false);},type:"button",className:m("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:m("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(),T(!w),f(false),k(false),S(h||s||new Date);},type:"button",className:m("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"}),L.toLocaleDateString(I?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:m("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:m("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,Ce=new Date(q);Ce.setDate(q.getDate()+1);let je=new Date(q);je.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let M=new Date(q);M.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let V=new Date(q);V.setDate(q.getDate()+14);let fe=new Date(q);fe.setDate(q.getDate()+28);let We=I?"es-ES":"en-US";return [{label:I?"Hoy":"Today",date:q,display:q.toLocaleDateString(We,{weekday:"short"}).slice(0,3)+"."},{label:I?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(We,{weekday:"short"}).slice(0,3)+"."},{label:I?"Este fin de semana":"This weekend",date:je,display:I?"s\xE1b.":"sat."},{label:I?"Pr\xF3xima semana":"Next week",date:M,display:I?"lun.":"mon."},{label:I?"2 semanas":"2 weeks",date:V,display:V.toLocaleDateString(We,{day:"numeric",month:"short"})},{label:I?"4 semanas":"4 weeks",date:fe,display:fe.toLocaleDateString(We,{day:"numeric",month:"short"})}].map((te,X)=>jsxs("button",{type:"button",className:m("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:()=>{y(te.date),T(false);},children:[jsx("span",{children:te.label}),jsx("span",{className:m("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:te.display})]},X))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:m("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:C.toLocaleDateString(I?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>S(new Date),className:m("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:I?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>S(new Date(C.getFullYear(),C.getMonth()-1)),className:m("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:()=>S(new Date(C.getFullYear(),C.getMonth()+1)),className:m("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:(I?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsx("div",{className:m("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=C.getFullYear(),Ce=C.getMonth(),je=new Date(q,Ce,1).getDay(),M=new Date(q,Ce+1,0).getDate(),V=new Date(q,Ce,0).getDate(),fe=new Date().toDateString(),We=[];for(let te=je-1;te>=0;te--)We.push({dayNum:V-te,isCurrent:false,date:new Date(q,Ce-1,V-te)});for(let te=1;te<=M;te++)We.push({dayNum:te,isCurrent:true,date:new Date(q,Ce,te)});let z=42-We.length;for(let te=1;te<=z;te++)We.push({dayNum:te,isCurrent:false,date:new Date(q,Ce+1,te)});return We.map((te,X)=>{let Me=te.date.toDateString()===fe,be=(h||s)?.toDateString()===te.date.toDateString();return jsx("button",{type:"button",className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!te.isCurrent&&(r?"text-white/20":"text-gray-300"),te.isCurrent&&(r?"text-white":"text-gray-900"),Me&&"ring-1 ring-[#007FFF]",be&&"bg-[#007FFF] text-white",!be&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{y(te.date),T(false);},children:te.dayNum},X)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),k(!x),f(false),T(false);},type:"button",className:m("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(q=>q.id===p)?.color||"#007FFF"},children:a.find(q=>q.id===p)?.initials||a.find(q=>q.id===p)?.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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:m("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:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("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:I?"Sin asignar":"Unassigned"})]}),a.map(q=>jsxs("button",{type:"button",onClick:()=>{g(q.id),k(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===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:m("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:I?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:E,disabled:!u.trim(),type:"button",className:m("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",u.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:I?"Guardar":"Save"})]})]})}function Sl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[u,i]=useState(false),c=useRef(null),d=useRef(null),[p,g]=useState({}),[h,y]=useState(false),v=n==="dark",x={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!u||!c.current)return;let w=90,T=()=>{let C=c.current.getBoundingClientRect(),N=window.innerHeight-C.bottom<w+8;y(N),g({position:"fixed",...N?{bottom:window.innerHeight-C.top+4}:{top:C.bottom+4},left:C.left,width:C.width,zIndex:9999});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[u]),useEffect(()=>{if(!u)return;let w=T=>{let C=T.target;d.current&&!d.current.contains(C)&&c.current&&!c.current.contains(C)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]);let k=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:c,className:m("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>i(!u),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:u&&jsx(motion.div,{ref:d,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:p,className:m("rounded-lg shadow-2xl",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:k,onCancel:()=>i(false),availableUsers:a,isDark:v,locale:l,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(`
18
+ `}),jsx("div",{ref:lt,className:m("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:h.length>0?jsx("div",{className:"space-y-4",children:[...h].sort((P,ge)=>{let He=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,Ye=typeof ge.createdAt=="string"?new Date(ge.createdAt):ge.createdAt;return He.getTime()-Ye.getTime()}).map(P=>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:P.user?.color||"#8B5CF6"},children:P.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:m("text-sm font-medium",L?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:m("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:J(P.createdAt)})]}),jsx("div",{className:m("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Nu,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(ge=>{let He=ge.type.startsWith("image/");return jsxs("a",{href:ge.url,target:"_blank",rel:"noopener noreferrer",className:m("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[He?jsx(Image,{className:m("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:m("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:m("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:ge.name})]},ge.id)})})]})]},P.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:m("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:m("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:m("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsx(Tu,{value:Ne,onChange:Ge,onSubmit:H,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!y,isSubmitting:pt,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!x,pendingFiles:at,onFilesSelect:b,onRemoveFile:B})})]})]})]})})}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:l,isLoading:u,error:i,children:c,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:h,onDeleteAttachment:y,comments:v,onAddComment:f,currentUser:x,mentionableUsers:k,onTaskOpen:w,onUploadCommentAttachments:T,enableTimeTracking:C,timeTrackingSummary:S,timeEntries:N,timerState:I,onLogTime:O,onUpdateEstimate:A,onUpdateSoldEffort:K,onStartTimer:E,onStopTimer:ce,onDiscardTimer:L,blurFinancials:q=false,sidePanel:Ce,renderColumnMetrics:je,suppressDetailModal:M=false}){let[V,fe]=yl(),[We,z]=useState(null),[te,X]=useState(false),Me=useRef(null),be=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),$e=o?.theme||"dark",De=$e==="dark"||$e==="neutral",Xe=De?"dark":"",Z=useCallback((D,Y)=>{t.onCardUpdate?.(D,Y);},[t]),Je=useCallback((D,Y)=>{t.onColumnUpdate?.(D,{title:Y});},[t]),ue=useCallback(D=>{t.onColumnDelete?.(D);},[t]),Qe=["todo","in-progress","completed"],ct=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),wt=useMemo(()=>{let D=new Map;return e.columns.forEach(Y=>{let ie=Y.cardIds.map(we=>e.cards.find(W=>W.id===we)).filter(we=>we!==void 0).sort((we,W)=>we.position-W.position);D.set(Y.id,ie);}),D},[e.cards,e.columns]);useEffect(()=>{let D=Me.current;if(!D)return;let Y=ee=>{let Le=ee.target,Te=ee.button===1,Be=Le===D||Le.classList.contains("asakaa-column")&&!Le.closest(".asakaa-card");(Te||ee.button===0&&Be&&!V.isDragging)&&(ee.preventDefault(),X(true),be.current={x:ee.clientX,y:ee.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},ie=ee=>{if(!te)return;let Le=ee.clientX-be.current.x,Te=ee.clientY-be.current.y;D.scrollLeft=be.current.scrollLeft-Le,D.scrollTop=be.current.scrollTop-Te;},we=()=>{te&&(X(false),D.style.cursor="",D.style.userSelect="");},W=()=>{te&&(X(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",Y),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",we),D.addEventListener("mouseleave",W),()=>{D.removeEventListener("mousedown",Y),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",we),D.removeEventListener("mouseleave",W);}},[te,V.isDragging]);let ye=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(Y=>typeof Y=="string"?Y:Y.taskId):[]})),[e.cards]),ut=useCallback(D=>{let{active:Y}=D,ie=e.cards.find(we=>we.id===Y.id);ie&&fe({isDragging:true,draggedCardId:ie.id,sourceColumnId:ie.columnId,targetColumnId:ie.columnId});},[e.cards,fe]),tt=useCallback(D=>{let{active:Y,over:ie}=D;if(!ie||!e.cards.find(ee=>ee.id===Y.id))return;let W=null;ie.data.current?.type==="column"?W=ie.id:ie.data.current?.type==="card"&&(W=e.cards.find(Le=>Le.id===ie.id)?.columnId||null),W&&W!==V.targetColumnId&&fe({...V,targetColumnId:W});},[e.cards,V,fe]),qe=useCallback(async D=>{let{active:Y,over:ie}=D;if(fe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ie)return;let we=e.cards.find(Te=>Te.id===Y.id);if(!we)return;let W,ee;if(ie.data.current?.type==="column"){W=ie.id;let Te=wt.get(W)||[];ee=el(Te,0);}else {let Te=e.cards.find(Ge=>Ge.id===ie.id);if(!Te)return;W=Te.columnId;let Be=wt.get(W)||[],Ne=Be.findIndex(Ge=>Ge.id===ie.id);ee=el(Be,Ne);}let Le=e.columns.find(Te=>Te.id===W);if(Le&&Le.wipLimit&&Le.wipLimitType==="hard"){let Te=wt.get(W)||[];if(we.columnId!==W&&Te.length>=Le.wipLimit){t.onWipLimitExceeded?.(Le,we);return}}(we.columnId!==W||we.position!==ee)&&await t.onCardMove?.(we.id,W,ee);},[e.cards,e.columns,wt,t,fe]),$=useCallback(D=>{M||z(D),a?.(D),w?.(D.id);},[a,w,M]),se=useCallback(D=>{t.onCardUpdate?.(D.id,D),z(D);},[t]);return u?jsx("div",{className:m("asakaa-board",Xe,n),style:l,children:jsx(ih,{columnCount:3})}):i?jsx("div",{className:m("asakaa-board",Xe,n),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Zc,{themeName:$e,children:[jsxs("div",{className:m("flex h-full overflow-hidden",Ce?"flex-row":""),children:[jsxs(DndContext,{sensors:ct,collisionDetection:closestCorners,onDragStart:ut,onDragOver:tt,onDragEnd:qe,children:[jsxs("div",{ref:Me,className:m("asakaa-board",Ce?"flex-1":"",Xe,n),style:{...l,cursor:te?"grabbing":void 0},"data-theme":$e,children:[e.columns.sort((D,Y)=>D.position-Y.position).map(D=>{let Y=wt.get(D.id)||[],ie=!Qe.includes(D.id),we=r?.renderColumnFooter?.(D);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(tn,{column:D,cards:Y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:je?(W,ee)=>je(W,ee):void 0,onCardClick:$,onCardUpdate:Z,onColumnRename:t.onColumnUpdate?Je:void 0,onColumnDelete:t.onColumnDelete?ue:void 0,isDeletable:ie,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),we]},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})]}),Ce]}),!M&&jsx(Xr,{task:We,isOpen:!!We,onClose:()=>z(null),onCardUpdate:se,theme:De?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:We?g?.get(We.id)||[]:[],onUploadAttachments:h,onDeleteAttachment:y,availableTasks:ye,comments:v,onAddComment:f,currentUser:x,mentionableUsers:k,onUploadCommentAttachments:T,enableTimeTracking:C,timeTrackingSummary:S,timeEntries:N,isTimerRunning:I?.isRunning,timerElapsedSeconds:I?.elapsedSeconds,onTimeLog:O,onEstimateUpdate:A,onSoldEffortUpdate:K,onTimerStart:E,onTimerStop:ce,onTimerDiscard:L,blurFinancials:q})]})}function ih({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 ph={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)"},mh={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)"},gh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},fh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function bh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),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:{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((i,c)=>i.position-c.position).map((i,c)=>jsxs(motion.button,{onClick:()=>u(i.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:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function hh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,u]=useState(null),i=useRef(null);if(useEffect(()=>{let g=h=>{i.current&&!i.current.contains(h.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,h)=>{if(h){u(g);try{await h();}catch(y){console.error(`Export ${g} failed:`,y);}finally{u(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,h)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:h<d.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:l===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 yh({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:l,onExportExcel:u,translations:i,toolbarRightContent:c}){let d=r==="dark"?ph:mh,p={...o==="es"?gh:fh,...i},g=n||l||u;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxs("div",{className:"flex items-center gap-3",children:[c&&jsxs(Fragment,{children:[c,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(hh,{theme:d,t:p,onExportCSV:n,onExportJSON:l,onExportExcel:u}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsx(bh,{columns:e,onSelect:t,theme:d,t:p,createTaskLabel:a}):jsx(yh,{onClick:()=>t(),label:a||p.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),[l,u]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),u(""),n(false));},[l,e]),c=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(u(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsx("div",{className:m("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:p=>u(p.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{u(""),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:m("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:l="up"}){let[u,i]=useState(""),[c,d]=useState(void 0),[p,g]=useState(null),[h,y]=useState(null),[v,f]=useState(false),[x,k]=useState(false),[w,T]=useState(false),[C,S]=useState(s||new Date),N=useRef(null),I=o==="es",O=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{N.current?.focus();},[]);let A=useCallback(()=>{f(false),k(false),T(false);},[]),K=useCallback(()=>{i(""),d(void 0),g(null),y(null),A(),t();},[t,A]),E=useCallback(()=>{let q=u.trim();if(!q)return;let Ce=a.find(M=>M.id===p),je=h||s;e({name:q,priority:c,assignee:Ce||void 0,assigneeId:p,startDate:je,endDate:je}),i(""),d(void 0),g(null),y(null),A(),N.current?.focus();},[u,c,p,h,s,a,e,A]),ce=useCallback(q=>{q.key==="Enter"&&u.trim()&&(q.preventDefault(),E()),q.key==="Escape"&&K();},[E,K,u]),L=h||s||new Date;return jsxs("div",{className:m("quick-task-create",n),onClick:()=>A(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:N,type:"text",value:u,onChange:q=>i(q.target.value),placeholder:I?"Nombre de la tarea...":"Task name...",className:m("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:m("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(!v),k(false),T(false);},type:"button",className:m("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:v&&jsx(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:m("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:I?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:I?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:I?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:I?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:I?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxs("button",{onClick:()=>{d(q.id),f(false);},type:"button",className:m("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:m("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(),T(!w),f(false),k(false),S(h||s||new Date);},type:"button",className:m("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"}),L.toLocaleDateString(I?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:m("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:m("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,Ce=new Date(q);Ce.setDate(q.getDate()+1);let je=new Date(q);je.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let M=new Date(q);M.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let V=new Date(q);V.setDate(q.getDate()+14);let fe=new Date(q);fe.setDate(q.getDate()+28);let We=I?"es-ES":"en-US";return [{label:I?"Hoy":"Today",date:q,display:q.toLocaleDateString(We,{weekday:"short"}).slice(0,3)+"."},{label:I?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(We,{weekday:"short"}).slice(0,3)+"."},{label:I?"Este fin de semana":"This weekend",date:je,display:I?"s\xE1b.":"sat."},{label:I?"Pr\xF3xima semana":"Next week",date:M,display:I?"lun.":"mon."},{label:I?"2 semanas":"2 weeks",date:V,display:V.toLocaleDateString(We,{day:"numeric",month:"short"})},{label:I?"4 semanas":"4 weeks",date:fe,display:fe.toLocaleDateString(We,{day:"numeric",month:"short"})}].map((te,X)=>jsxs("button",{type:"button",className:m("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:()=>{y(te.date),T(false);},children:[jsx("span",{children:te.label}),jsx("span",{className:m("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:te.display})]},X))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:m("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:C.toLocaleDateString(I?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>S(new Date),className:m("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:I?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>S(new Date(C.getFullYear(),C.getMonth()-1)),className:m("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:()=>S(new Date(C.getFullYear(),C.getMonth()+1)),className:m("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:(I?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsx("div",{className:m("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=C.getFullYear(),Ce=C.getMonth(),je=new Date(q,Ce,1).getDay(),M=new Date(q,Ce+1,0).getDate(),V=new Date(q,Ce,0).getDate(),fe=new Date().toDateString(),We=[];for(let te=je-1;te>=0;te--)We.push({dayNum:V-te,isCurrent:false,date:new Date(q,Ce-1,V-te)});for(let te=1;te<=M;te++)We.push({dayNum:te,isCurrent:true,date:new Date(q,Ce,te)});let z=42-We.length;for(let te=1;te<=z;te++)We.push({dayNum:te,isCurrent:false,date:new Date(q,Ce+1,te)});return We.map((te,X)=>{let Me=te.date.toDateString()===fe,be=(h||s)?.toDateString()===te.date.toDateString();return jsx("button",{type:"button",className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!te.isCurrent&&(r?"text-white/20":"text-gray-300"),te.isCurrent&&(r?"text-white":"text-gray-900"),Me&&"ring-1 ring-[#007FFF]",be&&"bg-[#007FFF] text-white",!be&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{y(te.date),T(false);},children:te.dayNum},X)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),k(!x),f(false),T(false);},type:"button",className:m("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(q=>q.id===p)?.color||"#007FFF"},children:a.find(q=>q.id===p)?.initials||a.find(q=>q.id===p)?.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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:m("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:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("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:I?"Sin asignar":"Unassigned"})]}),a.map(q=>jsxs("button",{type:"button",onClick:()=>{g(q.id),k(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===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:m("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:I?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:E,disabled:!u.trim(),type:"button",className:m("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",u.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:I?"Guardar":"Save"})]})]})}function Sl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[u,i]=useState(false),c=useRef(null),d=useRef(null),[p,g]=useState({}),[h,y]=useState(false),v=n==="dark",x={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!u||!c.current)return;let w=90,T=()=>{let C=c.current.getBoundingClientRect(),N=window.innerHeight-C.bottom<w+8;y(N),g({position:"fixed",...N?{bottom:window.innerHeight-C.top+4}:{top:C.bottom+4},left:C.left,width:C.width,zIndex:9999});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[u]),useEffect(()=>{if(!u)return;let w=T=>{let C=T.target;d.current&&!d.current.contains(C)&&c.current&&!c.current.contains(C)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[u]);let k=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:c,className:m("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>i(!u),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:u&&jsx(motion.div,{ref:d,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:p,className:m("rounded-lg shadow-2xl",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:k,onCancel:()=>i(false),availableUsers:a,isDark:v,locale:l,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
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 Ml({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:u,shortcut:i="k",className:c=""}){let[d,p]=useState(false),[g,h]=useState(""),[y,v]=useState("home"),[f,x]=useState(""),[k,w]=useState("");useEffect(()=>{let N=I=>{(I.metaKey||I.ctrlKey)&&I.key===i&&(I.preventDefault(),p(O=>!O)),I.key==="Escape"&&(p(false),v("home"),h(""));};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i]),useEffect(()=>{d||(v("home"),h(""),x(""),w(""));},[d]);let T=useCallback(()=>{p(false);},[]),C=useCallback(N=>{let[I,O]=N.split(":");switch(I){case "create-card":v("create-card");break;case "create-card-in":x(O||"");break;case "navigate":O?(a?.(O),T()):v("navigate");break;case "search":r?.(g),T();break;case "priority":v("priority");break;case "set-priority":k&&O&&(o?.(k,O),T());break;case "assign":v("assign");break;case "assign-user":k&&O&&(s?.(k,O),T());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),T();break;case "ai-predict-risks":l?.(),T();break;case "ai-usage":u?.(),T();break;case "back":v("home");break;}},[g,k,t,a,r,o,s,n,l,u,T]),S=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),T());},[f,g,t,T]);return d?jsx(Bt,{children:jsx("div",{className:"command-palette-overlay",onClick:T,children:jsx("div",{className:`command-palette ${c}`,onClick:N=>N.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:y==="create-card"&&f?"Type card title and press Enter...":y==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:N=>{N.key==="Enter"&&y==="create-card"&&f&&S();}}),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."}),y==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:C,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:C,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:C,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:C,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(N=>jsxs(Command.Item,{value:`navigate:${N.id}`,onSelect:C,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:N.priority==="URGENT"?"#EF4444":N.priority==="HIGH"?"#F59E0B":N.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:N.title}),N.labels&&N.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:N.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},N.id))})]}),y==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:C,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(N=>jsxs(Command.Item,{value:`create-card-in:${N.id}`,onSelect:C,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:N.title}),jsxs("div",{className:"command-palette-item-count",children:[N.cardIds.length," cards"]})]},N.id))})]}),y==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:C,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(N=>{let I=e.columns.find(O=>O.id===N.columnId);return jsxs(Command.Item,{value:`navigate:${N.id}`,onSelect:C,className:"command-palette-item",keywords:[N.title,N.description||"",...N.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:N.priority==="URGENT"?"#EF4444":N.priority==="HIGH"?"#F59E0B":N.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:N.title}),jsx("div",{className:"command-palette-item-meta",children:I?.title})]}),N.labels&&N.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:N.labels.slice(0,2).map(O=>jsx("span",{className:"command-palette-item-label",children:O},O))})]},N.id)})})]}),y==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:C,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:C,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:C,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:C,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;
@@ -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 y=r<a.length-1?r+1:0;i(),o(y);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(l),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function Lh(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 Ih(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 Ur({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[u,i]=useState(false),[c,d]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let h=useCallback((N,I)=>{I.preventDefault(),I.stopPropagation();let O=g.current.filter(E=>Al(E.type)),A=O.findIndex(E=>E.id===N.id),K=E=>{let ce=g.current.filter(q=>Al(q.type)),L=ce[E];L&&sp(L.url,L.name,ce,E,K);};sp(N.url,N.name,O,A,K);},[]),y=useCallback(N=>{let I=[],O=[];return e.length+N.length>s?(O.push(`Maximum ${s} files allowed`),{valid:I,errors:O}):(N.forEach(A=>{if(A.size/1048576>r){O.push(`${A.name} is too large (max ${r}MB)`);return}if(o&&!o.some(E=>A.type.match(E))){O.push(`${A.name} has invalid file type`);return}I.push(A);}),{valid:I,errors:O})},[e.length,s,r,o]),v=useCallback(async N=>{let{valid:I,errors:O}=y(N);if(O.length>0){d(O.join(", ")),setTimeout(()=>d(null),5e3);return}if(I.length!==0){i(true),d(null);try{await t?.(I);}catch(A){d(A instanceof Error?A.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[y,t]),f=useCallback(N=>{N.preventDefault(),N.stopPropagation(),l(true);},[]),x=useCallback(N=>{N.preventDefault(),N.stopPropagation(),l(false);},[]),k=useCallback(N=>{N.preventDefault(),N.stopPropagation();},[]),w=useCallback(N=>{N.preventDefault(),N.stopPropagation(),l(false);let I=Array.from(N.dataTransfer.files);v(I);},[v]),T=useCallback(N=>{let I=N.target.files?Array.from(N.target.files):[];v(I),p.current&&(p.current.value="");},[v]),C=useCallback(()=>{p.current?.click();},[]),S=useCallback(N=>{confirm("Are you sure you want to delete this attachment?")&&a?.(N);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:f,onDragLeave:x,onDragOver:k,onDrop:w,onClick:C,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:T,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:u?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(N=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Al(N.type)&&N.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>h(N,I),title:"Click to view full size",children:[jsx("img",{src:N.thumbnailUrl||N.url,alt:N.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:Ih(N.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:N.name,children:N.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Lh(N.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(N.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>S(N.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"})})})]},N.id))})]})}function Ll({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:u=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:h,onGenerateSubtasks:y,onEstimateEffort:v,currentUserId:f="user-1"}){let[x,k]=useState("details"),[w,T]=useState(false),[C,S]=useState({}),[N,I]=useState(""),[O,A]=useState(false),[K,E]=useState({});if(!t||!e)return null;let ce=useCallback(()=>{T(false),S({}),k("details"),I(""),E({}),a();},[a]),L=useCallback(()=>{r&&Object.keys(C).length>0&&(r(e.id,C),S({}),T(false));},[e.id,C,r]),q=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ce());},[e.id,o,ce]),Ce=useCallback(()=>{c&&N.trim()&&(c(e.id,N.trim()),I(""));},[e.id,N,c]),je=useCallback(async()=>{if(h){A(true);try{let z=await h(e);E(te=>({...te,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{A(false);}}},[e,h]),M=useCallback(async()=>{if(y){A(true);try{let z=await y(e);E(te=>({...te,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{A(false);}}},[e,y]),V=useCallback(async()=>{if(v){A(true);try{let z=await v(e);E(te=>({...te,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{A(false);}}},[e,v]),fe={...e,...C},We=s.filter(z=>fe.assignedUserIds?.includes(z.id));return jsx(Bt,{children:jsx("div",{className:"card-detail-overlay",onClick:ce,children:jsxs("div",{className:"card-detail-modal",onClick:z=>z.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:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),w?jsx("input",{type:"text",value:C.title??fe.title,onChange:z=>S({...C,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:fe.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[w?jsxs(Fragment,{children:[jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{T(false),S({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>T(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",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.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",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.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"}),w?jsx("textarea",{value:C.description??fe.description??"",onChange:z=>S({...C,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:fe.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsx("select",{multiple:true,value:C.assignedUserIds??fe.assignedUserIds??[],onChange:z=>{let te=Array.from(z.target.selectedOptions,X=>X.value);S({...C,assignedUserIds:te});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(z=>jsx("option",{value:z.id,children:z.name},z.id))}):jsx("div",{className:"card-detail-users",children:We.length>0?We.map(z=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:z.color},children:z.initials}),jsx("span",{children:z.name})]},z.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxs("select",{value:C.priority??fe.priority??"",onChange:z=>S({...C,priority:z.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:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:fe.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:fe.labels&&fe.labels.length>0?fe.labels.map(z=>jsx("span",{className:"card-detail-label-tag",children:z},z)):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"}),w?jsx("input",{type:"date",value:C.startDate?new Date(C.startDate).toISOString().split("T")[0]:fe.startDate?new Date(fe.startDate).toISOString().split("T")[0]:"",onChange:z=>S({...C,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:fe.startDate?new Date(fe.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsx("input",{type:"date",value:C.endDate?new Date(C.endDate).toISOString().split("T")[0]:fe.endDate?new Date(fe.endDate).toISOString().split("T")[0]:"",onChange:z=>S({...C,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:fe.endDate?new Date(fe.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsx("input",{type:"number",min:"0",step:"0.5",value:C.estimatedTime??fe.estimatedTime??"",onChange:z=>S({...C,estimatedTime:z.target.value?parseFloat(z.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:fe.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:fe.dependencies&&fe.dependencies.length>0?fe.dependencies.map(z=>{let te=typeof z=="string"?z:z.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",te.slice(-4)]},te)}):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:fe.createdAt?new Date(fe.createdAt).toLocaleString():"Unknown"})]})]}),x==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:N,onChange:z=>I(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:Ce,disabled:!N.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(z=>{let te=s.find(X=>X.id===z.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:[te&&jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:te?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(z.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(z.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:z.content})]},z.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:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(z=>{let te=s.find(X=>X.id===z.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("COMMENT")&&"\u{1F4AC}",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",z.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:te?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:z.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.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(Ur,{cardId:e.id,attachments:i,onUpload:p?z=>p(e.id,z):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:je,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:M,disabled:O||!y,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||!v,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"]})]}),K.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),K.assignees.map((z,te)=>{let X=s.find(Me=>Me.id===z.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:z.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(z.confidence*100).toFixed(0),"%"]})]})]},te)})]}),K.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),K.subtasks.map((z,te)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:z.title}),z.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:z.description}),z.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",z.estimatedTime,"h"]})]},te))]}),K.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:[K.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(K.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),u.map(z=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${z.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:z.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:z.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:z.description}),z.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",z.suggestedAction]})]},z.id))]}),!K.assignees&&!K.subtasks&&!K.effort&&u.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 Vn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,u]=useState({top:0,left:0}),i=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,h=4,y=d.left;y+o>g-10&&(y=g-o-10),y<10&&(y=10);let v=p-d.bottom,f=d.top,x;return v>=s+h?x=d.bottom+h:f>=s+h?x=d.top-s-h:v>=f?x=d.bottom+h:x=Math.max(10,d.top-s-h),{top:x,left:y}},[e,o,s]);return useEffect(()=>{t&&u(c());},[t,c]),useEffect(()=>{if(!t)return;let d=g=>{let h=g.target;i.current&&!i.current.contains(h)&&e.current&&!e.current.contains(h)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(Bt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.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 nt={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 Wh=["LOW","MEDIUM","HIGH","URGENT"],Gh=["todo","in-progress","review","done"];function Rl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:u,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:h=[],availableLabels:y=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:x,unsplashAccessKey:k,theme:w,onSubtasksChange:T,attachments:C=[],onUploadAttachments:S,onDeleteAttachment:N}){let I=Qo(),O=w||I?.themeName||"dark",[A,K]=useState(e),[E,ce]=useState(false),[L,q]=useState(()=>[...e?.subtasks||[]].sort((B,H)=>(B.position??0)-(H.position??0))),[Ce,je]=useState(false),[M,V]=useState(""),[fe,We]=useState(""),[z,te]=useState("all"),[X,Me]=useState(false),[be,$e]=useState(false),[De,Xe]=useState(false),[Z,Je]=useState(false),[ue,Qe]=useState(false),[ct,wt]=useState(false),ye=useRef(null),ut=useRef(null),tt=useRef(null),qe=useRef(null),$=useRef(null),se=useRef(null),D=useRef(null),Y=useRef(null),ie=useRef(null),we=useRef(null),W=useRef(null),ee=useRef(null);useEffect(()=>{if(e&&!A){K({...e});let b=[...e.subtasks||[]].sort((B,H)=>(B.position??0)-(H.position??0));q(b);}else if(e&&A&&e.id!==A.id){K({...e});let b=[...e.subtasks||[]].sort((B,H)=>(B.position??0)-(H.position??0));q(b);}},[e,A]),useEffect(()=>{let b=B=>{let H=B.target;qe.current&&!qe.current.contains(H)&&Me(false),$.current&&!$.current.contains(H)&&$e(false),se.current&&!se.current.contains(H)&&Xe(false),D.current&&!D.current.contains(H)&&Je(false);};if(X||be||De||Z)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[X,be,De,Z]),useEffect(()=>{if(!t)return;let b=B=>{let H=B.target,_=H.tagName==="INPUT"||H.tagName==="TEXTAREA"||H.isContentEditable;if(B.key==="Escape"){B.preventDefault(),X||be||De||Z||ue||ct?(Me(false),$e(false),Xe(false),Je(false),Qe(false),wt(false)):_||a();return}if(_&&B.key!=="Escape")return;let ne=B.metaKey||B.ctrlKey;switch(B.key.toLowerCase()){case "s":B.preventDefault(),Me(true);break;case "a":B.preventDefault(),Xe(true);break;case "p":B.preventDefault(),$e(true);break;case "l":B.preventDefault(),Je(true);break;case "d":ne||(B.preventDefault(),Qe(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":ne||(B.preventDefault(),wt(true));break;case "i":B.preventDefault(),ce(true),setTimeout(()=>ut.current?.focus(),0);break;case "t":B.preventDefault(),je(true);break;case "c":B.preventDefault(),tt.current?.focus();break}};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t,a,X,be,De,Z,ue,ct]);let Le=useCallback(b=>{let B=b.currentTarget.textContent?.trim()||"";if(A&&B!==A.title){let H={...A,title:B};K(H),r?.(A.id,{title:B});}},[A,r]),Te=useCallback(b=>{b.key==="Enter"&&(b.preventDefault(),b.currentTarget.blur()),b.key==="Escape"&&(b.preventDefault(),b.currentTarget.textContent=A?.title||"",b.currentTarget.blur());},[A]),Be=useCallback(()=>{A&&e&&A.description!==e.description&&r?.(A.id,{description:A.description}),ce(false);},[A,e,r]),Ne=useCallback(b=>{if(A){let B={...A,columnId:b};K(B),r?.(A.id,{columnId:b}),Me(false);}},[A,r]),Ge=useCallback(b=>{if(A){let B={...A,priority:b};K(B),r?.(A.id,{priority:b}),$e(false);}},[A,r]),pt=useCallback(b=>{if(A){let B=A.assignedUserIds||[],H=B.includes(b)?B.filter(ne=>ne!==b):[...B,b],_={...A,assignedUserIds:H};K(_),r?.(A.id,{assignedUserIds:H});}},[A,r]),it=useCallback(b=>{if(A){let B=A.labels||[],H=B.includes(b)?B.filter(ne=>ne!==b):[...B,b],_={...A,labels:H};K(_),r?.(A.id,{labels:H});}},[A,r]),at=useCallback(b=>{if(A){let B={...A,tags:b};K(B),r?.(A.id,{tags:b});}},[A,r]),Ze=useCallback(b=>{if(A){let B=b.target.value,H={...A,endDate:B};K(H),r?.(A.id,{endDate:B}),Qe(false);}},[A,r]),At=useCallback(b=>{if(A){let B={...A,estimatedTime:parseFloat(b)||0};K(B),r?.(A.id,{estimatedTime:parseFloat(b)||0});}},[A,r]),Dt=useCallback(()=>{if(M.trim()&&A){let b={id:`subtask-${Date.now()}`,title:M.trim(),completed:false,position:L.length,createdAt:new Date},B=[...L,b];q(B),V(""),je(false),T?.(A.id,B);}},[M,L,A,T]),mt=useCallback(b=>{let B=L.map(H=>H.id===b?{...H,completed:!H.completed,updatedAt:new Date}:H);q(B),A&&T?.(A.id,B);},[L,A,T]),bt=useCallback(b=>{let B=L.filter(H=>H.id!==b);q(B),A&&T?.(A.id,B);},[L,A,T]),lt=useCallback(()=>{fe.trim()&&A&&u&&(u(A.id,fe.trim()),We(""));},[fe,A,u]),St=useCallback(b=>{(b.metaKey||b.ctrlKey)&&b.key==="Enter"&&(b.preventDefault(),lt());},[lt]),Re=b=>jsx(Hh,{remarkPlugins:[zh],rehypePlugins:[Uh],components:{a:({node:B,...H})=>jsx("a",{...H,target:"_blank",rel:"noopener noreferrer"})},children:b}),Ae=l.filter(b=>z==="comments"?b.type.includes("COMMENT"):z==="history"?!b.type.includes("COMMENT"):true);if(!t||!e)return null;let ot=A||e,ae=s.filter(b=>ot.assignedUserIds?.includes(b.id)),ge=L.filter(b=>b.completed).length;return jsx(Bt,{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:b=>b.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:ye,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Le,onKeyDown:Te,children:ot.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:qe,children:[jsxs("button",{ref:ie,className:"modal-v2-field",onClick:()=>Me(!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:ot.columnId||"No status"})]}),jsx(Vn,{triggerRef:ie,isOpen:X,onClose:()=>Me(false),width:250,estimatedHeight:200,children:(h.length>0?h:Gh.map(b=>({id:b,title:b}))).map(b=>jsx("button",{className:`modal-v2-popover-item ${ot.columnId===b.id?"active":""}`,onClick:()=>Ne(b.id),children:b.title},b.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:se,children:[jsxs("button",{ref:we,className:"modal-v2-field",onClick:()=>Xe(!De),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:ae.length>0?jsx("div",{className:"modal-v2-avatars",children:ae.map(b=>jsx("div",{className:"modal-v2-avatar",style:{background:b.color},title:b.name,children:b.initials},b.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Vn,{triggerRef:we,isOpen:De,onClose:()=>Xe(false),width:280,estimatedHeight:300,children:s.map(b=>jsxs("button",{className:`modal-v2-popover-item ${ot.assignedUserIds?.includes(b.id)?"active":""}`,onClick:()=>pt(b.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:b.color},children:b.initials}),b.name,ot.assignedUserIds?.includes(b.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"})})]},b.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:$,children:[jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>$e(!be),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:ot.priority||"None"})]}),jsxs(Vn,{triggerRef:W,isOpen:be,onClose:()=>$e(false),width:180,estimatedHeight:220,children:[Wh.map(b=>jsx("button",{className:`modal-v2-popover-item priority-${b.toLowerCase()} ${ot.priority===b?"active":""}`,onClick:()=>Ge(b),children:b},b)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ge(""),children:"None"})]})]}),v.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:ot.tags||[],availableTags:v,onChange:at,onCreateTag:f,theme:nt[O]||nt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxs("button",{ref:ee,className:"modal-v2-field",onClick:()=>Je(!Z),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:ot.labels&&ot.labels.length>0?jsx("span",{children:ot.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Vn,{triggerRef:ee,isOpen:Z,onClose:()=>Je(false),width:220,estimatedHeight:200,children:(y.length>0?y:["Bug","Feature","Enhancement","Documentation"]).map(b=>jsxs("button",{className:`modal-v2-popover-item ${ot.labels?.includes(b)?"active":""}`,onClick:()=>it(b),children:[b,ot.labels?.includes(b)&&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"})})]},b))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{Qe(!ue),setTimeout(()=>Y.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:ot.endDate?new Date(ot.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Y,type:"date",value:typeof ot.endDate=="string"?ot.endDate.split("T")[0]:ot.endDate?(()=>{let b=new Date(ot.endDate),B=b.getUTCFullYear(),H=String(b.getUTCMonth()+1).padStart(2,"0"),_=String(b.getUTCDate()).padStart(2,"0");return `${B}-${H}-${_}`})():"",onChange:Ze,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>wt(!ct),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:ot.estimatedTime?`${ot.estimatedTime}h`:"Not set"})]}),ct&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ot.estimatedTime||"",onChange:b=>At(b.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>wt(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"})]}),E?jsx("textarea",{className:"modal-v2-textarea",value:ot.description||"",onChange:b=>{if(A){let B={...A,description:b.target.value};K(B);}},onBlur:Be,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>ce(true),children:ot.description?jsx("div",{className:"modal-v2-markdown",children:Re(ot.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"}),L.length>0&&jsxs("span",{className:"modal-v2-count",children:[ge,"/",L.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>je(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:[L.map(b=>jsxs("div",{className:`modal-v2-subtask ${b.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>mt(b.id),children:b.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:b.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>bt(b.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"})]})})]},b.id)),Ce&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:M,onChange:b=>V(b.target.value),onKeyDown:b=>{b.key==="Enter"&&Dt(),b.key==="Escape"&&(je(false),V(""));},onBlur:Dt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(S||C.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"}),C.length>0&&jsx("span",{className:"modal-v2-count",children:C.length})]}),jsx(Ur,{cardId:ot.id,attachments:C,onUpload:S?b=>S(ot.id,b):void 0,onDelete:N,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 ${z==="all"?"active":""}`,onClick:()=>te("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>te("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>te("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:tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:fe,onChange:b=>We(b.target.value),onKeyDown:St,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:lt,disabled:!fe.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Ae.map(b=>{let B=s.find(_=>_.id===b.userId);if(b.type.includes("COMMENT")){let _=n.find(ne=>ne.id===b.metadata?.commentId);return _?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[B&&jsx("div",{className:"modal-v2-avatar",style:{background:B.color},children:B.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:B?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(b.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:_.content})]})]},b.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[b.type.includes("CREATED")&&"\u2795",b.type.includes("UPDATED")&&"\u270F\uFE0F",b.type.includes("MOVED")&&"\u27A1\uFE0F",b.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",b.type.includes("ASSIGNED")&&"\u{1F464}",b.type.includes("PRIORITY")&&"\u{1F3AF}",b.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:B?.name||"Unknown"})," ",b.type.replace(/_/g," ").toLowerCase(),b.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:b.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(b.timestamp).toLocaleString()})]})]},b.id)}),Ae.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 $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((l,u)=>l+u.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,l)=>n+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.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,l)=>n+(l.planned||0),0)})]})]})]})}function iy({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,l=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=l;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(iy,{})}),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:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:u>=50?"#10B981":"#F59E0B"},children:[u.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var by={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},fp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function hy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:u,fill:"white",textAnchor:l>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((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||by[u.name]||fp[e.indexOf(u)%fp.length]})),l=n.map(u=>u.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?hy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(bp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${u} (${c.value} - ${d}%)`}})]}):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((u,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#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((u,i)=>i.value>u.value?i:u).name})]})]})]})}var js=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[u,i]=useState(false),[c,d]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let h=e.map(w=>w.id),y=w=>{r.onBulkUpdate?.(h,{priority:w}),l(false);},v=w=>{r.onBulkMove?.(h,w),i(false),a();},f=w=>{r.onBulkUpdate?.(h,{assignedUserIds:w}),d(false);},x=w=>{let T=new Set;e.forEach(S=>{S.labels?.forEach(N=>T.add(N));});let C=Array.from(new Set([...T,...w]));r.onBulkUpdate?.(h,{labels:C}),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:()=>l(!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(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w),children:[jsx("span",{className:m("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([w]),children:w},w))})]}),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 ky(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,u,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(g=>{let h=a?.find(y=>y.id===g);n=`assignee-${g}`,l=h?.name||`User ${g}`,u=h?.color,i=h?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=p.title,u=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u}),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),l=useMemo(()=>ky(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(po,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:m("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),p={...e,cards:d};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&&u(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.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:p,callbacks:r,availableUsers:a})})]},i.id)}),l.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 Gl({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=Wl.find(i=>i.value===e)||Wl[0];useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxs("div",{className:m("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:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:m("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(i=>jsxs("button",{onClick:()=>u(i.value),className:m("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.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 Ny(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&l&&u}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(u=>{o.current=[...o.current,u];},[]),l=useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return useEffect(()=>{function u(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Ny(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Sy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ey(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 Fy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ey(e),r=t?Sy(t):"";return a?`${a} + ${r}`:r}function My(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 l(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=My(e);return jsxs("div",{className:m("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(([l,u])=>u.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"}),l]}),jsx("div",{className:"space-y-3",children:u.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Fy(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var _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:**
85
+ `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=h=>{h.stopPropagation();let y=r<a.length-1?r+1:0;i(),o(y);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(l),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function Lh(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 Ih(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 Ur({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[u,i]=useState(false),[c,d]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let h=useCallback((N,I)=>{I.preventDefault(),I.stopPropagation();let O=g.current.filter(E=>Al(E.type)),A=O.findIndex(E=>E.id===N.id),K=E=>{let ce=g.current.filter(q=>Al(q.type)),L=ce[E];L&&sp(L.url,L.name,ce,E,K);};sp(N.url,N.name,O,A,K);},[]),y=useCallback(N=>{let I=[],O=[];return e.length+N.length>s?(O.push(`Maximum ${s} files allowed`),{valid:I,errors:O}):(N.forEach(A=>{if(A.size/1048576>r){O.push(`${A.name} is too large (max ${r}MB)`);return}if(o&&!o.some(E=>A.type.match(E))){O.push(`${A.name} has invalid file type`);return}I.push(A);}),{valid:I,errors:O})},[e.length,s,r,o]),v=useCallback(async N=>{let{valid:I,errors:O}=y(N);if(O.length>0){d(O.join(", ")),setTimeout(()=>d(null),5e3);return}if(I.length!==0){i(true),d(null);try{await t?.(I);}catch(A){d(A instanceof Error?A.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[y,t]),f=useCallback(N=>{N.preventDefault(),N.stopPropagation(),l(true);},[]),x=useCallback(N=>{N.preventDefault(),N.stopPropagation(),l(false);},[]),k=useCallback(N=>{N.preventDefault(),N.stopPropagation();},[]),w=useCallback(N=>{N.preventDefault(),N.stopPropagation(),l(false);let I=Array.from(N.dataTransfer.files);v(I);},[v]),T=useCallback(N=>{let I=N.target.files?Array.from(N.target.files):[];v(I),p.current&&(p.current.value="");},[v]),C=useCallback(()=>{p.current?.click();},[]),S=useCallback(N=>{confirm("Are you sure you want to delete this attachment?")&&a?.(N);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:f,onDragLeave:x,onDragOver:k,onDrop:w,onClick:C,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:T,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:u?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(N=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Al(N.type)&&N.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:I=>h(N,I),title:"Click to view full size",children:[jsx("img",{src:N.thumbnailUrl||N.url,alt:N.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:Ih(N.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:N.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:N.name,children:N.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Lh(N.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(N.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>S(N.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"})})})]},N.id))})]})}function Ll({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:u=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:h,onGenerateSubtasks:y,onEstimateEffort:v,currentUserId:f="user-1"}){let[x,k]=useState("details"),[w,T]=useState(false),[C,S]=useState({}),[N,I]=useState(""),[O,A]=useState(false),[K,E]=useState({});if(!t||!e)return null;let ce=useCallback(()=>{T(false),S({}),k("details"),I(""),E({}),a();},[a]),L=useCallback(()=>{r&&Object.keys(C).length>0&&(r(e.id,C),S({}),T(false));},[e.id,C,r]),q=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ce());},[e.id,o,ce]),Ce=useCallback(()=>{c&&N.trim()&&(c(e.id,N.trim()),I(""));},[e.id,N,c]),je=useCallback(async()=>{if(h){A(true);try{let z=await h(e);E(te=>({...te,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{A(false);}}},[e,h]),M=useCallback(async()=>{if(y){A(true);try{let z=await y(e);E(te=>({...te,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{A(false);}}},[e,y]),V=useCallback(async()=>{if(v){A(true);try{let z=await v(e);E(te=>({...te,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{A(false);}}},[e,v]),fe={...e,...C},We=s.filter(z=>fe.assignedUserIds?.includes(z.id));return jsx(Bt,{children:jsx("div",{className:"card-detail-overlay",onClick:ce,children:jsxs("div",{className:"card-detail-modal",onClick:z=>z.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:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),w?jsx("input",{type:"text",value:C.title??fe.title,onChange:z=>S({...C,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:fe.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[w?jsxs(Fragment,{children:[jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{T(false),S({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>T(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",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.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",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.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"}),w?jsx("textarea",{value:C.description??fe.description??"",onChange:z=>S({...C,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:fe.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsx("select",{multiple:true,value:C.assignedUserIds??fe.assignedUserIds??[],onChange:z=>{let te=Array.from(z.target.selectedOptions,X=>X.value);S({...C,assignedUserIds:te});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(z=>jsx("option",{value:z.id,children:z.name},z.id))}):jsx("div",{className:"card-detail-users",children:We.length>0?We.map(z=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:z.color},children:z.initials}),jsx("span",{children:z.name})]},z.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxs("select",{value:C.priority??fe.priority??"",onChange:z=>S({...C,priority:z.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:fe.priority==="URGENT"?"#EF4444":fe.priority==="HIGH"?"#F59E0B":fe.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:fe.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:fe.labels&&fe.labels.length>0?fe.labels.map(z=>jsx("span",{className:"card-detail-label-tag",children:z},z)):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"}),w?jsx("input",{type:"date",value:C.startDate?new Date(C.startDate).toISOString().split("T")[0]:fe.startDate?new Date(fe.startDate).toISOString().split("T")[0]:"",onChange:z=>S({...C,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:fe.startDate?new Date(fe.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsx("input",{type:"date",value:C.endDate?new Date(C.endDate).toISOString().split("T")[0]:fe.endDate?new Date(fe.endDate).toISOString().split("T")[0]:"",onChange:z=>S({...C,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:fe.endDate?new Date(fe.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsx("input",{type:"number",min:"0",step:"0.5",value:C.estimatedTime??fe.estimatedTime??"",onChange:z=>S({...C,estimatedTime:z.target.value?parseFloat(z.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:fe.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:fe.dependencies&&fe.dependencies.length>0?fe.dependencies.map(z=>{let te=typeof z=="string"?z:z.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",te.slice(-4)]},te)}):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:fe.createdAt?new Date(fe.createdAt).toLocaleString():"Unknown"})]})]}),x==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:N,onChange:z=>I(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:Ce,disabled:!N.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(z=>{let te=s.find(X=>X.id===z.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:[te&&jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:te?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(z.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(z.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:z.content})]},z.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:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(z=>{let te=s.find(X=>X.id===z.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("COMMENT")&&"\u{1F4AC}",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",z.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:te?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:z.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.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(Ur,{cardId:e.id,attachments:i,onUpload:p?z=>p(e.id,z):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:je,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:M,disabled:O||!y,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||!v,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"]})]}),K.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),K.assignees.map((z,te)=>{let X=s.find(Me=>Me.id===z.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:z.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(z.confidence*100).toFixed(0),"%"]})]})]},te)})]}),K.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),K.subtasks.map((z,te)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:z.title}),z.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:z.description}),z.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",z.estimatedTime,"h"]})]},te))]}),K.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:[K.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(K.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),u.map(z=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${z.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:z.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:z.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:z.description}),z.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",z.suggestedAction]})]},z.id))]}),!K.assignees&&!K.subtasks&&!K.effort&&u.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 Vn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,u]=useState({top:0,left:0}),i=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,h=4,y=d.left;y+o>g-10&&(y=g-o-10),y<10&&(y=10);let v=p-d.bottom,f=d.top,x;return v>=s+h?x=d.bottom+h:f>=s+h?x=d.top-s-h:v>=f?x=d.bottom+h:x=Math.max(10,d.top-s-h),{top:x,left:y}},[e,o,s]);return useEffect(()=>{t&&u(c());},[t,c]),useEffect(()=>{if(!t)return;let d=g=>{let h=g.target;i.current&&!i.current.contains(h)&&e.current&&!e.current.contains(h)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(Bt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.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 nt={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 Wh=["LOW","MEDIUM","HIGH","URGENT"],Gh=["todo","in-progress","review","done"];function Rl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:u,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:h=[],availableLabels:y=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:x,unsplashAccessKey:k,theme:w,onSubtasksChange:T,attachments:C=[],onUploadAttachments:S,onDeleteAttachment:N}){let I=Qo(),O=w||I?.themeName||"dark",[A,K]=useState(e),[E,ce]=useState(false),[L,q]=useState(()=>[...e?.subtasks||[]].sort((B,H)=>(B.position??0)-(H.position??0))),[Ce,je]=useState(false),[M,V]=useState(""),[fe,We]=useState(""),[z,te]=useState("all"),[X,Me]=useState(false),[be,$e]=useState(false),[De,Xe]=useState(false),[Z,Je]=useState(false),[ue,Qe]=useState(false),[ct,wt]=useState(false),ye=useRef(null),ut=useRef(null),tt=useRef(null),qe=useRef(null),$=useRef(null),se=useRef(null),D=useRef(null),Y=useRef(null),ie=useRef(null),we=useRef(null),W=useRef(null),ee=useRef(null);useEffect(()=>{if(e&&!A){K({...e});let b=[...e.subtasks||[]].sort((B,H)=>(B.position??0)-(H.position??0));q(b);}else if(e&&A&&e.id!==A.id){K({...e});let b=[...e.subtasks||[]].sort((B,H)=>(B.position??0)-(H.position??0));q(b);}},[e,A]),useEffect(()=>{let b=B=>{let H=B.target;qe.current&&!qe.current.contains(H)&&Me(false),$.current&&!$.current.contains(H)&&$e(false),se.current&&!se.current.contains(H)&&Xe(false),D.current&&!D.current.contains(H)&&Je(false);};if(X||be||De||Z)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[X,be,De,Z]),useEffect(()=>{if(!t)return;let b=B=>{let H=B.target,_=H.tagName==="INPUT"||H.tagName==="TEXTAREA"||H.isContentEditable;if(B.key==="Escape"){B.preventDefault(),X||be||De||Z||ue||ct?(Me(false),$e(false),Xe(false),Je(false),Qe(false),wt(false)):_||a();return}if(_&&B.key!=="Escape")return;let ne=B.metaKey||B.ctrlKey;switch(B.key.toLowerCase()){case "s":B.preventDefault(),Me(true);break;case "a":B.preventDefault(),Xe(true);break;case "p":B.preventDefault(),$e(true);break;case "l":B.preventDefault(),Je(true);break;case "d":ne||(B.preventDefault(),Qe(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":ne||(B.preventDefault(),wt(true));break;case "i":B.preventDefault(),ce(true),setTimeout(()=>ut.current?.focus(),0);break;case "t":B.preventDefault(),je(true);break;case "c":B.preventDefault(),tt.current?.focus();break}};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t,a,X,be,De,Z,ue,ct]);let Le=useCallback(b=>{let B=b.currentTarget.textContent?.trim()||"";if(A&&B!==A.title){let H={...A,title:B};K(H),r?.(A.id,{title:B});}},[A,r]),Te=useCallback(b=>{b.key==="Enter"&&(b.preventDefault(),b.currentTarget.blur()),b.key==="Escape"&&(b.preventDefault(),b.currentTarget.textContent=A?.title||"",b.currentTarget.blur());},[A]),Be=useCallback(()=>{A&&e&&A.description!==e.description&&r?.(A.id,{description:A.description}),ce(false);},[A,e,r]),Ne=useCallback(b=>{if(A){let B={...A,columnId:b};K(B),r?.(A.id,{columnId:b}),Me(false);}},[A,r]),Ge=useCallback(b=>{if(A){let B={...A,priority:b};K(B),r?.(A.id,{priority:b}),$e(false);}},[A,r]),pt=useCallback(b=>{if(A){let B=A.assignedUserIds||[],H=B.includes(b)?B.filter(ne=>ne!==b):[...B,b],_={...A,assignedUserIds:H};K(_),r?.(A.id,{assignedUserIds:H});}},[A,r]),it=useCallback(b=>{if(A){let B=A.labels||[],H=B.includes(b)?B.filter(ne=>ne!==b):[...B,b],_={...A,labels:H};K(_),r?.(A.id,{labels:H});}},[A,r]),at=useCallback(b=>{if(A){let B={...A,tags:b};K(B),r?.(A.id,{tags:b});}},[A,r]),Ze=useCallback(b=>{if(A){let B=b.target.value,H={...A,endDate:B};K(H),r?.(A.id,{endDate:B}),Qe(false);}},[A,r]),At=useCallback(b=>{if(A){let B={...A,estimatedTime:parseFloat(b)||0};K(B),r?.(A.id,{estimatedTime:parseFloat(b)||0});}},[A,r]),Dt=useCallback(()=>{if(M.trim()&&A){let b={id:`subtask-${Date.now()}`,title:M.trim(),completed:false,position:L.length,createdAt:new Date},B=[...L,b];q(B),V(""),je(false),T?.(A.id,B);}},[M,L,A,T]),mt=useCallback(b=>{let B=L.map(H=>H.id===b?{...H,completed:!H.completed,updatedAt:new Date}:H);q(B),A&&T?.(A.id,B);},[L,A,T]),bt=useCallback(b=>{let B=L.filter(H=>H.id!==b);q(B),A&&T?.(A.id,B);},[L,A,T]),lt=useCallback(()=>{fe.trim()&&A&&u&&(u(A.id,fe.trim()),We(""));},[fe,A,u]),St=useCallback(b=>{(b.metaKey||b.ctrlKey)&&b.key==="Enter"&&(b.preventDefault(),lt());},[lt]),Re=b=>jsx(Hh,{remarkPlugins:[zh],rehypePlugins:[Uh],components:{a:({node:B,...H})=>jsx("a",{...H,target:"_blank",rel:"noopener noreferrer"})},children:b}),Ae=l.filter(b=>z==="comments"?b.type.includes("COMMENT"):z==="history"?!b.type.includes("COMMENT"):true);if(!t||!e)return null;let ot=A||e,ae=s.filter(b=>ot.assignedUserIds?.includes(b.id)),me=L.filter(b=>b.completed).length;return jsx(Bt,{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:b=>b.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:ye,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Le,onKeyDown:Te,children:ot.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:qe,children:[jsxs("button",{ref:ie,className:"modal-v2-field",onClick:()=>Me(!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:ot.columnId||"No status"})]}),jsx(Vn,{triggerRef:ie,isOpen:X,onClose:()=>Me(false),width:250,estimatedHeight:200,children:(h.length>0?h:Gh.map(b=>({id:b,title:b}))).map(b=>jsx("button",{className:`modal-v2-popover-item ${ot.columnId===b.id?"active":""}`,onClick:()=>Ne(b.id),children:b.title},b.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:se,children:[jsxs("button",{ref:we,className:"modal-v2-field",onClick:()=>Xe(!De),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:ae.length>0?jsx("div",{className:"modal-v2-avatars",children:ae.map(b=>jsx("div",{className:"modal-v2-avatar",style:{background:b.color},title:b.name,children:b.initials},b.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Vn,{triggerRef:we,isOpen:De,onClose:()=>Xe(false),width:280,estimatedHeight:300,children:s.map(b=>jsxs("button",{className:`modal-v2-popover-item ${ot.assignedUserIds?.includes(b.id)?"active":""}`,onClick:()=>pt(b.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:b.color},children:b.initials}),b.name,ot.assignedUserIds?.includes(b.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"})})]},b.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:$,children:[jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>$e(!be),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:ot.priority||"None"})]}),jsxs(Vn,{triggerRef:W,isOpen:be,onClose:()=>$e(false),width:180,estimatedHeight:220,children:[Wh.map(b=>jsx("button",{className:`modal-v2-popover-item priority-${b.toLowerCase()} ${ot.priority===b?"active":""}`,onClick:()=>Ge(b),children:b},b)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ge(""),children:"None"})]})]}),v.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:ot.tags||[],availableTags:v,onChange:at,onCreateTag:f,theme:nt[O]||nt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxs("button",{ref:ee,className:"modal-v2-field",onClick:()=>Je(!Z),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:ot.labels&&ot.labels.length>0?jsx("span",{children:ot.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Vn,{triggerRef:ee,isOpen:Z,onClose:()=>Je(false),width:220,estimatedHeight:200,children:(y.length>0?y:["Bug","Feature","Enhancement","Documentation"]).map(b=>jsxs("button",{className:`modal-v2-popover-item ${ot.labels?.includes(b)?"active":""}`,onClick:()=>it(b),children:[b,ot.labels?.includes(b)&&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"})})]},b))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{Qe(!ue),setTimeout(()=>Y.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:ot.endDate?new Date(ot.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Y,type:"date",value:typeof ot.endDate=="string"?ot.endDate.split("T")[0]:ot.endDate?(()=>{let b=new Date(ot.endDate),B=b.getUTCFullYear(),H=String(b.getUTCMonth()+1).padStart(2,"0"),_=String(b.getUTCDate()).padStart(2,"0");return `${B}-${H}-${_}`})():"",onChange:Ze,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>wt(!ct),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:ot.estimatedTime?`${ot.estimatedTime}h`:"Not set"})]}),ct&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ot.estimatedTime||"",onChange:b=>At(b.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>wt(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"})]}),E?jsx("textarea",{className:"modal-v2-textarea",value:ot.description||"",onChange:b=>{if(A){let B={...A,description:b.target.value};K(B);}},onBlur:Be,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>ce(true),children:ot.description?jsx("div",{className:"modal-v2-markdown",children:Re(ot.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"}),L.length>0&&jsxs("span",{className:"modal-v2-count",children:[me,"/",L.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>je(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:[L.map(b=>jsxs("div",{className:`modal-v2-subtask ${b.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>mt(b.id),children:b.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:b.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>bt(b.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"})]})})]},b.id)),Ce&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:M,onChange:b=>V(b.target.value),onKeyDown:b=>{b.key==="Enter"&&Dt(),b.key==="Escape"&&(je(false),V(""));},onBlur:Dt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(S||C.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"}),C.length>0&&jsx("span",{className:"modal-v2-count",children:C.length})]}),jsx(Ur,{cardId:ot.id,attachments:C,onUpload:S?b=>S(ot.id,b):void 0,onDelete:N,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 ${z==="all"?"active":""}`,onClick:()=>te("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>te("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>te("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:tt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:fe,onChange:b=>We(b.target.value),onKeyDown:St,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:lt,disabled:!fe.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Ae.map(b=>{let B=s.find(_=>_.id===b.userId);if(b.type.includes("COMMENT")){let _=n.find(ne=>ne.id===b.metadata?.commentId);return _?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[B&&jsx("div",{className:"modal-v2-avatar",style:{background:B.color},children:B.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:B?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(b.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:_.content})]})]},b.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[b.type.includes("CREATED")&&"\u2795",b.type.includes("UPDATED")&&"\u270F\uFE0F",b.type.includes("MOVED")&&"\u27A1\uFE0F",b.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",b.type.includes("ASSIGNED")&&"\u{1F464}",b.type.includes("PRIORITY")&&"\u{1F3AF}",b.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:B?.name||"Unknown"})," ",b.type.replace(/_/g," ").toLowerCase(),b.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:b.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(b.timestamp).toLocaleString()})]})]},b.id)}),Ae.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 $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((l,u)=>l+u.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,l)=>n+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.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,l)=>n+(l.planned||0),0)})]})]})]})}function iy({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,l=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=l;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(iy,{})}),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:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:u>=50?"#10B981":"#F59E0B"},children:[u.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var by={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},fp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function hy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:u,fill:"white",textAnchor:l>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((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||by[u.name]||fp[e.indexOf(u)%fp.length]})),l=n.map(u=>u.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?hy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(bp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${u} (${c.value} - ${d}%)`}})]}):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((u,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#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((u,i)=>i.value>u.value?i:u).name})]})]})]})}var js=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[u,i]=useState(false),[c,d]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let h=e.map(w=>w.id),y=w=>{r.onBulkUpdate?.(h,{priority:w}),l(false);},v=w=>{r.onBulkMove?.(h,w),i(false),a();},f=w=>{r.onBulkUpdate?.(h,{assignedUserIds:w}),d(false);},x=w=>{let T=new Set;e.forEach(S=>{S.labels?.forEach(N=>T.add(N));});let C=Array.from(new Set([...T,...w]));r.onBulkUpdate?.(h,{labels:C}),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:()=>l(!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(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w),children:[jsx("span",{className:m("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([w]),children:w},w))})]}),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 ky(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,u,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(g=>{let h=a?.find(y=>y.id===g);n=`assignee-${g}`,l=h?.name||`User ${g}`,u=h?.color,i=h?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=p.title,u=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u}),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),l=useMemo(()=>ky(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(po,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:m("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),p={...e,cards:d};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&&u(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.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:p,callbacks:r,availableUsers:a})})]},i.id)}),l.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 Gl({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=Wl.find(i=>i.value===e)||Wl[0];useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxs("div",{className:m("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:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:m("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(i=>jsxs("button",{onClick:()=>u(i.value),className:m("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.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 Ny(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&l&&u}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(u=>{o.current=[...o.current,u];},[]),l=useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return useEffect(()=>{function u(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Ny(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Sy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ey(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 Fy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ey(e),r=t?Sy(t):"";return a?`${a} + ${r}`:r}function My(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 l(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=My(e);return jsxs("div",{className:m("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(([l,u])=>u.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"}),l]}),jsx("div",{className:"space-y-3",children:u.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Fy(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var _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,7 +122,7 @@ 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 jl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},u=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxs("div",{className:m("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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:m("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(u).map(([i,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:i})}),jsx("div",{children:c.map(d=>jsxs("button",{onClick:()=>l(d),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Yl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[u,i]=useState("json"),[c,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let y=o?.current||void 0,v=await jc(e,u,y);Kc(v,u);},h=async y=>{let v=y.target.files?.[0];if(v){try{let f=await Xc(v),x=v.name.endsWith(".json")?"json":"csv",k=qc(f,x);d(k),k.success&&r&&r(k,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:m("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:m("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:()=>l("import"),className:m("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(y=>jsxs("button",{onClick:()=>i(y),className:m("p-4 rounded-lg border-2 transition-all text-center",u===y?"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:[y==="json"&&"\u{1F4C4}",y==="csv"&&"\u{1F4CA}",y==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:y})]},y))})]}),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:p,type:"file",accept:".json,.csv",onChange:h,className:"hidden"}),jsxs("button",{onClick:()=>p.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:m("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:m("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((y,v)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",y]},v))})]})]})]})]})]})}var By=["URGENT","HIGH","MEDIUM","LOW"],Ry=[{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"}],Oy=[{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:l,availableUsers:u=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:h}){let[y,v]=useState(true),f=useCallback(C=>{a({search:C.target.value});},[a]),x=useCallback(C=>{a({dateFilter:C.target.value});},[a]),k=useCallback(C=>{r({by:C.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=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 ${p?"filter-bar--compact":""} ${y?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>v(!y),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:y?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:y?"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"}),T&&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)"]})]}),!y&&jsxs("div",{className:"filter-bar__content",children:[d&&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"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange: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:C=>{let S=C.target.value;a({priorities:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),By.map(C=>jsx("option",{value:C,children:C},C))]})}),u.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let S=C.target.value;a({assignees:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),u.map(C=>jsx("option",{value:C.id,children:C.name},C.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let S=C.target.value;a({labels:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(C=>jsx("option",{value:C,children:C},C))]})}),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:Ry.map(C=>jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),h&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:C=>h(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Oy.map(C=>jsx("option",{value:C.value,children:C.label},C.value))})}),T&&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:l,onExportGanttCSV:u}){let[i,c]=useState(false),d=useRef(null);useEffect(()=>{let g=h=>{d.current&&!d.current.contains(h.target)&&c(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let p=g=>{g(),c(false);};return jsxs("div",{className:m("relative",r),ref:d,children:[jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>p(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:()=>p(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:()=>p(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:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>p(()=>u?.()),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:()=>p(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:()=>p(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),Ky="asakaa-theme";function Tp({children:e,defaultTheme:t=Ys,storageKey:a=Ky}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,u=Bo[r];Object.entries(u.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${Yy(c)}`,d);}),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,d])=>{let p=u.colors[c];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.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 Yy(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:m("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:m("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 nt[e]||nt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",nt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",nt[e].bgSecondary),bgGrid:r("--theme-bg-card",nt[e].bgGrid),bgWeekend:r("--theme-bg-hover",nt[e].bgWeekend),border:r("--theme-border-primary",nt[e].border),borderLight:r("--theme-border-subtle",nt[e].borderLight),textPrimary:r("--theme-text-primary",nt[e].textPrimary),textSecondary:r("--theme-text-secondary",nt[e].textSecondary),textTertiary:r("--theme-text-tertiary",nt[e].textTertiary),accent:r("--theme-accent-primary",nt[e].accent),accentHover:r("--theme-accent-hover",nt[e].accentHover),accentLight:r("--theme-accent-primary",nt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",nt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",nt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",nt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",nt[e].dependency),dependencyHover:r("--theme-border-secondary",nt[e].dependencyHover),criticalPath:r("--theme-error",nt[e].criticalPath),criticalPathLight:r("--theme-error",nt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",nt[e].today):e==="neutral"?r("--theme-text-primary",nt[e].today):r("--theme-error",nt[e].today),todayLight:e==="light"?r("--theme-accent-primary",nt[e].todayLight):e==="neutral"?r("--theme-text-primary",nt[e].todayLight):r("--theme-error",nt[e].todayLight),milestone:r("--theme-warning",nt[e].milestone),milestoneLight:r("--theme-warning",nt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",nt[e].statusTodo),statusInProgress:r("--theme-accent-primary",nt[e].statusInProgress),statusCompleted:r("--theme-success",nt[e].statusCompleted),hoverBg:r("--theme-bg-hover",nt[e].hoverBg),focusRing:r("--theme-accent-primary",nt[e].focusRing),...nt[e].dotGrid&&{dotGrid:nt[e].dotGrid},...nt[e].glassHeader&&{glassHeader:nt[e].glassHeader},...nt[e].glassToolbar&&{glassToolbar:nt[e].glassToolbar},...nt[e].forecastHud&&{forecastHud:nt[e].forecastHud},...nt[e].neonRedGlow&&{neonRedGlow:nt[e].neonRedGlow},...nt[e].executionBarBg&&{executionBarBg:nt[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(),l=n.bottom+4,u;a==="right"?u=n.right-r:u=n.left;let i=8;u+r>window.innerWidth-i&&(u=window.innerWidth-i-r),u<i&&(u=i),s({top:l,left:u});},[t,a,e,r]),o}function Fp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=useState(false),[u,i]=useState(null),[c,d]=useState(false),p=useRef(null),g=useRef(null),h=Er(),y=Zs(p,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=h.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let T=C=>{let S=C.target;p.current&&!p.current.contains(S)&&g.current&&!g.current.contains(S)&&l(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[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(T=>T.handler),k=async(T,C)=>{if(C){i(T);try{await C();}catch(S){console.error(`Export ${T} failed:`,S);}finally{i(null),l(false);}}},w=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>l(!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:y.top,left:y.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:x.map((T,C)=>jsxs(motion.button,{onClick:()=>k(T.id,T.handler),disabled:u!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"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("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:u===T.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"})}):T.icon}),jsx("span",{className:"flex-1 text-left",children:T.label})]},T.id))})]}),x.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"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:v?"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:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"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 vx({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 wx({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 Mp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),l=useRef(null),u=Er(),i=Zs(n,o,"left");useEffect(()=>{if(!o)return;let p=g=>{let h=g.target;n.current&&!n.current.contains(h)&&l.current&&!l.current.contains(h)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let c=[{value:"all",label:u.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?u.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:`${u.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:c.map((p,g)=>{let h=t===p.value;return jsxs(motion.button,{onClick:()=>{a(p.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:p.label}),h&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function Pp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),u=useRef(null),i=Er(),c=Zs(l,s,"left");useEffect(()=>{if(!s)return;let h=setTimeout(()=>{let y=f=>{let x=f.target;l.current&&!l.current.contains(x)&&u.current&&!u.current.contains(x)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",y),document.addEventListener("keydown",v),u._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(h),u._cleanup&&u._cleanup();}},[s]);let d=[{value:"all",label:i.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:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:h=>{h.stopPropagation(),n(y=>!y);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#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:i.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:u,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:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(h=>{let y=t===h.value&&!r,v=()=>h.value==="all"?y?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:y?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:`${y?h.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:h.label}),y&&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:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function kx({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 l=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:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?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 Cx({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,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,u=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,c=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,p=t?.currency||"$",g=d!=null?d>=1e6?`${p}${(d/1e6).toFixed(2)}M`:d>=1e3?`${p}${(d/1e3).toFixed(1)}K`:`${p}${d.toFixed(0)}`:"\u2014",h=t?.budgetVariancePercent,y=h!=null&&h!==0,v=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&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:u.bg,color:u.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:c,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),y&&v&&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:v})]})]})]})}function Tx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:u,rowDensity:i,onRowDensityChange:c,hasDependencies:d=true}){let[p,g]=useState(false),h=useRef(null),y=useRef(null),v=Er(),f=Zs(h,p,"right",208),x=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let C=S=>{let N=S.target;h.current&&!h.current.contains(N)&&y.current&&!y.current.contains(N)&&g(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]);let k=v.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:k?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:k?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:k?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:k?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:k?"Dependencias":"Dependencies",icon:GitBranch,active:l,onChange:u}],T=[{value:"compact",label:v.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:v.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:h,onClick:()=>g(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:v.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:y,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:f.top,left:f.left,zIndex:99999,backgroundColor:x?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${x?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:x?"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:x?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((C,S)=>{let N=C.icon,I=C.disabled,O=C.tooltip;return jsxs(motion.button,{onClick:()=>!I&&C.onChange?.(!C.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:I?x?"rgba(255,255,255,0.3)":"#9CA3AF":x?"rgba(255,255,255,0.85)":"#111827",cursor:I?"not-allowed":"pointer"},whileHover:I?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:S*.03},title:O,children:[jsx(N,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:I?x?"rgba(255,255,255,0.2)":"#D1D5DB":C.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:C.label}),C.active&&!I&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:x?"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:x?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),T.map((C,S)=>{let N=i===C.value;return jsxs(motion.button,{onClick:()=>c(C.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:x?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+S)*.03},children:[jsx("span",{style:{color:N?e.accent||"#2E94FF":x?"rgba(255,255,255,0.85)":e.textPrimary},children:C.label}),N&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.value)})]})]})}),document.body)]})}function ei({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:h,hideCompleted:y=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:x,onWbsLevelChange:k,maxWbsDepth:w=4,viewMode:T="execution",onViewModeChange:C,projectForecast:S,onExportPNG:N,onExportPDF:I,onExportExcel:O,onExportCSV:A,onExportJSON:K,onExportMSProject:E,showCriticalPath:ce=true,onShowCriticalPathChange:L,showDependencies:q=true,onShowDependenciesChange:Ce,highlightWeekends:je=true,onHighlightWeekendsChange:M,showBaseline:V=false,onShowBaselineChange:fe,onCopySnapshotLink:We,hasDependencies:z=true}){let te=Er(),X=N||I||O||A||K||E,Me=!!e.glassToolbar,[be,$e]=useState(false),De=useRef(null);useEffect(()=>{be&&De.current&&De.current.focus();},[be]);let Xe=[{value:"day",label:te.toolbar.day},{value:"week",label:te.toolbar.week},{value:"month",label:te.toolbar.month}],Z=[{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"})}],Je=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Me){let ue=Je?"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:Je?"#1A1A1A":e.bgSecondary,border:`1px solid ${Je?"rgba(255,255,255,0.08)":e.border}`},animate:{width:be?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>$e(!be),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"})}),be&&jsx("input",{ref:De,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:()=>$e(false),onKeyDown:Qe=>{Qe.key==="Escape"&&$e(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),C&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Je?"#000000":e.bgSecondary,border:`1px solid ${Je?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="execution"?Je?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:T==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="execution"?{color:e.textSecondary}:{},children:te.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="oracle"?Je?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:T==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="oracle"?{color:e.textSecondary}:{},children:te.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(kx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),k&&jsx(Mp,{theme:e,value:x??"all",onChange:k,maxDepth:w}),h&&jsx(Pp,{theme:e,value:g,onChange:h,hideCompleted:y,onHideCompletedChange:v}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),jsx(Tx,{theme:e,showCriticalPath:ce,onShowCriticalPathChange:L,showBaseline:V,onShowBaselineChange:fe,highlightWeekends:je,onHighlightWeekendsChange:M,showDependencies:q,onShowDependenciesChange:Ce,rowDensity:l,onRowDensityChange:u,hasDependencies:z}),jsx(Fp,{theme:e,onExportPNG:N,onExportPDF:I,onExportExcel:O,onExportMSProject:E,onCopySnapshotLink:We}),c&&p&&jsxs(motion.button,{onClick:p,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 ${Je?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Je?"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:d||te.toolbar.createTask})]})]})]}),S&&jsx(Cx,{theme:e,forecast:S})]})}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(wx,{options:Xe,value:t,onChange:ue=>a(ue),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(Mp,{theme:e,value:x??"all",onChange:k,maxDepth:w}),h&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Pp,{theme:e,value:g,onChange:h,hideCompleted:y,onHideCompletedChange:v})]})]}),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&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,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:d||te.toolbar.createTask})]}),(X||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Fp,{theme:e,onExportPNG:N,onExportPDF:I,onExportExcel:O,onExportMSProject:E,onCopySnapshotLink:We}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(vx,{options:Z,value:s,onChange:ue=>n(ue),theme:e})]})]})}function ti({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),u=useRef(null);useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let c=u.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(Bt,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(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:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.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),[l,u]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,p=8,g=window.innerWidth,h=window.innerHeight,y=t,v=a;t+c+p>g&&(y=t-c,y<p&&(y=p)),a+d+p>h&&(v=h-d-p,v<p&&(v=p)),u({x:y,y:v});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=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:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(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:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.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 Kt={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:l,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:p=true}){let g=useRef(false),h=useCallback(k=>{g.current=k;},[]),y=useCallback(k=>{let w=[],T=C=>{for(let S of C)w.push(S),S.subtasks&&S.subtasks.length>0&&S.isExpanded&&T(S.subtasks);};return T(k),w},[]),v=useCallback(()=>{let k=y(e);for(let w of k)if(t.has(w.id))return w;return null},[e,t,y]),f=useCallback((k,w)=>{let T=y(e);if(T.length===0)return;let C=v();if(!C){a(T[0].id,false);return}let S=T.findIndex(O=>O.id===C.id);if(S===-1)return;let N=k==="up"?S-1:S+1;if(N<0||N>=T.length)return;let I=T[N];a(I.id,w);},[e,v,y,a]),x=useCallback(k=>{if(!p)return;let w=k.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||g.current){k.key==="Escape"&&(w.blur(),g.current=false);return}let S=navigator.platform.toUpperCase().indexOf("MAC")>=0?k.metaKey:k.ctrlKey,N=Array.from(t),I=v();if(k.key==="ArrowUp"){k.preventDefault(),f("up",k.shiftKey);return}if(k.key==="ArrowDown"){k.preventDefault(),f("down",k.shiftKey);return}if(I&&(k.key==="ArrowRight"||k.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(k.preventDefault(),(k.key==="ArrowRight"&&!I.isExpanded||k.key==="ArrowLeft"&&I.isExpanded)&&c(I.id));return}if(k.altKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){N.length>0&&(k.preventDefault(),n(N,k.key==="ArrowUp"?"up":"down"));return}if(k.key==="Tab"&&!k.shiftKey){N.length>0&&(k.preventDefault(),l(N));return}if(k.key==="Tab"&&k.shiftKey){N.length>0&&(k.preventDefault(),u(N));return}if(k.key==="Enter"&&!k.shiftKey&&!S){I&&(k.preventDefault(),r(I.id,"below"));return}if(k.key==="Enter"&&k.shiftKey&&!S){I&&(k.preventDefault(),r(I.id,"above"));return}if(k.key==="Enter"&&S){I&&(k.preventDefault(),d(I.id));return}if(k.key==="F2"){I&&(k.preventDefault(),i(I.id));return}if(k.key==="Delete"||k.key==="Backspace"&&S){N.length>0&&(k.preventDefault(),o(N));return}if(k.key==="d"&&S&&!k.shiftKey){N.length>0&&(k.preventDefault(),s(N));return}},[p,t,v,f,r,o,s,n,l,u,i,c,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x);}},[p,x]),{setIsEditing:h}}function Up(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(p=>{let g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let g=p.indexOf(a),h=p.indexOf(d);if(g===-1||h===-1){o(d);return}let y=Math.min(g,h),v=Math.max(g,h),f=p.slice(y,v+1);t(new Set(f)),r(d);},[a,o]),l=useCallback((d,p,g,h)=>{h?n(d,p):g?s(d):o(d);},[o,s,n]),u=useCallback((d,p)=>{p?t(g=>{let h=new Set(g);return h.add(d),h}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:u,clearSelection:i,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((l,u)=>(l.position??0)-(u.position??0));for(let l=0;l<n.length;l++){let u={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(u),u.subtasks&&u.subtasks.length>0&&u.isExpanded&&a(u.subtasks,u.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(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,g)=>{let h=[];return {tasks:p.filter(v=>{if(g.has(v.id))return h.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,h.push(...f.removed);}return true}),removed:h}},l=(p,g,h)=>p.map(y=>y.id===g?{...y,subtasks:[...y.subtasks||[],...h],isExpanded:true}:y.subtasks?{...y,subtasks:l(y.subtasks,g,h)}:y),u=new Set(t),{tasks:i,removed:c}=n(e,u),d=l(i,s.id,c);return nd(d)}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=(i,c,d)=>{for(let p=0;p<i.length;p++){let g=i[p];if(g.id===c&&g.subtasks){let h=g.subtasks.findIndex(y=>y.id===d);if(h!==-1){let[y]=g.subtasks.splice(h,1);return y}}if(g.subtasks){let h=n(g.subtasks,c,d);if(h)return h}}return null},l=(i,c,d)=>{let p=i.findIndex(g=>g.id===c);if(p!==-1)return i.splice(p+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,c,d);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?l(s.subtasks,o.id,u):l(a,o.id,u));}return nd(a)}function ld(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,u)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,u))return true;return false}let c=u==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],n[i]={...n[i],position:i},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=(u,i)=>u.map((c,d)=>({...c,id:`${c.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${d}`):void 0})),n=u=>{let i=u.findIndex(g=>g.id===o);if(i===-1){for(let g of u)if(g.subtasks){let h=n(g.subtasks);if(h)return h}return null}let c=u[i],d=`${c.id}-copy-${Date.now()}`,p={...c,id:d,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,d):void 0};return u.splice(i+1,0,p),p},l=n(a);l&&r.push(l);}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"},l=u=>{let i=u.findIndex(d=>d.id===t);if(i===-1){for(let d of u)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return u.splice(c,0,n),true};return l(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=p=>{for(let g of p){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,l=r?.endDate||s,u=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let h=u(g.subtasks);if(h>=0)return h}}return 0},i=u(e),c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=p=>p.map(g=>{if(g.id===t){let h=g.subtasks||[];return {...g,subtasks:[...h,c],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:c}}function Gp(e,t,a,r){if(t===a)return e;let o=ai(e,t);if(!o)return e;if(a){let l=(u,i)=>{if(!u.subtasks)return false;for(let c of u.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>{let u=l.filter(c=>c.id!==t),i=u.length<l.length;return u.map((c,d)=>{let p=i?{...c,position:d}:c;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((u,i)=>({...u,position:i}));}else {let l=u=>u.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,p=[...c];p.splice(d,0,{...o,parentId:a});let g=p.map((h,y)=>({...h,position:y}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(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((l,u)=>(u.startDate&&l.starts.push(new Date(u.startDate).getTime()),u.endDate&&l.ends.push(new Date(u.endDate).getTime()),l.progresses.push(u.progress??0),l),{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((l,u)=>l+u,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:l,onTaskToggle:u,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:h,onTaskOutdent:y,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:x,onTaskCreate:k,onTaskRename:w,onCreateSubtask:T,onOpenTaskModal:C,onDeleteRequest:S,onTaskReparent:N,scrollContainerRef:I,showCriticalPath:O=false}){let A=useContext(un),[K,E]=useState(null),[ce,L]=useState(null),[q,Ce]=useState(""),je=useRef(null),[M,V]=useState(null),[fe,We]=useState(0),[z,te]=useState(0),[X,Me]=useState({isOpen:false,x:0,y:0,type:"header"}),[be,$e]=useState(null),[De,Xe]=useState(null),[Z,Je]=useState(null),ue=useRef(0),Qe=5,ct=useRef(false),[wt,ye]=useState(null),[ut,tt]=useState(false),qe=useRef(null),[$,se]=useState(null),[D,Y]=useState(false),ie=useRef(null);useEffect(()=>{function ae(ge){ie.current&&!ie.current.contains(ge.target)&&Y(false);}if(D)return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[D]),useEffect(()=>{ce&&je.current&&(je.current.focus(),je.current.select());},[ce]),useEffect(()=>{if(!M)return;let ae=b=>{let B=b.clientX-fe,H=z+B;p?.(M,H);},ge=()=>{V(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ae),document.addEventListener("mouseup",ge),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",ge),document.body.style.cursor="",document.body.style.userSelect="";}},[M,fe,z,p]);let{selectedTaskIds:we,handleTaskClick:W,isTaskSelected:ee}=Up(),{setIsEditing:Le}=Hp({tasks:e,selectedTaskIds:we,onTaskSelect:(ae,ge)=>{let B=fn(e).map(H=>H.id);W(ae,B,ge||false,false);},onTaskCreate:k||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:x||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:h||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:ae=>{let ge=fn(e).find(b=>b.id===ae);ge&&it(ge);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:ae=>{let ge=fn(e).find(b=>b.id===ae);ge&&C&&C(ge);},enableKeyboard:true}),Te=(ae,ge=0,b="")=>{let B=[],H=[...ae].sort((_,ne)=>(_.position??0)-(ne.position??0));for(let _=0;_<H.length;_++){let ne=H[_],he=_+1,J=b?`${b}.${he}`:`${he}.0`;if(ne.wbsCode=J,B.push({task:ne,level:ge}),ne.subtasks&&ne.subtasks.length>0&&ne.isExpanded){let de=b?`${b}.${he}`:`${he}`;B.push(...Te(ne.subtasks,ge+1,de));}}return B},Be=Te(e),Ne=48,Ge=Math.max(Be.length*a,600-Ne),pt=ae=>!ae.startDate||!ae.endDate?"-":`${Math.ceil((ae.endDate.getTime()-ae.startDate.getTime())/(1e3*60*60*24))}d`,it=ae=>{L(ae.id),Ce(ae.name),Le(true);},at=ae=>{q.trim()&&q!==e.find(ge=>ge.id===ae)?.name&&w?.(ae,q.trim()),L(null),Ce(""),Le(false);},Ze=()=>{L(null),Ce(""),Le(false);},At=(ae,ge)=>{ge.stopPropagation(),T?.(ae.id);},Dt=(ae,ge)=>{ge.preventDefault(),ue.current=ge.clientY,$e(ae),ct.current=false,tt(false),ye({x:ge.clientX,y:ge.clientY});},mt=ae=>{if(!be||(Math.abs(ae.clientY-ue.current)>Qe&&!ct.current&&(ct.current=true,tt(true)),ye({x:ae.clientX,y:ae.clientY}),!ct.current))return;if(I?.current){let _=I.current,ne=_.getBoundingClientRect(),he=60,J=12;qe.current&&(cancelAnimationFrame(qe.current),qe.current=null);let de=ae.clientY-ne.top,_e=ne.bottom-ae.clientY;if(de<he&&_.scrollTop>0){let Ke=Math.round(J*(1-de/he)),gt=()=>{_.scrollTop-=Ke,ct.current&&_.scrollTop>0&&(qe.current=requestAnimationFrame(gt));};qe.current=requestAnimationFrame(gt);}else if(_e<he&&_.scrollTop<_.scrollHeight-_.clientHeight){let Ke=Math.round(J*(1-_e/he)),gt=()=>{_.scrollTop+=Ke,ct.current&&_.scrollTop<_.scrollHeight-_.clientHeight&&(qe.current=requestAnimationFrame(gt));};qe.current=requestAnimationFrame(gt);}}let b=document.querySelectorAll("[data-task-row]"),B=null,H=null;b.forEach(_=>{let ne=_.getBoundingClientRect(),he=_.getAttribute("data-task-row");if(he&&he!==be&&ae.clientY>=ne.top&&ae.clientY<=ne.bottom){B=he;let J=ae.clientY-ne.top,de=ne.height;J<de*.25?H="above":J>de*.75?H="below":H="child";}}),Xe(B),Je(H);},bt=()=>{if(ct.current&&be&&De&&Z){if(Z==="child")N?.(be,De);else if(Z==="above"||Z==="below"){let ae=(H,_,ne=null)=>{for(let he of H){if(he.id===_)return ne;if(he.subtasks){let J=ae(he.subtasks,_,he.id);if(J!==void 0)return J}}},ge=ae(e,be,null),b=ae(e,De,null),B=(H,_,ne,he)=>{let J=H.findIndex(Ke=>Ke.id===_),de=he?H.findIndex(Ke=>Ke.id===ne):-1,_e=Z==="below"?J+1:J;return he&&de!==-1&&de<J&&(_e-=1),Math.max(0,_e)};if(b===null){let _=B(e,De,be,ge===null);N?.(be,null,_);}else {let H=Be.find(_=>_.task.id===b)?.task;if(H?.subtasks){let _=ge===b,ne=B(H.subtasks,De,be,_);N?.(be,b,ne);}}}}qe.current&&(cancelAnimationFrame(qe.current),qe.current=null),$e(null),Xe(null),Je(null),ye(null),ct.current=false,tt(false);};useEffect(()=>{if(be)return document.addEventListener("mousemove",mt),document.addEventListener("mouseup",bt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",mt),document.removeEventListener("mouseup",bt),document.body.style.cursor="",document.body.style.userSelect="";}},[be,De,Z]);let lt=(ae,ge,b)=>{let B=ge.subtasks&&ge.subtasks.length>0;switch(ae.id){case "name":let H=ce===ge.id,_=K===ge.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${b*20}px`},children:[N&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:_?1:.3},onMouseDown:U=>Dt(ge.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ge.subtasks&&ge.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),u?.(ge.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ge.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"}),H?jsx("input",{ref:je,type:"text",value:q,onChange:U=>Ce(U.target.value),onKeyDown:U=>{U.key==="Enter"?at(ge.id):U.key==="Escape"&&Ze();},onBlur:()=>at(ge.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:U=>U.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:ge.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ge.parentId?"13px":"14px",fontWeight:ge.isMilestone?600:ge.parentId?400:600,letterSpacing:ge.parentId?"0":"-0.01em"},title:ge.name,children:[ge.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ge.wbsCode}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ge.name}),ge.subtasks&&ge.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(ge.progress||0),"%"]}),O&&ge.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),O&&ge.cpmData&&jsxs("span",{style:{color:ge.cpmData.totalFloat<=0?"#EF4444":ge.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ge.cpmData.totalFloat),"d"]})]}),_&&!H&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>At(ge,U),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:U=>{U.stopPropagation(),it(ge);},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 he=ae.id==="startDate"?"startDate":"endDate",J=ge[he],de=$?.taskId===ge.id&&$?.field===he,_e=U=>U?(typeof U=="string"?new Date(U):U).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:U=>U.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:B?.5:1,cursor:B?"default":"pointer"},title:B?"Auto-calculated from subtasks":void 0,onClick:U=>{if(!B)if(de)se(null);else {let oe=U.currentTarget.getBoundingClientRect();se({taskId:ge.id,field:he,month:J?typeof J=="string"?new Date(J):J:new Date,position:{top:oe.bottom+4,left:oe.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:_e(J)}),B&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),de&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>se(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:$?.position.top,left:$?.position.left},onClick:U=>U.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let U=new Date,oe=new Date(U);oe.setDate(U.getDate()+1);let Oe=new Date(U);Oe.setDate(U.getDate()+7);let P=new Date(U);return P.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:oe},{label:"Pr\xF3xima semana",date:Oe},{label:"2 semanas",date:P}].map((He,Ye)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:qt=>qt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:qt=>qt.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ge.id,{[he]:He.date}),se(null);},children:He.label},Ye))})(),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:U=>U.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ge.id,{[he]:void 0}),se(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:()=>se(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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:$?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>se(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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((U,oe)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},oe))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=$?.month||new Date,oe=U.getFullYear(),Oe=U.getMonth(),P=new Date(oe,Oe,1).getDay(),me=new Date(oe,Oe+1,0).getDate(),He=new Date,Ye=[];for(let Lt=P-1;Lt>=0;Lt--)Ye.push({day:new Date(oe,Oe,-Lt).getDate(),date:new Date(oe,Oe-1,new Date(oe,Oe,-Lt).getDate()),isCurrentMonth:false});for(let Lt=1;Lt<=me;Lt++)Ye.push({day:Lt,date:new Date(oe,Oe,Lt),isCurrentMonth:true});let qt=42-Ye.length;for(let Lt=1;Lt<=qt;Lt++)Ye.push({day:Lt,date:new Date(oe,Oe+1,Lt),isCurrentMonth:false});return Ye.map((Lt,Da)=>{let Ba=Lt.date.toDateString()===He.toDateString(),fa=(J?typeof J=="string"?new Date(J):J:null)?.toDateString()===Lt.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:Lt.isCurrentMonth?fa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:fa?"#2E94FF":"transparent",boxShadow:Ba&&!fa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(ge.id,{[he]:Lt.date}),se(null);},children:Lt.day},Da)})})()})]})]})]}),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:pt(ge)})});case "assignees":if(B)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 Ke=r.filter(U=>ge.assignees?.some(oe=>oe.name===U.name||oe.initials===U.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Fo,{assignedUsers:Ke,availableUsers:r,onChange:U=>{let oe=U.map(Oe=>({id:Oe.id,name:Oe.name,initials:Oe.initials,color:Oe.color}));g?.(ge.id,{assignees:oe.length>0?oe:void 0});}})});case "status":if(B){let U=ge.progress===100?"\u2713":ge.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:U})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(fu,{status:ge.status||"todo",onChange:U=>{g?.(ge.id,{status:U,progress:U==="completed"?100:ge.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:B?.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:`${ge.progress}%`,backgroundColor:ge.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:[ge.progress,"%"]})]});case "priority":let gt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ot={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ht=gt[ge.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(So,{priority:Ht,onChange:U=>{U&&g?.(ge.id,{priority:Ot[U]||"medium"});}})});default:return null}},St=ae=>[{id:"hide",label:"Hide Column",icon:Kt.Hide,onClick:()=>d(ae),disabled:ae==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Kt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Kt.SortDesc,onClick:()=>{}}],Re=ae=>ae.subtasks&&ae.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{T?.(ae.id);}},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{x?.([ae.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{S?S(ae.id,ae.name):f?.([ae.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Kt.Pencil,onClick:()=>{n?.(ae);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{T?.(ae.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Kt.MarkIncomplete,onClick:()=>{g?.(ae.id,{status:"todo",progress:0});},disabled:ae.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Kt.SetInProgress,onClick:()=>{g?.(ae.id,{status:"in-progress"});},disabled:ae.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Kt.MarkComplete,onClick:()=>{g?.(ae.id,{status:"completed",progress:100});},disabled:ae.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{x?.([ae.id]);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Kt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{S?S(ae.id,ae.name):f?.([ae.id]);}}],Ae=c.filter(ae=>ae.visible),ot=Ae.reduce((ae,ge)=>ae+ge.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ot},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ne}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ae.map((ae,ge)=>{let b=ge===Ae.length-1,B=ae.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${B?"":"justify-center"}`,style:{width:`${ae.width}px`,minWidth:`${ae.minWidth??(B?200:60)}px`,maxWidth:`${ae.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:b?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:H=>{H.preventDefault(),Me({isOpen:true,x:H.clientX,y:H.clientY,type:"header",columnId:ae.id});},onMouseEnter:H=>{H.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:H=>{H.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:ae.label,children:ae.label}),ae.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:M===ae.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:H=>{H.preventDefault(),H.stopPropagation(),V(ae.id),We(H.clientX),te(ae.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"}})})]},ae.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:d,theme:t}),jsx("button",{onClick:()=>Y(!D),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"})}),D&&jsxs("div",{ref:ie,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:ae=>ae.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:()=>Y(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:Ge},children:Be.map(({task:ae,level:ge},b)=>{let B=ee(ae.id),H=De===ae.id,_=H&&Z==="above",ne=H&&Z==="below",he=H&&Z==="child",J={};return he&&(J.backgroundColor=`${t.accent}15`,J.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":ae.id,className:`flex items-center cursor-pointer group ${be===ae.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:B?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:B?t.accentLight:he?`${t.accent}15`:b%2===0?t.bgPrimary:t.bgGrid,opacity:O?ae.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...J},onMouseEnter:()=>E(ae.id),onMouseLeave:()=>E(null),onClick:de=>{let Ke=fn(e).map(Ht=>Ht.id),Ot=navigator.platform.toUpperCase().indexOf("MAC")>=0?de.metaKey:de.ctrlKey;W(ae.id,Ke,Ot,de.shiftKey),s?.(ae);},onDoubleClick:de=>{de.stopPropagation(),n?.(ae);},onContextMenu:de=>{de.preventDefault(),Me({isOpen:true,x:de.clientX,y:de.clientY,type:"task",task:ae}),l?.(ae,de);},whileHover:{backgroundColor:B?t.accentLight:t.hoverBg},children:[_&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ne&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ae.map((de,_e)=>{let Ke=_e===Ae.length-1,gt=de.id==="name";return jsx("div",{className:`px-4 flex items-center ${gt?"justify-start":"justify-center"}`,style:{width:`${de.width}px`,minWidth:`${de.minWidth??(gt?200:60)}px`,maxWidth:`${de.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ke?"none":`1px solid ${K===ae.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:lt(de,ae,gt?ge:0)},`${ae.id}-${de.id}`)})]},ae.id)})}),jsx(gn,{isOpen:X.isOpen,x:X.x,y:X.y,items:X.type==="header"&&X.columnId?St(X.columnId):X.type==="task"&&X.task?Re(X.task):[],onClose:()=>Me({...X,isOpen:false}),theme:t}),ut&&wt&&be&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:wt.x+12,top:wt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ae=Be.find(ge=>ge.task.id===be)?.task;return ae?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:ae.name})}):null})()}),document.body)]})}function Yp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[u,i]=useState(t),[c,d]=useState(null),[p,g]=useState(null),[h,y]=useState(null),[v,f]=useState(null),[x,k]=useState(0),[w,T]=useState(0),[C,S]=useState(null),[N,I]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:u,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:h,setActiveZone:y,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:x,setDraggedSegmentStartX:k,segmentDragOffsetX:w,setSegmentDragOffsetX:T,hoveredSegmentIndex:C,setHoveredSegmentIndex:S,isHovered:N,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ce,L)=>{r("none"),d(null),g(null),l(ce),i(L),T(0),f(null),k(0);}}}function ii({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:u,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:h,onHoverChange:y,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:x=true,readOnly:k=false}){let w=Yp(t,r),T=useRef(null),C=useRef(false),S=useRef(null),N=useRef(null),{dragMode:I,setDragMode:O,dragOffset:A,setDragOffset:K,ghostX:E,setGhostX:ce,ghostWidth:L,setGhostWidth:q,connectionLine:Ce,setConnectionLine:je,hoveredTaskId:M,setHoveredTaskId:V,activeZone:fe,setActiveZone:We,draggedSegmentIndex:z,setDraggedSegmentIndex:te,draggedSegmentStartX:X,setDraggedSegmentStartX:Me,segmentDragOffsetX:be,setSegmentDragOffsetX:$e,hoveredSegmentIndex:De,setHoveredSegmentIndex:Xe,isHovered:Z,setIsHovered:Je,isDragging:ue,isResizing:Qe,isConnecting:ct,resetDragState:wt}=w,ye=18,ut=!!o.executionBarBg,tt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",qe=ut?3:6,$=e.subtasks&&e.subtasks.length>0,se=e.endDate&&(()=>{let b=new Date;b.setHours(0,0,0,0);let B=new Date(e.endDate);return B.setHours(0,0,0,0),B<b})()&&e.progress<100,D=x&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,we={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=x&&e.isCriticalPath||se?"#EF4444":e.color?e.color:e.priority&&we[e.priority]?we[e.priority]:o.taskBarPrimary,Le=k?"default":ue?ct?"crosshair":Qe?"ew-resize":"grabbing":"grab",Te=k?"default":"ew-resize",Ne=(b=>b>=80?20:b>=60?15:b>=50?12:10)(r),Ge=r<50,pt=r<40;useEffect(()=>{y&&(!Z||ue||e.segments)&&y(null);},[Z,ue,e.segments,y]);let it=b=>b.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),at=()=>{let b=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${b} day${b!==1?"s":""}`},Ze=b=>Math.round(b/s)*s,At=b=>{let B=Math.round(b/s),H=new Date(n);return H.setDate(H.getDate()+B),H},Dt=(b,B)=>{for(let H of g){if(H.id===e.id)continue;let _=5;if(b>=H.x-_&&b<=H.x+H.width+_&&B>=H.y-_&&B<=H.y+H.height+_)return H.id}return null},mt=useCallback((b,B,H)=>{if(k)return;b.preventDefault(),b.stopPropagation();let _=T.current?.ownerSVGElement;if(!_)return;let ne=_.createSVGPoint();ne.x=b.clientX,ne.y=b.clientY;let he=ne.matrixTransform(_.getScreenCTM()?.inverse()),J=H!==void 0?H:t,de=B;if(!de){let _e=he.x-J;b.shiftKey?(de="connect",je({x:t+r,y:a+ye/2})):b.ctrlKey||b.metaKey?de="move":b.altKey?de=_e<r/2?"resize-start":"resize-end":pt?_e<r/2?de="move":de="resize-end":Ge?_e<=Ne/2?de="resize-start":_e>=r-Ne/2?de="resize-end":de="move":_e<=Ne?de="resize-start":_e>=r-Ne?de="resize-end":de="move";}C.current=false,O(de),Je(false),We(null),de==="move"?K(he.x-J):de==="connect"?je({x:t+r,y:a+ye/2}):K(0),ce(J),q(r);},[t,r,a,ye,k]),bt=useCallback(b=>{let B=T.current?.ownerSVGElement;if(!B)return;let H=B.closest(".gantt-timeline-scroll");if(!H)return;let _=H.getBoundingClientRect(),ne=60,he=15,J=0;if(b.clientX<_.left+ne){let de=_.left+ne-b.clientX;J=-Math.min(he,de/2);}else if(b.clientX>_.right-ne){let de=b.clientX-(_.right-ne);J=Math.min(he,de/2);}return J!==0&&(H.scrollLeft+=J),J!==0},[]),lt=useCallback(b=>{if(I==="none")return;C.current=true,N.current=b;let B=T.current?.ownerSVGElement;if(!B)return;if(I==="move"||I==="resize-start"||I==="resize-end"){let ne=bt(b);ne&&!S.current?S.current=window.setInterval(()=>{N.current&&(bt(N.current),lt(N.current));},16):!ne&&S.current&&(window.clearInterval(S.current),S.current=null);}let H=B.createSVGPoint();H.x=b.clientX,H.y=b.clientY;let _=H.matrixTransform(B.getScreenCTM()?.inverse());if(I==="connect"){je({x:_.x,y:_.y});let ne=Dt(_.x,_.y);V(ne);}else if(I==="move"){let ne=_.x-A,he=Ze(ne);ce(he),q(r);let J=Math.round((he-t)/s);if(h?.(e.id,J,true),e.segments&&e.segments.length>0&&z!==null){let de=he-X;$e(de);}}else if(I==="resize-start"){let ne=_.x,he=Ze(ne),J=t+r-he;J>=s&&(ce(he),q(J));}else if(I==="resize-end"){let ne=_.x,J=Ze(ne)-t;J>=s&&q(J);}},[I,t,r,s,A,e,Ze,z,X,Dt,V,je,ce,q,$e,h,bt]),St=useCallback(()=>{if(S.current&&(window.clearInterval(S.current),S.current=null),N.current=null,I!=="none"){if(I==="connect")M&&p&&p(e,M),je(null),V(null);else {let b=e.endDate.getTime()-e.startDate.getTime(),B,H,_=true;if(I==="move"){if(B=At(E),H=new Date(B.getTime()+b),e.segments&&e.segments.length>0&&z!==null){let ne=Math.round(be/s),he=e.segments.map((Ke,gt)=>{if(gt===z){let Ot=new Date(Ke.startDate),Ht=new Date(Ke.endDate);return Ot.setDate(Ot.getDate()+ne),Ht.setDate(Ht.getDate()+ne),{startDate:Ot,endDate:Ht}}return Ke}),J=he.flatMap(Ke=>[Ke.startDate,Ke.endDate]),de=new Date(Math.min(...J.map(Ke=>Ke.getTime()))),_e=new Date(Math.max(...J.map(Ke=>Ke.getTime())));d?.({...e,segments:he},de,_e),wt(t,r);return}}else I==="resize-start"?(B=At(E),H=e.endDate,B>H&&(console.warn("Invalid date range: start date must be before or equal to end date"),_=false)):I==="resize-end"?(B=e.startDate,H=At(E+L),H.setDate(H.getDate()-1),H<B&&(console.warn("Invalid date range: end date must be after or equal to start date"),_=false)):_=false;_&&B&&H&&(H.getTime()<B.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,B,H));}h?.(e.id,0,false),wt(t,r);}},[I,E,L,e,d,M,p,t,r,s,At,be,z,wt,h]);useEffect(()=>{if(I==="none")return;let b=H=>{lt(H);},B=()=>{St();};return window.addEventListener("mousemove",b),window.addEventListener("mouseup",B),()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",B),S.current&&(window.clearInterval(S.current),S.current=null);}},[I,lt,St]);let Re=ue&&!ct?E:t,Ae=ue&&!ct?L:r,ot=l.taskClass(e),ae=24,ge=x?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:T,"data-task-bar":"true",style:{opacity:ge,transition:"opacity 300ms ease"},onClick:()=>{!ue&&!C.current&&u?.(e),C.current=false;},onDoubleClick:b=>{!ue&&!C.current&&(b.stopPropagation(),i?.(e));},onContextMenu:b=>{b.preventDefault(),c?.(e,b);},onMouseEnter:()=>!ue&&Je(true),onMouseMove:b=>{y&&Z&&!ue&&!e.segments&&y({task:e,x:t,y:a,width:r,height:ye,showBelow:false,mouseX:b.clientX,mouseY:b.clientY});},onMouseLeave:()=>{ue||(Je(false),We(null));},children:[jsx("rect",{x:t,y:a,width:r+ae,height:ye,fill:"transparent",style:{pointerEvents:"all"}}),Z&&!ue&&!Ge&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ne,height:ye,fill:fe==="resize-start"?o.accent:"transparent",opacity:fe==="resize-start"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>We("resize-start"),onMouseDown:b=>mt(b,"resize-start")}),jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:ye,fill:fe==="move"?o.accent:"transparent",opacity:fe==="move"?.1:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>We("move"),onMouseDown:b=>mt(b,"move")}),jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:ye,fill:fe==="resize-end"?o.accent:"transparent",opacity:fe==="resize-end"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>We("resize-end"),onMouseDown:b=>mt(b,"resize-end")})]}),Z&&!ue&&pt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ye,fill:fe==="move"?o.accent:"transparent",opacity:fe==="move"?.2:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>We("move"),onMouseDown:b=>mt(b,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ye,fill:fe==="resize-end"?o.accent:"transparent",opacity:fe==="resize-end"?.2:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>We("resize-end"),onMouseDown:b=>mt(b,"resize-end")}),Z&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ye-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ue&&!ct&&!e.segments&&jsx(motion.rect,{x:E,y:a,width:L,height:ye,rx:qe,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"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!ue&&(()=>{let b=e.baselineStartDate.getTime(),B=e.baselineEndDate.getTime(),H=n.getTime(),_=864e5,ne=(b-H)/_,he=(B-b)/_,J=ne*s,de=Math.max(he*s,s),_e=Re+Ae,Ke=J+de,gt=e.endDate?.getTime()??0,Ot=Math.ceil((gt-B)/_),Ht=Ot>0,U=Ot<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:J,y:a,width:de,height:ye,rx:qe,fill:"none",stroke:tt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Ht&&_e>Ke&&jsx("rect",{x:Ke,y:a,width:_e-Ke,height:ye,rx:0,fill:"#EF4444",opacity:.2}),Ht&&jsxs("text",{x:Math.max(_e,Ke)+6,y:a+ye/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ot,"d"]}),U&&jsxs("text",{x:_e+6,y:a+ye/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ot,"d"]})]})})(),!e.segments&&ut&&$&&(()=>{let B=a+(ye-8)/2,H=4,_=e.progress||0,ne=new Date;ne.setHours(0,0,0,0);let he=e.startDate&&ne>=e.startDate,J=e.endDate&&(()=>{let Ht=new Date(e.endDate);return Ht.setHours(0,0,0,0),ne>Ht})(),de=e.startDate&&ne<e.startDate,_e=1;if(he&&e.startDate&&e.endDate&&!de){let Ht=new Date(e.startDate);Ht.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let oe=Math.max(1,(U.getTime()-Ht.getTime())/(1e3*60*60*24)),P=Math.min((ne.getTime()-Ht.getTime())/(1e3*60*60*24),oe)/oe*100;_e=P>0?_/P:1;}let Ke;_>=100?Ke="#00E5CC":de?Ke="#4B5563":J&&_<100?Ke="#EF4444":_e>=.95?Ke="#22C55E":_e>=.8?Ke="#F59E0B":Ke="#EF4444";let gt=Math.max(_/100*Ae,_>0?H*2:0),Ot=Ae>100&&_>0;return jsxs("g",{"data-task-class":ot,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Re,y:B,width:Ae,height:8,rx:H,fill:"rgba(255,255,255,0.10)"}),_>0&&jsx("rect",{x:Re,y:B,width:gt,height:8,rx:H,fill:Ke}),Ot&&jsxs("text",{x:Re+gt+6,y:B+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(_),"%"]})]})})(),!e.segments&&ut&&!$&&jsx(motion.rect,{x:Re,y:a,width:Ae,height:ye,rx:qe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ot,initial:{opacity:0,scale:.95},animate:{opacity:ue&&!ct?.15:e.parentId?.6:1,scale:Z&&!ue?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:b=>mt(b),style:{cursor:Le,pointerEvents:"all"}}),!e.segments&&!ut&&jsx(motion.rect,{x:Re,y:a,width:Ae,height:ye,rx:qe,fill:ee,"data-task-class":ot,initial:{opacity:0,scale:.95},animate:{opacity:ue&&!ct?.15:e.parentId?.6:Z?.9:.8,scale:Z&&!ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:$?void 0:b=>mt(b),style:{cursor:$?"default":Le,pointerEvents:"all"}}),ut&&(se||D)&&!e.segments&&jsx("rect",{x:Re,y:a,width:Ae,height:ye,rx:qe,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&&!$&&jsx("rect",{x:Re,y:a,width:Math.max(Ae*(e.progress/100),qe*2),height:ye,rx:qe,fill:ee,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!$&&e.progress<100&&(()=>{let b=e.progress>0?Ae*(e.progress/100):0,B=Re+b,H=Ae-b,_=e.progress===0?qe:0,ne=e.progress===0?Re:B,he=e.progress===0?Ae:H;return jsxs(Fragment,{children:[jsx("rect",{x:ne,y:a,width:he,height:ye,rx:_,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:ne,y:a,width:he,height:ye,rx:_,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ut&&!e.segments&&e.progress>0&&e.progress<100&&!$&&!ue&&(()=>{let b=Re+Ae*(e.progress/100),B=8,H=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:b,cy:a+ye/2,r:B,fill:H?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:b,y:a+ye/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:H?.initials||H?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((b,B)=>{let H=(b.startDate.getTime()-n.getTime())/864e5*s,ne=(b.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-H+s,he=ue&&I==="move"&&z===B,J=De===B,de=he?H+be:H;return jsxs("g",{onMouseEnter:()=>!ue&&Xe(B),onMouseLeave:()=>!ue&&Xe(null),children:[jsx(motion.rect,{x:de,y:a,width:ne,height:ye,rx:qe,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:he||e.parentId?.6:J?.9:.8,scale:J&&!ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_e=>{_e.stopPropagation(),te(B),Me(H),mt(_e,void 0,H);},style:{cursor:Le,pointerEvents:"all"}}),jsx("rect",{x:de,y:a,width:ne*(e.progress/100),height:ye,rx:qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${B}`)}),Y&&(se||D)&&!e.segments&&jsxs(Fragment,{children:[D&&!se&&jsx("rect",{x:Re,y:a,width:Ae,height:ye,rx:qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsx("rect",{x:Re,y:a,width:Ae,height:ye,rx:qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Ae>60&&!e.segments&&!(ut&&$)&&(()=>{let b=l.taskLabel(e),B=typeof b=="string"?b:e.name,H=B.length>Math.floor(Ae/8)?`${B.substring(0,Math.floor(Ae/8))}...`:B;return jsx("text",{x:Re+8,y:a+ye/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:H})})(),!ue&&!e.segments&&!$&&e.progress>0&&e.progress<100&&(ut?jsxs("text",{x:Re+Ae+6,y:a+ye/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ae>100?jsxs("text",{x:Re+Ae-12,y:a+ye/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&&Ae>80&&!ue&&!e.segments&&!(ut&&$)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Re+Ae-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Re+Ae-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Z||Qe)&&!ct&&!e.segments&&!$&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Re-2,y:a,width:16,height:ye,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>We("resize-start"),onMouseLeave:()=>We(null),onMouseDown:b=>{b.stopPropagation(),mt(b,"resize-start");}}),jsx(motion.rect,{x:Re+4,y:a+8,width:3,height:ye-16,rx:1.5,fill:fe==="resize-start"||I==="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:Re+Ae-14,y:a,width:16,height:ye,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>We("resize-end"),onMouseLeave:()=>We(null),onMouseDown:b=>{b.stopPropagation(),mt(b,"resize-end");}}),jsx(motion.rect,{x:Re+Ae-7,y:a+8,width:3,height:ye-16,rx:1.5,fill:fe==="resize-end"||I==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Z&&!ue&&!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+ye/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>We("connect"),onMouseLeave:()=>We(null),onMouseDown:b=>{b.stopPropagation(),mt(b,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ye/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:fe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ct&&Ce&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ye/2,x2:Ce.x,y2:Ce.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Ce.x,cy:Ce.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsx(motion.text,{x:Ce.x+15,y:Ce.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Ce.x+10},animate:{opacity:1,x:Ce.x+15},transition:{duration:.2},children:"Connect"})]}),(Z||ue)&&!ct&&!e.segments&&jsx(motion.rect,{x:Re-1,y:a-1,width:Ae+2,height:ye+2,rx:qe+1,fill:"none",stroke:ue?o.accent:ut?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:ut?1:2,opacity:ue||ut?.6:.4,initial:{opacity:0},animate:{opacity:ue||ut?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Qe&&jsxs(Fragment,{children:[jsx("line",{x1:E,y1:0,x2:E,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:E+L,y1:0,x2:E+L,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Z&&!ue&&!e.segments&&!y&&(()=>{let H=a<100,_=H?a+ye+13:a-82-13,ne=H?`M ${Re+Ae/2-6} ${a+ye+3} L ${Re+Ae/2} ${a+ye+13} L ${Re+Ae/2+6} ${a+ye+3}`:`M ${Re+Ae/2-6} ${a-13} L ${Re+Ae/2} ${a-3} L ${Re+Ae/2+6} ${a-13}`,he=_+22,J=_+40,de=_+55,_e=_+70,Ke=H?_+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:H?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:H?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Re+Ae/2-120,y:_,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:Re+Ae/2,y:he,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:Re+Ae/2-110,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Re+Ae/2-70,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:it(e.startDate)}),jsx("text",{x:Re+Ae/2-110,y:de,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Re+Ae/2-70,y:de,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:it(e.endDate)}),jsx("text",{x:Re+Ae/2+10,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Re+Ae/2+65,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:at()}),jsx("text",{x:Re+Ae/2+10,y:de,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Re+Ae/2+65,y:de,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:Re+Ae/2-110,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Re+Ae/2-50,y:_e,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?"...":""]})]}),!H&&jsx("text",{x:Re+Ae/2,y:Ke,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:pt?"Left: move \u2022 Right: resize":Ge?"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,uv=-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:w}=e,C=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null?155:105,S=k+Jp,N=w+uv-C;S+md>window.innerWidth-bn&&(S=k-md-Jp),S<bn&&(S=bn);let I=N<bn;I&&(N=w+20),N+C>window.innerHeight-bn&&(N=window.innerHeight-bn-C),o({left:S,top:N,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={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"},u=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{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),w=x%60;return k===0?`${w}m`:w===0?`${k}h`:`${k}h ${w}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",h=t.accent||"#3B82F6",y=t.bgSecondary||"#1F2937",v=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:y,border:`1px solid ${v}`,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:l.start,value:s.startDate?u(s.startDate):"N/A",labelColor:d,valueColor:p}),jsx(li,{label:l.duration,value:i(),labelColor:d,valueColor:p}),jsx(li,{label:l.end,value:s.endDate?u(s.endDate):"N/A",labelColor:d,valueColor:p}),jsx(li,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:p})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsx("span",{style:{color:p,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:d},children:[l.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:c(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsx("span",{style:{color:h,fontWeight:600},children:c(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsx("span",{style:{color:p,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 i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},u=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxs("div",{className:m("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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:m("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(u).map(([i,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:i})}),jsx("div",{children:c.map(d=>jsxs("button",{onClick:()=>l(d),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Yl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[u,i]=useState("json"),[c,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let y=o?.current||void 0,v=await jc(e,u,y);Kc(v,u);},h=async y=>{let v=y.target.files?.[0];if(v){try{let f=await Xc(v),x=v.name.endsWith(".json")?"json":"csv",k=qc(f,x);d(k),k.success&&r&&r(k,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:m("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:m("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:()=>l("import"),className:m("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(y=>jsxs("button",{onClick:()=>i(y),className:m("p-4 rounded-lg border-2 transition-all text-center",u===y?"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:[y==="json"&&"\u{1F4C4}",y==="csv"&&"\u{1F4CA}",y==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:y})]},y))})]}),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:p,type:"file",accept:".json,.csv",onChange:h,className:"hidden"}),jsxs("button",{onClick:()=>p.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:m("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:m("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((y,v)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",y]},v))})]})]})]})]})]})}var By=["URGENT","HIGH","MEDIUM","LOW"],Ry=[{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"}],Oy=[{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:l,availableUsers:u=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:h}){let[y,v]=useState(true),f=useCallback(C=>{a({search:C.target.value});},[a]),x=useCallback(C=>{a({dateFilter:C.target.value});},[a]),k=useCallback(C=>{r({by:C.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=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 ${p?"filter-bar--compact":""} ${y?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>v(!y),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:y?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:y?"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"}),T&&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)"]})]}),!y&&jsxs("div",{className:"filter-bar__content",children:[d&&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"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange: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:C=>{let S=C.target.value;a({priorities:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),By.map(C=>jsx("option",{value:C,children:C},C))]})}),u.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let S=C.target.value;a({assignees:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),u.map(C=>jsx("option",{value:C.id,children:C.name},C.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let S=C.target.value;a({labels:S==="all"?[]:[S]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(C=>jsx("option",{value:C,children:C},C))]})}),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:Ry.map(C=>jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),h&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:C=>h(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Oy.map(C=>jsx("option",{value:C.value,children:C.label},C.value))})}),T&&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:l,onExportGanttCSV:u}){let[i,c]=useState(false),d=useRef(null);useEffect(()=>{let g=h=>{d.current&&!d.current.contains(h.target)&&c(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let p=g=>{g(),c(false);};return jsxs("div",{className:m("relative",r),ref:d,children:[jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>p(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:()=>p(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:()=>p(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:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:()=>p(()=>u?.()),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:()=>p(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:()=>p(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),Ky="asakaa-theme";function Tp({children:e,defaultTheme:t=Ys,storageKey:a=Ky}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,u=Bo[r];Object.entries(u.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${Yy(c)}`,d);}),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,d])=>{let p=u.colors[c];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.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 Yy(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:m("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:m("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 nt[e]||nt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",nt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",nt[e].bgSecondary),bgGrid:r("--theme-bg-card",nt[e].bgGrid),bgWeekend:r("--theme-bg-hover",nt[e].bgWeekend),border:r("--theme-border-primary",nt[e].border),borderLight:r("--theme-border-subtle",nt[e].borderLight),textPrimary:r("--theme-text-primary",nt[e].textPrimary),textSecondary:r("--theme-text-secondary",nt[e].textSecondary),textTertiary:r("--theme-text-tertiary",nt[e].textTertiary),accent:r("--theme-accent-primary",nt[e].accent),accentHover:r("--theme-accent-hover",nt[e].accentHover),accentLight:r("--theme-accent-primary",nt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",nt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",nt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",nt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",nt[e].dependency),dependencyHover:r("--theme-border-secondary",nt[e].dependencyHover),criticalPath:r("--theme-error",nt[e].criticalPath),criticalPathLight:r("--theme-error",nt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",nt[e].today):e==="neutral"?r("--theme-text-primary",nt[e].today):r("--theme-error",nt[e].today),todayLight:e==="light"?r("--theme-accent-primary",nt[e].todayLight):e==="neutral"?r("--theme-text-primary",nt[e].todayLight):r("--theme-error",nt[e].todayLight),milestone:r("--theme-warning",nt[e].milestone),milestoneLight:r("--theme-warning",nt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",nt[e].statusTodo),statusInProgress:r("--theme-accent-primary",nt[e].statusInProgress),statusCompleted:r("--theme-success",nt[e].statusCompleted),hoverBg:r("--theme-bg-hover",nt[e].hoverBg),focusRing:r("--theme-accent-primary",nt[e].focusRing),...nt[e].dotGrid&&{dotGrid:nt[e].dotGrid},...nt[e].glassHeader&&{glassHeader:nt[e].glassHeader},...nt[e].glassToolbar&&{glassToolbar:nt[e].glassToolbar},...nt[e].forecastHud&&{forecastHud:nt[e].forecastHud},...nt[e].neonRedGlow&&{neonRedGlow:nt[e].neonRedGlow},...nt[e].executionBarBg&&{executionBarBg:nt[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(),l=n.bottom+4,u;a==="right"?u=n.right-r:u=n.left;let i=8;u+r>window.innerWidth-i&&(u=window.innerWidth-i-r),u<i&&(u=i),s({top:l,left:u});},[t,a,e,r]),o}function Fp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=useState(false),[u,i]=useState(null),[c,d]=useState(false),p=useRef(null),g=useRef(null),h=Er(),y=Zs(p,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=h.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let T=C=>{let S=C.target;p.current&&!p.current.contains(S)&&g.current&&!g.current.contains(S)&&l(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[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(T=>T.handler),k=async(T,C)=>{if(C){i(T);try{await C();}catch(S){console.error(`Export ${T} failed:`,S);}finally{i(null),l(false);}}},w=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>l(!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:y.top,left:y.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"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:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:x.map((T,C)=>jsxs(motion.button,{onClick:()=>k(T.id,T.handler),disabled:u!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"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("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:u===T.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"})}):T.icon}),jsx("span",{className:"flex-1 text-left",children:T.label})]},T.id))})]}),x.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"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:v?"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:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"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 vx({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 wx({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 Mp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),l=useRef(null),u=Er(),i=Zs(n,o,"left");useEffect(()=>{if(!o)return;let p=g=>{let h=g.target;n.current&&!n.current.contains(h)&&l.current&&!l.current.contains(h)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let c=[{value:"all",label:u.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?u.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:`${u.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:c.map((p,g)=>{let h=t===p.value;return jsxs(motion.button,{onClick:()=>{a(p.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:p.label}),h&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function Pp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),u=useRef(null),i=Er(),c=Zs(l,s,"left");useEffect(()=>{if(!s)return;let h=setTimeout(()=>{let y=f=>{let x=f.target;l.current&&!l.current.contains(x)&&u.current&&!u.current.contains(x)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",y),document.addEventListener("keydown",v),u._cleanup=()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(h),u._cleanup&&u._cleanup();}},[s]);let d=[{value:"all",label:i.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:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:h=>{h.stopPropagation(),n(y=>!y);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#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:i.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:u,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:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(h=>{let y=t===h.value&&!r,v=()=>h.value==="all"?y?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:y?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:`${y?h.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:h.label}),y&&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:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function kx({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 l=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:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?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 Cx({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,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,u=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,c=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,p=t?.currency||"$",g=d!=null?d>=1e6?`${p}${(d/1e6).toFixed(2)}M`:d>=1e3?`${p}${(d/1e3).toFixed(1)}K`:`${p}${d.toFixed(0)}`:"\u2014",h=t?.budgetVariancePercent,y=h!=null&&h!==0,v=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&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:u.bg,color:u.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:c,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),y&&v&&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:v})]})]})]})}function Tx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:u,rowDensity:i,onRowDensityChange:c,hasDependencies:d=true}){let[p,g]=useState(false),h=useRef(null),y=useRef(null),v=Er(),f=Zs(h,p,"right",208),x=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let C=S=>{let N=S.target;h.current&&!h.current.contains(N)&&y.current&&!y.current.contains(N)&&g(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]);let k=v.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:k?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:k?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:k?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:k?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:k?"Dependencias":"Dependencies",icon:GitBranch,active:l,onChange:u}],T=[{value:"compact",label:v.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:v.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:h,onClick:()=>g(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:v.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:y,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:f.top,left:f.left,zIndex:99999,backgroundColor:x?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${x?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:x?"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:x?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((C,S)=>{let N=C.icon,I=C.disabled,O=C.tooltip;return jsxs(motion.button,{onClick:()=>!I&&C.onChange?.(!C.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:I?x?"rgba(255,255,255,0.3)":"#9CA3AF":x?"rgba(255,255,255,0.85)":"#111827",cursor:I?"not-allowed":"pointer"},whileHover:I?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:S*.03},title:O,children:[jsx(N,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:I?x?"rgba(255,255,255,0.2)":"#D1D5DB":C.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:C.label}),C.active&&!I&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:x?"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:x?"rgba(255,255,255,0.35)":e.textTertiary},children:v.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),T.map((C,S)=>{let N=i===C.value;return jsxs(motion.button,{onClick:()=>c(C.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:x?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+S)*.03},children:[jsx("span",{style:{color:N?e.accent||"#2E94FF":x?"rgba(255,255,255,0.85)":e.textPrimary},children:C.label}),N&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},C.value)})]})]})}),document.body)]})}function ei({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:h,hideCompleted:y=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:x,onWbsLevelChange:k,maxWbsDepth:w=4,viewMode:T="execution",onViewModeChange:C,projectForecast:S,onExportPNG:N,onExportPDF:I,onExportExcel:O,onExportCSV:A,onExportJSON:K,onExportMSProject:E,showCriticalPath:ce=true,onShowCriticalPathChange:L,showDependencies:q=true,onShowDependenciesChange:Ce,highlightWeekends:je=true,onHighlightWeekendsChange:M,showBaseline:V=false,onShowBaselineChange:fe,onCopySnapshotLink:We,hasDependencies:z=true}){let te=Er(),X=N||I||O||A||K||E,Me=!!e.glassToolbar,[be,$e]=useState(false),De=useRef(null);useEffect(()=>{be&&De.current&&De.current.focus();},[be]);let Xe=[{value:"day",label:te.toolbar.day},{value:"week",label:te.toolbar.week},{value:"month",label:te.toolbar.month}],Z=[{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"})}],Je=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Me){let ue=Je?"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:Je?"#1A1A1A":e.bgSecondary,border:`1px solid ${Je?"rgba(255,255,255,0.08)":e.border}`},animate:{width:be?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>$e(!be),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"})}),be&&jsx("input",{ref:De,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:()=>$e(false),onKeyDown:Qe=>{Qe.key==="Escape"&&$e(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),C&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Je?"#000000":e.bgSecondary,border:`1px solid ${Je?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="execution"?Je?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:T==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="execution"?{color:e.textSecondary}:{},children:te.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="oracle"?Je?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:T==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="oracle"?{color:e.textSecondary}:{},children:te.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(kx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),k&&jsx(Mp,{theme:e,value:x??"all",onChange:k,maxDepth:w}),h&&jsx(Pp,{theme:e,value:g,onChange:h,hideCompleted:y,onHideCompletedChange:v}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ue}}),jsx(Tx,{theme:e,showCriticalPath:ce,onShowCriticalPathChange:L,showBaseline:V,onShowBaselineChange:fe,highlightWeekends:je,onHighlightWeekendsChange:M,showDependencies:q,onShowDependenciesChange:Ce,rowDensity:l,onRowDensityChange:u,hasDependencies:z}),jsx(Fp,{theme:e,onExportPNG:N,onExportPDF:I,onExportExcel:O,onExportMSProject:E,onCopySnapshotLink:We}),c&&p&&jsxs(motion.button,{onClick:p,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 ${Je?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Je?"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:d||te.toolbar.createTask})]})]})]}),S&&jsx(Cx,{theme:e,forecast:S})]})}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(wx,{options:Xe,value:t,onChange:ue=>a(ue),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(Mp,{theme:e,value:x??"all",onChange:k,maxDepth:w}),h&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Pp,{theme:e,value:g,onChange:h,hideCompleted:y,onHideCompletedChange:v})]})]}),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&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,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:d||te.toolbar.createTask})]}),(X||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Fp,{theme:e,onExportPNG:N,onExportPDF:I,onExportExcel:O,onExportMSProject:E,onCopySnapshotLink:We}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(vx,{options:Z,value:s,onChange:ue=>n(ue),theme:e})]})]})}function ti({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),u=useRef(null);useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let c=u.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(Bt,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(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:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.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),[l,u]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,p=8,g=window.innerWidth,h=window.innerHeight,y=t,v=a;t+c+p>g&&(y=t-c,y<p&&(y=p)),a+d+p>h&&(v=h-d-p,v<p&&(v=p)),u({x:y,y:v});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=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:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(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:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.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 Kt={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:l,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:p=true}){let g=useRef(false),h=useCallback(k=>{g.current=k;},[]),y=useCallback(k=>{let w=[],T=C=>{for(let S of C)w.push(S),S.subtasks&&S.subtasks.length>0&&S.isExpanded&&T(S.subtasks);};return T(k),w},[]),v=useCallback(()=>{let k=y(e);for(let w of k)if(t.has(w.id))return w;return null},[e,t,y]),f=useCallback((k,w)=>{let T=y(e);if(T.length===0)return;let C=v();if(!C){a(T[0].id,false);return}let S=T.findIndex(O=>O.id===C.id);if(S===-1)return;let N=k==="up"?S-1:S+1;if(N<0||N>=T.length)return;let I=T[N];a(I.id,w);},[e,v,y,a]),x=useCallback(k=>{if(!p)return;let w=k.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||g.current){k.key==="Escape"&&(w.blur(),g.current=false);return}let S=navigator.platform.toUpperCase().indexOf("MAC")>=0?k.metaKey:k.ctrlKey,N=Array.from(t),I=v();if(k.key==="ArrowUp"){k.preventDefault(),f("up",k.shiftKey);return}if(k.key==="ArrowDown"){k.preventDefault(),f("down",k.shiftKey);return}if(I&&(k.key==="ArrowRight"||k.key==="ArrowLeft")){I.subtasks&&I.subtasks.length>0&&(k.preventDefault(),(k.key==="ArrowRight"&&!I.isExpanded||k.key==="ArrowLeft"&&I.isExpanded)&&c(I.id));return}if(k.altKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){N.length>0&&(k.preventDefault(),n(N,k.key==="ArrowUp"?"up":"down"));return}if(k.key==="Tab"&&!k.shiftKey){N.length>0&&(k.preventDefault(),l(N));return}if(k.key==="Tab"&&k.shiftKey){N.length>0&&(k.preventDefault(),u(N));return}if(k.key==="Enter"&&!k.shiftKey&&!S){I&&(k.preventDefault(),r(I.id,"below"));return}if(k.key==="Enter"&&k.shiftKey&&!S){I&&(k.preventDefault(),r(I.id,"above"));return}if(k.key==="Enter"&&S){I&&(k.preventDefault(),d(I.id));return}if(k.key==="F2"){I&&(k.preventDefault(),i(I.id));return}if(k.key==="Delete"||k.key==="Backspace"&&S){N.length>0&&(k.preventDefault(),o(N));return}if(k.key==="d"&&S&&!k.shiftKey){N.length>0&&(k.preventDefault(),s(N));return}},[p,t,v,f,r,o,s,n,l,u,i,c,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x);}},[p,x]),{setIsEditing:h}}function Up(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(p=>{let g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let g=p.indexOf(a),h=p.indexOf(d);if(g===-1||h===-1){o(d);return}let y=Math.min(g,h),v=Math.max(g,h),f=p.slice(y,v+1);t(new Set(f)),r(d);},[a,o]),l=useCallback((d,p,g,h)=>{h?n(d,p):g?s(d):o(d);},[o,s,n]),u=useCallback((d,p)=>{p?t(g=>{let h=new Set(g);return h.add(d),h}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:u,clearSelection:i,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((l,u)=>(l.position??0)-(u.position??0));for(let l=0;l<n.length;l++){let u={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(u),u.subtasks&&u.subtasks.length>0&&u.isExpanded&&a(u.subtasks,u.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(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,g)=>{let h=[];return {tasks:p.filter(v=>{if(g.has(v.id))return h.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,h.push(...f.removed);}return true}),removed:h}},l=(p,g,h)=>p.map(y=>y.id===g?{...y,subtasks:[...y.subtasks||[],...h],isExpanded:true}:y.subtasks?{...y,subtasks:l(y.subtasks,g,h)}:y),u=new Set(t),{tasks:i,removed:c}=n(e,u),d=l(i,s.id,c);return nd(d)}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=(i,c,d)=>{for(let p=0;p<i.length;p++){let g=i[p];if(g.id===c&&g.subtasks){let h=g.subtasks.findIndex(y=>y.id===d);if(h!==-1){let[y]=g.subtasks.splice(h,1);return y}}if(g.subtasks){let h=n(g.subtasks,c,d);if(h)return h}}return null},l=(i,c,d)=>{let p=i.findIndex(g=>g.id===c);if(p!==-1)return i.splice(p+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,c,d);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?l(s.subtasks,o.id,u):l(a,o.id,u));}return nd(a)}function ld(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,u)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,u))return true;return false}let c=u==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],n[i]={...n[i],position:i},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=(u,i)=>u.map((c,d)=>({...c,id:`${c.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${d}`):void 0})),n=u=>{let i=u.findIndex(g=>g.id===o);if(i===-1){for(let g of u)if(g.subtasks){let h=n(g.subtasks);if(h)return h}return null}let c=u[i],d=`${c.id}-copy-${Date.now()}`,p={...c,id:d,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,d):void 0};return u.splice(i+1,0,p),p},l=n(a);l&&r.push(l);}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"},l=u=>{let i=u.findIndex(d=>d.id===t);if(i===-1){for(let d of u)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return u.splice(c,0,n),true};return l(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=p=>{for(let g of p){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,l=r?.endDate||s,u=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let h=u(g.subtasks);if(h>=0)return h}}return 0},i=u(e),c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=p=>p.map(g=>{if(g.id===t){let h=g.subtasks||[];return {...g,subtasks:[...h,c],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:c}}function Gp(e,t,a,r){if(t===a)return e;let o=ai(e,t);if(!o)return e;if(a){let l=(u,i)=>{if(!u.subtasks)return false;for(let c of u.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>{let u=l.filter(c=>c.id!==t),i=u.length<l.length;return u.map((c,d)=>{let p=i?{...c,position:d}:c;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((u,i)=>({...u,position:i}));}else {let l=u=>u.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,p=[...c];p.splice(d,0,{...o,parentId:a});let g=p.map((h,y)=>({...h,position:y}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(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((l,u)=>(u.startDate&&l.starts.push(new Date(u.startDate).getTime()),u.endDate&&l.ends.push(new Date(u.endDate).getTime()),l.progresses.push(u.progress??0),l),{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((l,u)=>l+u,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:l,onTaskToggle:u,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:h,onTaskOutdent:y,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:x,onTaskCreate:k,onTaskRename:w,onCreateSubtask:T,onOpenTaskModal:C,onDeleteRequest:S,onTaskReparent:N,scrollContainerRef:I,showCriticalPath:O=false}){let A=useContext(un),[K,E]=useState(null),[ce,L]=useState(null),[q,Ce]=useState(""),je=useRef(null),[M,V]=useState(null),[fe,We]=useState(0),[z,te]=useState(0),[X,Me]=useState({isOpen:false,x:0,y:0,type:"header"}),[be,$e]=useState(null),[De,Xe]=useState(null),[Z,Je]=useState(null),ue=useRef(0),Qe=5,ct=useRef(false),[wt,ye]=useState(null),[ut,tt]=useState(false),qe=useRef(null),[$,se]=useState(null),[D,Y]=useState(false),ie=useRef(null);useEffect(()=>{function ae(me){ie.current&&!ie.current.contains(me.target)&&Y(false);}if(D)return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[D]),useEffect(()=>{ce&&je.current&&(je.current.focus(),je.current.select());},[ce]),useEffect(()=>{if(!M)return;let ae=b=>{let B=b.clientX-fe,H=z+B;p?.(M,H);},me=()=>{V(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ae),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[M,fe,z,p]);let{selectedTaskIds:we,handleTaskClick:W,isTaskSelected:ee}=Up(),{setIsEditing:Le}=Hp({tasks:e,selectedTaskIds:we,onTaskSelect:(ae,me)=>{let B=fn(e).map(H=>H.id);W(ae,B,me||false,false);},onTaskCreate:k||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:x||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:h||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:ae=>{let me=fn(e).find(b=>b.id===ae);me&&it(me);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:ae=>{let me=fn(e).find(b=>b.id===ae);me&&C&&C(me);},enableKeyboard:true}),Te=(ae,me=0,b="")=>{let B=[],H=[...ae].sort((_,ne)=>(_.position??0)-(ne.position??0));for(let _=0;_<H.length;_++){let ne=H[_],he=_+1,J=b?`${b}.${he}`:`${he}.0`;if(ne.wbsCode=J,B.push({task:ne,level:me}),ne.subtasks&&ne.subtasks.length>0&&ne.isExpanded){let de=b?`${b}.${he}`:`${he}`;B.push(...Te(ne.subtasks,me+1,de));}}return B},Be=Te(e),Ne=48,Ge=Math.max(Be.length*a,600-Ne),pt=ae=>!ae.startDate||!ae.endDate?"-":`${Math.ceil((ae.endDate.getTime()-ae.startDate.getTime())/(1e3*60*60*24))}d`,it=ae=>{L(ae.id),Ce(ae.name),Le(true);},at=ae=>{q.trim()&&q!==e.find(me=>me.id===ae)?.name&&w?.(ae,q.trim()),L(null),Ce(""),Le(false);},Ze=()=>{L(null),Ce(""),Le(false);},At=(ae,me)=>{me.stopPropagation(),T?.(ae.id);},Dt=(ae,me)=>{me.preventDefault(),ue.current=me.clientY,$e(ae),ct.current=false,tt(false),ye({x:me.clientX,y:me.clientY});},mt=ae=>{if(!be||(Math.abs(ae.clientY-ue.current)>Qe&&!ct.current&&(ct.current=true,tt(true)),ye({x:ae.clientX,y:ae.clientY}),!ct.current))return;if(I?.current){let _=I.current,ne=_.getBoundingClientRect(),he=60,J=12;qe.current&&(cancelAnimationFrame(qe.current),qe.current=null);let de=ae.clientY-ne.top,_e=ne.bottom-ae.clientY;if(de<he&&_.scrollTop>0){let Ke=Math.round(J*(1-de/he)),gt=()=>{_.scrollTop-=Ke,ct.current&&_.scrollTop>0&&(qe.current=requestAnimationFrame(gt));};qe.current=requestAnimationFrame(gt);}else if(_e<he&&_.scrollTop<_.scrollHeight-_.clientHeight){let Ke=Math.round(J*(1-_e/he)),gt=()=>{_.scrollTop+=Ke,ct.current&&_.scrollTop<_.scrollHeight-_.clientHeight&&(qe.current=requestAnimationFrame(gt));};qe.current=requestAnimationFrame(gt);}}let b=document.querySelectorAll("[data-task-row]"),B=null,H=null;b.forEach(_=>{let ne=_.getBoundingClientRect(),he=_.getAttribute("data-task-row");if(he&&he!==be&&ae.clientY>=ne.top&&ae.clientY<=ne.bottom){B=he;let J=ae.clientY-ne.top,de=ne.height;J<de*.25?H="above":J>de*.75?H="below":H="child";}}),Xe(B),Je(H);},bt=()=>{if(ct.current&&be&&De&&Z){if(Z==="child")N?.(be,De);else if(Z==="above"||Z==="below"){let ae=(H,_,ne=null)=>{for(let he of H){if(he.id===_)return ne;if(he.subtasks){let J=ae(he.subtasks,_,he.id);if(J!==void 0)return J}}},me=ae(e,be,null),b=ae(e,De,null),B=(H,_,ne,he)=>{let J=H.findIndex(Ke=>Ke.id===_),de=he?H.findIndex(Ke=>Ke.id===ne):-1,_e=Z==="below"?J+1:J;return he&&de!==-1&&de<J&&(_e-=1),Math.max(0,_e)};if(b===null){let _=B(e,De,be,me===null);N?.(be,null,_);}else {let H=Be.find(_=>_.task.id===b)?.task;if(H?.subtasks){let _=me===b,ne=B(H.subtasks,De,be,_);N?.(be,b,ne);}}}}qe.current&&(cancelAnimationFrame(qe.current),qe.current=null),$e(null),Xe(null),Je(null),ye(null),ct.current=false,tt(false);};useEffect(()=>{if(be)return document.addEventListener("mousemove",mt),document.addEventListener("mouseup",bt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",mt),document.removeEventListener("mouseup",bt),document.body.style.cursor="",document.body.style.userSelect="";}},[be,De,Z]);let lt=(ae,me,b)=>{let B=me.subtasks&&me.subtasks.length>0;switch(ae.id){case "name":let H=ce===me.id,_=K===me.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${b*20}px`},children:[N&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:_?1:.3},onMouseDown:U=>Dt(me.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),me.subtasks&&me.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),u?.(me.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:me.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"}),H?jsx("input",{ref:je,type:"text",value:q,onChange:U=>Ce(U.target.value),onKeyDown:U=>{U.key==="Enter"?at(me.id):U.key==="Escape"&&Ze();},onBlur:()=>at(me.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:U=>U.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:me.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:me.parentId?"13px":"14px",fontWeight:me.isMilestone?600:me.parentId?400:600,letterSpacing:me.parentId?"0":"-0.01em"},title:me.name,children:[me.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:me.wbsCode}),me.isHighlighted&&me.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:me.name}),me.subtasks&&me.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(me.progress||0),"%"]}),O&&me.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),O&&me.cpmData&&jsxs("span",{style:{color:me.cpmData.totalFloat<=0?"#EF4444":me.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(me.cpmData.totalFloat),"d"]})]}),_&&!H&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>At(me,U),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:U=>{U.stopPropagation(),it(me);},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 he=ae.id==="startDate"?"startDate":"endDate",J=me[he],de=$?.taskId===me.id&&$?.field===he,_e=U=>U?(typeof U=="string"?new Date(U):U).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:U=>U.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:B?.5:1,cursor:B?"default":"pointer"},title:B?"Auto-calculated from subtasks":void 0,onClick:U=>{if(!B)if(de)se(null);else {let oe=U.currentTarget.getBoundingClientRect();se({taskId:me.id,field:he,month:J?typeof J=="string"?new Date(J):J:new Date,position:{top:oe.bottom+4,left:oe.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:_e(J)}),B&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),de&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>se(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:$?.position.top,left:$?.position.left},onClick:U=>U.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let U=new Date,oe=new Date(U);oe.setDate(U.getDate()+1);let Oe=new Date(U);Oe.setDate(U.getDate()+7);let P=new Date(U);return P.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:oe},{label:"Pr\xF3xima semana",date:Oe},{label:"2 semanas",date:P}].map((He,Ye)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:qt=>qt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:qt=>qt.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[he]:He.date}),se(null);},children:He.label},Ye))})(),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:U=>U.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[he]:void 0}),se(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:()=>se(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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:$?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>se(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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((U,oe)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},oe))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=$?.month||new Date,oe=U.getFullYear(),Oe=U.getMonth(),P=new Date(oe,Oe,1).getDay(),ge=new Date(oe,Oe+1,0).getDate(),He=new Date,Ye=[];for(let Lt=P-1;Lt>=0;Lt--)Ye.push({day:new Date(oe,Oe,-Lt).getDate(),date:new Date(oe,Oe-1,new Date(oe,Oe,-Lt).getDate()),isCurrentMonth:false});for(let Lt=1;Lt<=ge;Lt++)Ye.push({day:Lt,date:new Date(oe,Oe,Lt),isCurrentMonth:true});let qt=42-Ye.length;for(let Lt=1;Lt<=qt;Lt++)Ye.push({day:Lt,date:new Date(oe,Oe+1,Lt),isCurrentMonth:false});return Ye.map((Lt,Da)=>{let Ba=Lt.date.toDateString()===He.toDateString(),fa=(J?typeof J=="string"?new Date(J):J:null)?.toDateString()===Lt.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:Lt.isCurrentMonth?fa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:fa?"#2E94FF":"transparent",boxShadow:Ba&&!fa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(me.id,{[he]:Lt.date}),se(null);},children:Lt.day},Da)})})()})]})]})]}),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:pt(me)})});case "assignees":if(B)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 Ke=r.filter(U=>me.assignees?.some(oe=>oe.name===U.name||oe.initials===U.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Fo,{assignedUsers:Ke,availableUsers:r,onChange:U=>{let oe=U.map(Oe=>({id:Oe.id,name:Oe.name,initials:Oe.initials,color:Oe.color}));g?.(me.id,{assignees:oe.length>0?oe:void 0});}})});case "status":if(B){let U=me.progress===100?"\u2713":me.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:U})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(fu,{status:me.status||"todo",onChange:U=>{g?.(me.id,{status:U,progress:U==="completed"?100:me.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:B?.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:`${me.progress}%`,backgroundColor:me.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:[me.progress,"%"]})]});case "priority":let gt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ot={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ht=gt[me.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(So,{priority:Ht,onChange:U=>{U&&g?.(me.id,{priority:Ot[U]||"medium"});}})});default:return null}},St=ae=>[{id:"hide",label:"Hide Column",icon:Kt.Hide,onClick:()=>d(ae),disabled:ae==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Kt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Kt.SortDesc,onClick:()=>{}}],Re=ae=>ae.subtasks&&ae.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{T?.(ae.id);}},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{x?.([ae.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{S?S(ae.id,ae.name):f?.([ae.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Kt.Pencil,onClick:()=>{n?.(ae);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{T?.(ae.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Kt.MarkIncomplete,onClick:()=>{g?.(ae.id,{status:"todo",progress:0});},disabled:ae.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Kt.SetInProgress,onClick:()=>{g?.(ae.id,{status:"in-progress"});},disabled:ae.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Kt.MarkComplete,onClick:()=>{g?.(ae.id,{status:"completed",progress:100});},disabled:ae.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{x?.([ae.id]);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Kt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{S?S(ae.id,ae.name):f?.([ae.id]);}}],Ae=c.filter(ae=>ae.visible),ot=Ae.reduce((ae,me)=>ae+me.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ot},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ne}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ae.map((ae,me)=>{let b=me===Ae.length-1,B=ae.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${B?"":"justify-center"}`,style:{width:`${ae.width}px`,minWidth:`${ae.minWidth??(B?200:60)}px`,maxWidth:`${ae.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:b?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:H=>{H.preventDefault(),Me({isOpen:true,x:H.clientX,y:H.clientY,type:"header",columnId:ae.id});},onMouseEnter:H=>{H.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:H=>{H.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:ae.label,children:ae.label}),ae.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:M===ae.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:H=>{H.preventDefault(),H.stopPropagation(),V(ae.id),We(H.clientX),te(ae.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"}})})]},ae.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:d,theme:t}),jsx("button",{onClick:()=>Y(!D),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"})}),D&&jsxs("div",{ref:ie,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:ae=>ae.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:()=>Y(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:Ge},children:Be.map(({task:ae,level:me},b)=>{let B=ee(ae.id),H=De===ae.id,_=H&&Z==="above",ne=H&&Z==="below",he=H&&Z==="child",J={};return he&&(J.backgroundColor=`${t.accent}15`,J.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":ae.id,className:`flex items-center cursor-pointer group ${be===ae.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:B?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:B?t.accentLight:he?`${t.accent}15`:b%2===0?t.bgPrimary:t.bgGrid,opacity:O?ae.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...J},onMouseEnter:()=>E(ae.id),onMouseLeave:()=>E(null),onClick:de=>{let Ke=fn(e).map(Ht=>Ht.id),Ot=navigator.platform.toUpperCase().indexOf("MAC")>=0?de.metaKey:de.ctrlKey;W(ae.id,Ke,Ot,de.shiftKey),s?.(ae);},onDoubleClick:de=>{de.stopPropagation(),n?.(ae);},onContextMenu:de=>{de.preventDefault(),Me({isOpen:true,x:de.clientX,y:de.clientY,type:"task",task:ae}),l?.(ae,de);},whileHover:{backgroundColor:B?t.accentLight:t.hoverBg},children:[_&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ne&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ae.map((de,_e)=>{let Ke=_e===Ae.length-1,gt=de.id==="name";return jsx("div",{className:`px-4 flex items-center ${gt?"justify-start":"justify-center"}`,style:{width:`${de.width}px`,minWidth:`${de.minWidth??(gt?200:60)}px`,maxWidth:`${de.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ke?"none":`1px solid ${K===ae.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:lt(de,ae,gt?me:0)},`${ae.id}-${de.id}`)})]},ae.id)})}),jsx(gn,{isOpen:X.isOpen,x:X.x,y:X.y,items:X.type==="header"&&X.columnId?St(X.columnId):X.type==="task"&&X.task?Re(X.task):[],onClose:()=>Me({...X,isOpen:false}),theme:t}),ut&&wt&&be&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:wt.x+12,top:wt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ae=Be.find(me=>me.task.id===be)?.task;return ae?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:ae.name})}):null})()}),document.body)]})}function Yp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[u,i]=useState(t),[c,d]=useState(null),[p,g]=useState(null),[h,y]=useState(null),[v,f]=useState(null),[x,k]=useState(0),[w,T]=useState(0),[C,S]=useState(null),[N,I]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:u,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:h,setActiveZone:y,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:x,setDraggedSegmentStartX:k,segmentDragOffsetX:w,setSegmentDragOffsetX:T,hoveredSegmentIndex:C,setHoveredSegmentIndex:S,isHovered:N,setIsHovered:I,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ce,L)=>{r("none"),d(null),g(null),l(ce),i(L),T(0),f(null),k(0);}}}function ii({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:u,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:h,onHoverChange:y,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:x=true,readOnly:k=false}){let w=Yp(t,r),T=useRef(null),C=useRef(false),S=useRef(null),N=useRef(null),{dragMode:I,setDragMode:O,dragOffset:A,setDragOffset:K,ghostX:E,setGhostX:ce,ghostWidth:L,setGhostWidth:q,connectionLine:Ce,setConnectionLine:je,hoveredTaskId:M,setHoveredTaskId:V,activeZone:fe,setActiveZone:We,draggedSegmentIndex:z,setDraggedSegmentIndex:te,draggedSegmentStartX:X,setDraggedSegmentStartX:Me,segmentDragOffsetX:be,setSegmentDragOffsetX:$e,hoveredSegmentIndex:De,setHoveredSegmentIndex:Xe,isHovered:Z,setIsHovered:Je,isDragging:ue,isResizing:Qe,isConnecting:ct,resetDragState:wt}=w,ye=18,ut=!!o.executionBarBg,tt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",qe=ut?3:6,$=e.subtasks&&e.subtasks.length>0,se=e.endDate&&(()=>{let b=new Date;b.setHours(0,0,0,0);let B=new Date(e.endDate);return B.setHours(0,0,0,0),B<b})()&&e.progress<100,D=x&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,we={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=x&&e.isCriticalPath||se?"#EF4444":e.color?e.color:e.priority&&we[e.priority]?we[e.priority]:o.taskBarPrimary,Le=k?"default":ue?ct?"crosshair":Qe?"ew-resize":"grabbing":"grab",Te=k?"default":"ew-resize",Ne=(b=>b>=80?20:b>=60?15:b>=50?12:10)(r),Ge=r<50,pt=r<40;useEffect(()=>{y&&(!Z||ue||e.segments)&&y(null);},[Z,ue,e.segments,y]);let it=b=>b.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),at=()=>{let b=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${b} day${b!==1?"s":""}`},Ze=b=>Math.round(b/s)*s,At=b=>{let B=Math.round(b/s),H=new Date(n);return H.setDate(H.getDate()+B),H},Dt=(b,B)=>{for(let H of g){if(H.id===e.id)continue;let _=5;if(b>=H.x-_&&b<=H.x+H.width+_&&B>=H.y-_&&B<=H.y+H.height+_)return H.id}return null},mt=useCallback((b,B,H)=>{if(k)return;b.preventDefault(),b.stopPropagation();let _=T.current?.ownerSVGElement;if(!_)return;let ne=_.createSVGPoint();ne.x=b.clientX,ne.y=b.clientY;let he=ne.matrixTransform(_.getScreenCTM()?.inverse()),J=H!==void 0?H:t,de=B;if(!de){let _e=he.x-J;b.shiftKey?(de="connect",je({x:t+r,y:a+ye/2})):b.ctrlKey||b.metaKey?de="move":b.altKey?de=_e<r/2?"resize-start":"resize-end":pt?_e<r/2?de="move":de="resize-end":Ge?_e<=Ne/2?de="resize-start":_e>=r-Ne/2?de="resize-end":de="move":_e<=Ne?de="resize-start":_e>=r-Ne?de="resize-end":de="move";}C.current=false,O(de),Je(false),We(null),de==="move"?K(he.x-J):de==="connect"?je({x:t+r,y:a+ye/2}):K(0),ce(J),q(r);},[t,r,a,ye,k]),bt=useCallback(b=>{let B=T.current?.ownerSVGElement;if(!B)return;let H=B.closest(".gantt-timeline-scroll");if(!H)return;let _=H.getBoundingClientRect(),ne=60,he=15,J=0;if(b.clientX<_.left+ne){let de=_.left+ne-b.clientX;J=-Math.min(he,de/2);}else if(b.clientX>_.right-ne){let de=b.clientX-(_.right-ne);J=Math.min(he,de/2);}return J!==0&&(H.scrollLeft+=J),J!==0},[]),lt=useCallback(b=>{if(I==="none")return;C.current=true,N.current=b;let B=T.current?.ownerSVGElement;if(!B)return;if(I==="move"||I==="resize-start"||I==="resize-end"){let ne=bt(b);ne&&!S.current?S.current=window.setInterval(()=>{N.current&&(bt(N.current),lt(N.current));},16):!ne&&S.current&&(window.clearInterval(S.current),S.current=null);}let H=B.createSVGPoint();H.x=b.clientX,H.y=b.clientY;let _=H.matrixTransform(B.getScreenCTM()?.inverse());if(I==="connect"){je({x:_.x,y:_.y});let ne=Dt(_.x,_.y);V(ne);}else if(I==="move"){let ne=_.x-A,he=Ze(ne);ce(he),q(r);let J=Math.round((he-t)/s);if(h?.(e.id,J,true),e.segments&&e.segments.length>0&&z!==null){let de=he-X;$e(de);}}else if(I==="resize-start"){let ne=_.x,he=Ze(ne),J=t+r-he;J>=s&&(ce(he),q(J));}else if(I==="resize-end"){let ne=_.x,J=Ze(ne)-t;J>=s&&q(J);}},[I,t,r,s,A,e,Ze,z,X,Dt,V,je,ce,q,$e,h,bt]),St=useCallback(()=>{if(S.current&&(window.clearInterval(S.current),S.current=null),N.current=null,I!=="none"){if(I==="connect")M&&p&&p(e,M),je(null),V(null);else {let b=e.endDate.getTime()-e.startDate.getTime(),B,H,_=true;if(I==="move"){if(B=At(E),H=new Date(B.getTime()+b),e.segments&&e.segments.length>0&&z!==null){let ne=Math.round(be/s),he=e.segments.map((Ke,gt)=>{if(gt===z){let Ot=new Date(Ke.startDate),Ht=new Date(Ke.endDate);return Ot.setDate(Ot.getDate()+ne),Ht.setDate(Ht.getDate()+ne),{startDate:Ot,endDate:Ht}}return Ke}),J=he.flatMap(Ke=>[Ke.startDate,Ke.endDate]),de=new Date(Math.min(...J.map(Ke=>Ke.getTime()))),_e=new Date(Math.max(...J.map(Ke=>Ke.getTime())));d?.({...e,segments:he},de,_e),wt(t,r);return}}else I==="resize-start"?(B=At(E),H=e.endDate,B>H&&(console.warn("Invalid date range: start date must be before or equal to end date"),_=false)):I==="resize-end"?(B=e.startDate,H=At(E+L),H.setDate(H.getDate()-1),H<B&&(console.warn("Invalid date range: end date must be after or equal to start date"),_=false)):_=false;_&&B&&H&&(H.getTime()<B.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,B,H));}h?.(e.id,0,false),wt(t,r);}},[I,E,L,e,d,M,p,t,r,s,At,be,z,wt,h]);useEffect(()=>{if(I==="none")return;let b=H=>{lt(H);},B=()=>{St();};return window.addEventListener("mousemove",b),window.addEventListener("mouseup",B),()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",B),S.current&&(window.clearInterval(S.current),S.current=null);}},[I,lt,St]);let Re=ue&&!ct?E:t,Ae=ue&&!ct?L:r,ot=l.taskClass(e),ae=24,me=x?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:T,"data-task-bar":"true",style:{opacity:me,transition:"opacity 300ms ease"},onClick:()=>{!ue&&!C.current&&u?.(e),C.current=false;},onDoubleClick:b=>{!ue&&!C.current&&(b.stopPropagation(),i?.(e));},onContextMenu:b=>{b.preventDefault(),c?.(e,b);},onMouseEnter:()=>!ue&&Je(true),onMouseMove:b=>{y&&Z&&!ue&&!e.segments&&y({task:e,x:t,y:a,width:r,height:ye,showBelow:false,mouseX:b.clientX,mouseY:b.clientY});},onMouseLeave:()=>{ue||(Je(false),We(null));},children:[jsx("rect",{x:t,y:a,width:r+ae,height:ye,fill:"transparent",style:{pointerEvents:"all"}}),Z&&!ue&&!Ge&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ne,height:ye,fill:fe==="resize-start"?o.accent:"transparent",opacity:fe==="resize-start"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>We("resize-start"),onMouseDown:b=>mt(b,"resize-start")}),jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:ye,fill:fe==="move"?o.accent:"transparent",opacity:fe==="move"?.1:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>We("move"),onMouseDown:b=>mt(b,"move")}),jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:ye,fill:fe==="resize-end"?o.accent:"transparent",opacity:fe==="resize-end"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>We("resize-end"),onMouseDown:b=>mt(b,"resize-end")})]}),Z&&!ue&&pt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ye,fill:fe==="move"?o.accent:"transparent",opacity:fe==="move"?.2:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>We("move"),onMouseDown:b=>mt(b,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ye,fill:fe==="resize-end"?o.accent:"transparent",opacity:fe==="resize-end"?.2:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>We("resize-end"),onMouseDown:b=>mt(b,"resize-end")}),Z&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ye-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ue&&!ct&&!e.segments&&jsx(motion.rect,{x:E,y:a,width:L,height:ye,rx:qe,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"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!ue&&(()=>{let b=e.baselineStartDate.getTime(),B=e.baselineEndDate.getTime(),H=n.getTime(),_=864e5,ne=(b-H)/_,he=(B-b)/_,J=ne*s,de=Math.max(he*s,s),_e=Re+Ae,Ke=J+de,gt=e.endDate?.getTime()??0,Ot=Math.ceil((gt-B)/_),Ht=Ot>0,U=Ot<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:J,y:a,width:de,height:ye,rx:qe,fill:"none",stroke:tt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Ht&&_e>Ke&&jsx("rect",{x:Ke,y:a,width:_e-Ke,height:ye,rx:0,fill:"#EF4444",opacity:.2}),Ht&&jsxs("text",{x:Math.max(_e,Ke)+6,y:a+ye/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ot,"d"]}),U&&jsxs("text",{x:_e+6,y:a+ye/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ot,"d"]})]})})(),!e.segments&&ut&&$&&(()=>{let B=a+(ye-8)/2,H=4,_=e.progress||0,ne=new Date;ne.setHours(0,0,0,0);let he=e.startDate&&ne>=e.startDate,J=e.endDate&&(()=>{let Ht=new Date(e.endDate);return Ht.setHours(0,0,0,0),ne>Ht})(),de=e.startDate&&ne<e.startDate,_e=1;if(he&&e.startDate&&e.endDate&&!de){let Ht=new Date(e.startDate);Ht.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let oe=Math.max(1,(U.getTime()-Ht.getTime())/(1e3*60*60*24)),P=Math.min((ne.getTime()-Ht.getTime())/(1e3*60*60*24),oe)/oe*100;_e=P>0?_/P:1;}let Ke;_>=100?Ke="#00E5CC":de?Ke="#4B5563":J&&_<100?Ke="#EF4444":_e>=.95?Ke="#22C55E":_e>=.8?Ke="#F59E0B":Ke="#EF4444";let gt=Math.max(_/100*Ae,_>0?H*2:0),Ot=Ae>100&&_>0;return jsxs("g",{"data-task-class":ot,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Re,y:B,width:Ae,height:8,rx:H,fill:"rgba(255,255,255,0.10)"}),_>0&&jsx("rect",{x:Re,y:B,width:gt,height:8,rx:H,fill:Ke}),Ot&&jsxs("text",{x:Re+gt+6,y:B+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(_),"%"]})]})})(),!e.segments&&ut&&!$&&jsx(motion.rect,{x:Re,y:a,width:Ae,height:ye,rx:qe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ot,initial:{opacity:0,scale:.95},animate:{opacity:ue&&!ct?.15:e.parentId?.6:1,scale:Z&&!ue?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:b=>mt(b),style:{cursor:Le,pointerEvents:"all"}}),!e.segments&&!ut&&jsx(motion.rect,{x:Re,y:a,width:Ae,height:ye,rx:qe,fill:ee,"data-task-class":ot,initial:{opacity:0,scale:.95},animate:{opacity:ue&&!ct?.15:e.parentId?.6:Z?.9:.8,scale:Z&&!ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:$?void 0:b=>mt(b),style:{cursor:$?"default":Le,pointerEvents:"all"}}),ut&&(se||D)&&!e.segments&&jsx("rect",{x:Re,y:a,width:Ae,height:ye,rx:qe,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&&!$&&jsx("rect",{x:Re,y:a,width:Math.max(Ae*(e.progress/100),qe*2),height:ye,rx:qe,fill:ee,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!$&&e.progress<100&&(()=>{let b=e.progress>0?Ae*(e.progress/100):0,B=Re+b,H=Ae-b,_=e.progress===0?qe:0,ne=e.progress===0?Re:B,he=e.progress===0?Ae:H;return jsxs(Fragment,{children:[jsx("rect",{x:ne,y:a,width:he,height:ye,rx:_,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:ne,y:a,width:he,height:ye,rx:_,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ut&&!e.segments&&e.progress>0&&e.progress<100&&!$&&!ue&&(()=>{let b=Re+Ae*(e.progress/100),B=8,H=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:b,cy:a+ye/2,r:B,fill:H?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:b,y:a+ye/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:H?.initials||H?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((b,B)=>{let H=(b.startDate.getTime()-n.getTime())/864e5*s,ne=(b.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-H+s,he=ue&&I==="move"&&z===B,J=De===B,de=he?H+be:H;return jsxs("g",{onMouseEnter:()=>!ue&&Xe(B),onMouseLeave:()=>!ue&&Xe(null),children:[jsx(motion.rect,{x:de,y:a,width:ne,height:ye,rx:qe,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:he||e.parentId?.6:J?.9:.8,scale:J&&!ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_e=>{_e.stopPropagation(),te(B),Me(H),mt(_e,void 0,H);},style:{cursor:Le,pointerEvents:"all"}}),jsx("rect",{x:de,y:a,width:ne*(e.progress/100),height:ye,rx:qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${B}`)}),Y&&(se||D)&&!e.segments&&jsxs(Fragment,{children:[D&&!se&&jsx("rect",{x:Re,y:a,width:Ae,height:ye,rx:qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsx("rect",{x:Re,y:a,width:Ae,height:ye,rx:qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Ae>60&&!e.segments&&!(ut&&$)&&(()=>{let b=l.taskLabel(e),B=typeof b=="string"?b:e.name,H=B.length>Math.floor(Ae/8)?`${B.substring(0,Math.floor(Ae/8))}...`:B;return jsx("text",{x:Re+8,y:a+ye/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:H})})(),!ue&&!e.segments&&!$&&e.progress>0&&e.progress<100&&(ut?jsxs("text",{x:Re+Ae+6,y:a+ye/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ae>100?jsxs("text",{x:Re+Ae-12,y:a+ye/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&&Ae>80&&!ue&&!e.segments&&!(ut&&$)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Re+Ae-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Re+Ae-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Z||Qe)&&!ct&&!e.segments&&!$&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Re-2,y:a,width:16,height:ye,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>We("resize-start"),onMouseLeave:()=>We(null),onMouseDown:b=>{b.stopPropagation(),mt(b,"resize-start");}}),jsx(motion.rect,{x:Re+4,y:a+8,width:3,height:ye-16,rx:1.5,fill:fe==="resize-start"||I==="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:Re+Ae-14,y:a,width:16,height:ye,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>We("resize-end"),onMouseLeave:()=>We(null),onMouseDown:b=>{b.stopPropagation(),mt(b,"resize-end");}}),jsx(motion.rect,{x:Re+Ae-7,y:a+8,width:3,height:ye-16,rx:1.5,fill:fe==="resize-end"||I==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Z&&!ue&&!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+ye/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>We("connect"),onMouseLeave:()=>We(null),onMouseDown:b=>{b.stopPropagation(),mt(b,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ye/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:fe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ct&&Ce&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ye/2,x2:Ce.x,y2:Ce.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Ce.x,cy:Ce.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsx(motion.text,{x:Ce.x+15,y:Ce.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Ce.x+10},animate:{opacity:1,x:Ce.x+15},transition:{duration:.2},children:"Connect"})]}),(Z||ue)&&!ct&&!e.segments&&jsx(motion.rect,{x:Re-1,y:a-1,width:Ae+2,height:ye+2,rx:qe+1,fill:"none",stroke:ue?o.accent:ut?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:ut?1:2,opacity:ue||ut?.6:.4,initial:{opacity:0},animate:{opacity:ue||ut?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Qe&&jsxs(Fragment,{children:[jsx("line",{x1:E,y1:0,x2:E,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:E+L,y1:0,x2:E+L,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Z&&!ue&&!e.segments&&!y&&(()=>{let H=a<100,_=H?a+ye+13:a-82-13,ne=H?`M ${Re+Ae/2-6} ${a+ye+3} L ${Re+Ae/2} ${a+ye+13} L ${Re+Ae/2+6} ${a+ye+3}`:`M ${Re+Ae/2-6} ${a-13} L ${Re+Ae/2} ${a-3} L ${Re+Ae/2+6} ${a-13}`,he=_+22,J=_+40,de=_+55,_e=_+70,Ke=H?_+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:H?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:H?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Re+Ae/2-120,y:_,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:Re+Ae/2,y:he,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:Re+Ae/2-110,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Re+Ae/2-70,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:it(e.startDate)}),jsx("text",{x:Re+Ae/2-110,y:de,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Re+Ae/2-70,y:de,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:it(e.endDate)}),jsx("text",{x:Re+Ae/2+10,y:J,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Re+Ae/2+65,y:J,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:at()}),jsx("text",{x:Re+Ae/2+10,y:de,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Re+Ae/2+65,y:de,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:Re+Ae/2-110,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Re+Ae/2-50,y:_e,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?"...":""]})]}),!H&&jsx("text",{x:Re+Ae/2,y:Ke,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:pt?"Left: move \u2022 Right: resize":Ge?"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,uv=-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:w}=e,C=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null?155:105,S=k+Jp,N=w+uv-C;S+md>window.innerWidth-bn&&(S=k-md-Jp),S<bn&&(S=bn);let I=N<bn;I&&(N=w+20),N+C>window.innerHeight-bn&&(N=window.innerHeight-bn-C),o({left:S,top:N,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={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"},u=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{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),w=x%60;return k===0?`${w}m`:w===0?`${k}h`:`${k}h ${w}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",h=t.accent||"#3B82F6",y=t.bgSecondary||"#1F2937",v=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:y,border:`1px solid ${v}`,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:l.start,value:s.startDate?u(s.startDate):"N/A",labelColor:d,valueColor:p}),jsx(li,{label:l.duration,value:i(),labelColor:d,valueColor:p}),jsx(li,{label:l.end,value:s.endDate?u(s.endDate):"N/A",labelColor:d,valueColor:p}),jsx(li,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:p})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsx("span",{style:{color:p,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:d},children:[l.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:c(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsx("span",{style:{color:h,fontWeight:600},children:c(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsx("span",{style:{color:p,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); }
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
358
358
  </Calendars>
359
359
  <Tasks>${u}
360
360
  </Tasks>
361
- </Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Fe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?Fe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let h=t.find(y=>y.id===g);if(h){o(h);let y=r.get(g)?.ef||0;d=Math.max(d,y);}}let p=d+c;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?Fe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(h=>h.dependencies&&h.dependencies.includes(i.id)),p=s;if(d.length>0)for(let h of d){l(h);let y=n.get(h.id)?.ls||0;p=Math.min(p,y);}let g=p-c;n.set(i.id,{ls:g,lf:p});};a.forEach(l);let u=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let p=d.ls-c.es;Math.abs(p)<.01&&u.push(i.id);}}return u},calculateCriticalPathFull:e=>{let t=new Map,r=Fe.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(r.length===0)return t;let o=new Map(r.map(p=>[p.id,p])),s=new Map;for(let p of r)s.has(p.id)||s.set(p.id,[]);for(let p of r)if(p.dependencies){for(let g of p.dependencies)if(o.has(g)){let h=s.get(g);h&&h.push(p.id);}}let n=new Map;for(let p of r)n.set(p.id,0);for(let p of r)if(p.dependencies)for(let g of p.dependencies)o.has(g)&&n.set(p.id,(n.get(p.id)||0)+1);let l=new Map,u=[],i=[];for(let p of r)(n.get(p.id)||0)===0&&i.push(p.id);for(;i.length>0;){let p=i.shift();u.push(p);let g=o.get(p);if(!g||!g.startDate||!g.endDate)continue;let h=Fe.calculateDuration(g.startDate,g.endDate),y=0;if(g.dependencies)for(let f of g.dependencies){let x=l.get(f);x&&(y=Math.max(y,x.ef));}l.set(p,{es:y,ef:y+h});let v=s.get(p)||[];for(let f of v){let x=(n.get(f)||1)-1;n.set(f,x),x===0&&i.push(f);}}if(u.length<r.length)return t;let c=Math.max(...Array.from(l.values()).map(p=>p.ef)),d=new Map;for(let p=u.length-1;p>=0;p--){let g=u[p];if(!g)continue;let h=o.get(g);if(!h||!h.startDate||!h.endDate)continue;let y=Fe.calculateDuration(h.startDate,h.endDate),v=s.get(g)||[],f=c;if(v.length>0)for(let x of v){let k=d.get(x);k&&(f=Math.min(f,k.ls));}d.set(g,{ls:f-y,lf:f});}for(let p of u){let g=l.get(p),h=d.get(p),y=h.ls-g.es,v=s.get(p)||[],f;v.length>0?f=Math.min(...v.map(x=>l.get(x).es))-g.ef:f=c-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:h.ls,lateFinish:h.lf,totalFloat:Math.round(y*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:y<=.01});}return t},calculateSlack:(e,t)=>{let a=Fe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Fe.calculateCriticalPath(e).includes(t))return 0;let o=Fe.getDependentTasks(e,t);if(o.length===0){let l=Fe.getLatestEndDate(e);if(!l)return null;let u=Fe.calculateDuration(a.endDate,l);return Math.max(0,u)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,u)=>l-u)[0];if(!s)return null;let n=Fe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Fe.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=Fe.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Fe.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let u of n){if(o.has(u.id)||!u.startDate||!u.endDate)continue;let i=Fe.calculateDuration(u.startDate,u.endDate),c;if(a!==void 0?(c=new Date(u.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 d=Fe.calculateEndDate(c,i),p=g=>g.map(h=>h.id===u.id?{...h,startDate:c,endDate:d}:h.subtasks?{...h,subtasks:p(h.subtasks)}:h);l=p(l),l=Fe.autoScheduleDependents(l,u.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let u=[],i=o.getTime(),c=1e3*60*60*24,d=Fe.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,h,y=new Set)=>{if(y.has(g))return;y.add(g);let v=Fe.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let x=r.findIndex(A=>A.id===f.id);if(x===-1)continue;let k=f.startDate.getTime(),T=(f.endDate.getTime()-k)/c,S=(k-i)/c*s,N=S+h*s,I=Math.max(T*s,s),O=l+x*n+(n-18)/2;u.push({taskId:f.id,taskName:f.name,originalX:S,previewX:N,width:I,y:O,rowIndex:x,daysDelta:h,color:f.color}),p(f.id,h,y);}};return p(t,a),u},splitTask:(e,t,a,r=3)=>{let o=Fe.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 l=new Date(o.endDate);l.setDate(l.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:u}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function gi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:u,dependencyLineStyle:i="curved",showTaskBarLabels:c=true,onTaskClick:d,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:h,onDependencyCreate:y,onDependencyDelete:v,showBaseline:f,showCriticalPath:x=true,showDependencies:k=true,highlightWeekends:w=true,canEditTask:T}){let S=Er(),N=useRef(null),[I,O]=useState([]),[A,K]=useState(null),[E,ce]=useState(null),[L,q]=useState(null),Ce=useRef(false),[je,M]=useState(new Set),[V,fe]=useState(null),We=useCallback($=>{if(L&&!Ce.current){let se=$.target,D=false;for(;se&&se!==$.currentTarget;){if(se.getAttribute?.("data-dependency-line")==="true"||se.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}se=se.parentElement;}D||q(null);}},[L]),z=useCallback($=>{ce($);},[]),te=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),X=r==="day"?60:r==="week"?20:8,Me=te*X*n,be=$=>{let se=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),D=se.getUTCDay()||7;se.setUTCDate(se.getUTCDate()+4-D);let Y=new Date(Date.UTC(se.getUTCFullYear(),0,1));return Math.ceil(((se.getTime()-Y.getTime())/864e5+1)/7)},$e=$=>{let se=$.getDay();return se===0||se===6},De=useCallback($=>{let se=Math.round($/(X*n)),D=new Date(o);return D.setDate(D.getDate()+se),D},[o,X,n]),Xe=useCallback(($,se)=>{if(se.startDate&&se.endDate)return;let D=$.currentTarget.ownerSVGElement;if(!D)return;let Y=D.createSVGPoint();Y.x=$.clientX,Y.y=$.clientY;let ie=Y.matrixTransform(D.getScreenCTM()?.inverse()),we=De(ie.x),W=new Date(we);W.setDate(W.getDate()+1),fe(null),h?.(se,we,W);},[De,h]),Z=useCallback(($,se,D)=>{let Y=$.currentTarget.ownerSVGElement;if(!Y)return;let ie=Y.createSVGPoint();ie.x=$.clientX,ie.y=$.clientY;let we=ie.matrixTransform(Y.getScreenCTM()?.inverse()),W=De(we.x),Le=Math.round(we.x/(X*n))*X*n;fe({taskId:se.id,x:Le,y:D*a+a/2,date:W});},[De,X,n,a]),Je=useCallback(()=>{fe(null);},[]),ue=useMemo(()=>{let $=ie=>ie.map(we=>{if(we.subtasks&&we.subtasks.length>0){let W=$(we.subtasks),ee=W.filter(Le=>Le.startDate&&Le.endDate);if(ee.length>0){let Le=ee.map(Ge=>Ge.startDate.getTime()),Te=ee.map(Ge=>Ge.endDate.getTime()),Be=new Date(Math.min(...Le)),Ne=new Date(Math.max(...Te));return {...we,subtasks:W,startDate:Be,endDate:Ne}}return {...we,subtasks:W}}return we}),se=(ie,we=[])=>{let W=[...ie].sort((ee,Le)=>(ee.position??0)-(Le.position??0));for(let ee of W)we.push(ee),ee.subtasks&&ee.subtasks.length>0&&(ee.isExpanded===void 0||ee.isExpanded)&&se(ee.subtasks,we);return we},D=$(e);return se(D)},[e]),Qe=useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let se=$.startDate.getTime(),D=$.endDate.getTime(),Y=o.getTime(),ie=(se-Y)/(1e3*60*60*24),we=(D-se)/(1e3*60*60*24)+1,W=ie*X*n,ee=Math.max(X*n,40),Le=Math.max(we*X*n,ee);return {x:W,width:Le}},[o,X,n]),ct=useMemo(()=>ue.filter($=>$.startDate&&$.endDate).map($=>{let{x:se,width:D}=Qe($),ie=ue.findIndex(we=>we.id===$.id)*a+(a-18)/2;return {id:$.id,x:se,y:ie,width:D,height:18}}),[ue,Qe]),wt=useCallback(($,se,D)=>{if(!D){O([]),K(null);return}if(K({taskId:$,daysDelta:se}),se===0){O([]);return}let Y=Fe.calculateCascadePreview(e,$,se,ue,o,X*n,a,48);O(Y);},[e,ue,o,X,n,a,48]),ye=useCallback(($,se)=>{if(!A)return se;let D=X*n,Y=A.daysDelta*D;if($===A.taskId)return {x:se.x+Y,width:se.width};let ie=I.find(we=>we.taskId===$);return ie?{x:ie.previewX,width:ie.width}:se},[A,I,X,n]),ut=useMemo(()=>{let $=[],se=new Date(o);for(;se<=s;){let ie=(se.getTime()-o.getTime())/864e5*X*n;if(r==="day")$.push({date:new Date(se),label:se.toLocaleDateString(l,{day:"numeric",month:"short"}),x:ie}),se.setDate(se.getDate()+1);else if(r==="week"){let we=be(se);$.push({date:new Date(se),label:`${S.labels.week} ${we}`,x:ie}),se.setDate(se.getDate()+7);}else $.push({date:new Date(se),label:se.toLocaleDateString(l,{month:"short",year:"numeric"}),x:ie}),se.setMonth(se.getMonth()+1);}return $},[o,s,r,X,n,l,S.labels.week]),tt=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*X*n,[o,X,n]),qe=Math.max(ue.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(Me,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Me,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),ut.map(($,se)=>jsxs("g",{children:[se>0&&jsx("line",{x1:$.x,y1:0,x2:$.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:$.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:$.label})]},`header-${se}`)),tt>=0&&tt<=Me&&jsxs("g",{children:[jsx("circle",{cx:tt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:tt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${tt-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:S.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:N,width:Math.max(Me,1e3),height:qe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:We,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(Me,1e3),height:qe,fill:t.bgPrimary}),ue.map(($,se)=>jsx("rect",{x:0,y:se*a,width:Math.max(Me,1e3),height:a,fill:se%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${$.id}`)),ut.map(($,se)=>se>0?jsx("line",{x1:$.x,y1:0,x2:$.x,y2:ue.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${se}`):null),w&&ut.map(($,se)=>{let D=ut[se+1]?.x||Me;return $e($.date)?jsxs("g",{children:[jsx("rect",{x:$.x,y:0,width:D-$.x,height:ue.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:$.x,y:0,width:D-$.x,height:ue.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${se}`):null}),ue.map(($,se)=>{let D=$.startDate&&$.endDate;return jsx("g",{children:!D&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:se*a,width:Me,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>Xe(Y,$),onMouseMove:Y=>Z(Y,$,se),onMouseLeave:()=>{Je();}},`clickable-${$.id}`),V&&V.taskId===$.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:V.x,y1:se*a+4,x2:V.x,y2:se*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}, ${se*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(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!V||V.taskId!==$.id)&&jsx("text",{x:tt>0?tt:100,y:se*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:S.labels.clickToSetDates},`placeholder-${$.id}`)]})},`row-group-${$.id}`)}),ue.map(($,se)=>{if(!$.startDate||!$.endDate)return null;let{x:D,width:Y}=Qe($),ie=se*a+(a-18)/2,we=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;if($.isMilestone)return jsx(pi,{task:$,x:D+Y/2,y:ie+12,theme:t,onClick:d},$.id);if(we){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ee=8,Le=ie+(a-18)/2+(18-ee)/2,Te=4,Be=$.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Ge=$.startDate&&Ne>=$.startDate,pt=$.endDate&&(()=>{let lt=new Date($.endDate);return lt.setHours(0,0,0,0),Ne>lt})(),it=$.startDate&&Ne<$.startDate,at=1;if(Ge&&$.startDate&&$.endDate&&!it){let lt=new Date($.startDate);lt.setHours(0,0,0,0);let St=new Date($.endDate);St.setHours(0,0,0,0);let Re=Math.max(1,(St.getTime()-lt.getTime())/(1e3*60*60*24)),ot=Math.min((Ne.getTime()-lt.getTime())/(1e3*60*60*24),Re)/Re*100;at=ot>0?Be/ot:1;}let Ze;Be>=100?Ze="#00E5CC":it?Ze="#4B5563":pt&&Be<100?Ze="#EF4444":at>=.95?Ze="#22C55E":at>=.8?Ze="#F59E0B":Ze="#EF4444";let At=Math.max(Be/100*Y,Be>0?Te*2:0),Dt=Y>100&&Be>0,mt=$.isCriticalPath;return jsxs("g",{onClick:()=>d?.($),onContextMenu:lt=>{lt.preventDefault(),lt.stopPropagation(),g?.($,lt);},onMouseMove:lt=>{z({task:$,x:D,y:Le,width:Y,height:ee,showBelow:Le<100,mouseX:lt.clientX,mouseY:lt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:x?mt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:D,y:ie,width:Y,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:D,y:Le,width:Y,height:ee,rx:Te,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Be>0&&jsx("rect",{x:D,y:Le,width:At,height:ee,rx:Te,fill:Ze}),x&&mt&&jsx("rect",{x:D,y:Le,width:Y,height:ee,rx:Te,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Dt&&jsxs("text",{x:D+At+6,y:Le+ee/2,dominantBaseline:"central",fill:W?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(Be),"%"]})]},$.id)}return jsx(ii,{task:$,x:D,y:ie,width:Y,theme:t,dayWidth:X*n,startDate:o,templates:u,onClick:d,onDoubleClick:p,onContextMenu:g,onDateChange:h,onDependencyCreate:y,allTaskPositions:ct,onDragMove:wt,onHoverChange:z,showBaseline:f,showTaskBarLabels:c,showCriticalPath:x,readOnly:T?!T($):false},$.id)}),k&&ue.map(($,se)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(D=>{let Y=ue.find(Ze=>Ze.id===D);if(!Y||!Y.startDate||!Y.endDate)return null;let ie=ue.findIndex(Ze=>Ze.id===D),we=ye(Y.id,Qe(Y)),W=ye($.id,Qe($)),ee=we.x+we.width,Le=ie*a+26,Te=W.x,Be=se*a+26,Ne=`dep-${D}-${$.id}`;if(je.has(Ne))return null;let Ge=x&&$.isCriticalPath&&Y.isCriticalPath;return jsx(qn,{x1:ee,y1:Le,x2:Te,y2:Be,theme:t,lineStyle:i,colorOverride:x?Ge?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:x?Ge?2:1:void 0,glowFilter:Ge?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>v?.($.id,D),onHoverChange:Ze=>{Ce.current=Ze,Ze&&q({key:Ne,fromId:D,toId:$.id,exitX:ee,exitY:Le,enterX:Te,enterY:Be});}},Ne)})),I.map($=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:$.previewX,y:$.y-48,width:$.width,height:18,rx:6,fill:$.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs($.daysDelta)>0&&jsx("text",{x:$.previewX+$.width/2,y:$.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:$.daysDelta>0?`+${$.daysDelta}d`:`${$.daysDelta}d`})]},`cascade-preview-${$.taskId}`)),k&&L&&jsx(qn,{x1:L.exitX,y1:L.exitY,x2:L.enterX,y2:L.enterY,theme:t,lineStyle:i,onDelete:()=>{let $=L.key;q(null),Ce.current=false,M(se=>new Set(se).add($)),v?.(L.toId,L.fromId);},hoverOverlayOnly:true,onHoverChange:$=>{Ce.current=$,$||q(null);}},`${L.key}-hover-overlay`),tt>=0&&tt<=Me&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:tt,y1:0,x2:tt,y2:qe,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:tt,y1:0,x2:tt,y2:qe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),E&&jsx(Qp,{tooltipData:E,theme:t,locale:l==="es"?"es":"en"})]})}var fv=['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"})}),bv=()=>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"})}),hv=()=>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"})}),yv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),xv=()=>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:l,onDependencyDelete:u}){let[i,c]=useState(false),[d,p]=useState(false),[g,h]=useState([]),[y,v]=useState(""),[f,x]=useState(false),[k,w]=useState(true),[T,C]=useState(""),[S,N]=useState(-1),[I,O]=useState(false),[A,K]=useState(0),E=useRef(null),ce=useRef(null),L=useRef(null),q=useRef(null),{enabled:Ce=true,placeholder:je='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:V,suggestions:fe=fv,maxHistory:We=50,persistHistory:z,mentionableUsers:te=[]}=a,X=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Me=X?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",be=X?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",$e=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)",De=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Xe=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Z=X?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Je=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",ue=X?"rgba(46, 148, 255, 0.9)":"#2E94FF",Qe=X?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ct=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",wt=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)",ye=X?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",ut=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",tt=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",qe=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",$=X?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",se=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)",Y=X?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ie=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",we="rgba(46, 148, 255, 0.04)",W=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",ee=X?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Le=X?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Te=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Be=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)",Ge=X?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",pt=X?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",it="rgba(46, 148, 255, 0.06)",at=X?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ze=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",At=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Dt=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",mt=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",bt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",lt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",St=X?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Re=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ae=X?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ot=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ae=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ge=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",b=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",B=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=z?.storageKey||"gantt-ai-history",_=z?.maxMessages??5,ne=te.filter(U=>{if(!T)return true;let oe=T.toLowerCase();return U.name.toLowerCase().includes(oe)||U.email&&U.email.toLowerCase().includes(oe)}).slice(0,5),he=useCallback(U=>{if(v(U),te.length===0)return;let oe=E.current;if(!oe)return;let Oe=oe.selectionStart||U.length,P=U.slice(0,Oe),me=P.lastIndexOf("@");if(me>=0&&((me>0?P[me-1]:" ")===" "||me===0)){let Ye=P.slice(me+1);if(Ye.length<=40){C(Ye),N(me),O(true),K(0);return}}O(false),C(""),N(-1);},[te.length]),J=useCallback(U=>{let oe=y.slice(0,S),Oe=y.slice(S+1+T.length),P=`${oe}@${U.name} ${Oe}`;v(P),O(false),C(""),N(-1),setTimeout(()=>E.current?.focus(),0);},[y,S,T]),de=useCallback(U=>{if(!I||ne.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),K(oe=>oe<ne.length-1?oe+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),K(oe=>oe>0?oe-1:ne.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let oe=ne[A];return oe&&J(oe),true}return U.key==="Escape"?(O(false),true):false},[I,ne,A,J]);useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(H);if(U){let Oe=JSON.parse(U).map(P=>({...P,timestamp:new Date(P.timestamp)}));h(Oe.slice(-_));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,H,_]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(oe=>!oe.isLoading).slice(-_);localStorage.setItem(H,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,H,_]),useEffect(()=>{ce.current&&ce.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!d&&E.current&&setTimeout(()=>E.current?.focus(),100);},[i,d]);let _e=useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&u?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,u]),Ke=useCallback(async U=>{if(!U.trim()||f)return;let oe={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};h(P=>[...P.slice(-(We-1)),oe]),v(""),w(false),x(true);let Oe={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};h(P=>[...P,Oe]);try{if(V){let P=await V(U,e);h(me=>{let He=me.filter(qt=>!qt.isLoading),Ye={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...He,Ye]}),_e(P);}else h(P=>[...P.filter(He=>!He.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(P){h(me=>[...me.filter(Ye=>!Ye.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{x(false);}},[f,We,V,e,_e]),gt=U=>{U.preventDefault(),Ke(y);},Ot=U=>{v(U),E.current?.focus();};if(useEffect(()=>{let U=oe=>{(oe.metaKey||oe.ctrlKey)&&oe.key==="k"&&(oe.preventDefault(),c(Oe=>!Oe),i||p(false)),oe.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=Oe=>{let P=Oe.target;L.current&&!L.current.contains(P)&&c(false);},oe=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(oe),document.removeEventListener("mousedown",U);}},[i]),!Ce)return null;let Ht={"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(Bt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Ht[M]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Me,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${be}`,color:"#2E94FF",cursor:"pointer",boxShadow:$e,overflow:"visible"},onClick:()=>c(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${De}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Xe}`,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:ue,background:Z,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Je}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
361
+ </Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Fe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?Fe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let h=t.find(y=>y.id===g);if(h){o(h);let y=r.get(g)?.ef||0;d=Math.max(d,y);}}let p=d+c;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?Fe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(h=>h.dependencies&&h.dependencies.includes(i.id)),p=s;if(d.length>0)for(let h of d){l(h);let y=n.get(h.id)?.ls||0;p=Math.min(p,y);}let g=p-c;n.set(i.id,{ls:g,lf:p});};a.forEach(l);let u=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let p=d.ls-c.es;Math.abs(p)<.01&&u.push(i.id);}}return u},calculateCriticalPathFull:e=>{let t=new Map,r=Fe.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(r.length===0)return t;let o=new Map(r.map(p=>[p.id,p])),s=new Map;for(let p of r)s.has(p.id)||s.set(p.id,[]);for(let p of r)if(p.dependencies){for(let g of p.dependencies)if(o.has(g)){let h=s.get(g);h&&h.push(p.id);}}let n=new Map;for(let p of r)n.set(p.id,0);for(let p of r)if(p.dependencies)for(let g of p.dependencies)o.has(g)&&n.set(p.id,(n.get(p.id)||0)+1);let l=new Map,u=[],i=[];for(let p of r)(n.get(p.id)||0)===0&&i.push(p.id);for(;i.length>0;){let p=i.shift();u.push(p);let g=o.get(p);if(!g||!g.startDate||!g.endDate)continue;let h=Fe.calculateDuration(g.startDate,g.endDate),y=0;if(g.dependencies)for(let f of g.dependencies){let x=l.get(f);x&&(y=Math.max(y,x.ef));}l.set(p,{es:y,ef:y+h});let v=s.get(p)||[];for(let f of v){let x=(n.get(f)||1)-1;n.set(f,x),x===0&&i.push(f);}}if(u.length<r.length)return t;let c=Math.max(...Array.from(l.values()).map(p=>p.ef)),d=new Map;for(let p=u.length-1;p>=0;p--){let g=u[p];if(!g)continue;let h=o.get(g);if(!h||!h.startDate||!h.endDate)continue;let y=Fe.calculateDuration(h.startDate,h.endDate),v=s.get(g)||[],f=c;if(v.length>0)for(let x of v){let k=d.get(x);k&&(f=Math.min(f,k.ls));}d.set(g,{ls:f-y,lf:f});}for(let p of u){let g=l.get(p),h=d.get(p),y=h.ls-g.es,v=s.get(p)||[],f;v.length>0?f=Math.min(...v.map(x=>l.get(x).es))-g.ef:f=c-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:h.ls,lateFinish:h.lf,totalFloat:Math.round(y*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:y<=.01});}return t},calculateSlack:(e,t)=>{let a=Fe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Fe.calculateCriticalPath(e).includes(t))return 0;let o=Fe.getDependentTasks(e,t);if(o.length===0){let l=Fe.getLatestEndDate(e);if(!l)return null;let u=Fe.calculateDuration(a.endDate,l);return Math.max(0,u)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,u)=>l-u)[0];if(!s)return null;let n=Fe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Fe.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=Fe.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Fe.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let u of n){if(o.has(u.id)||!u.startDate||!u.endDate)continue;let i=Fe.calculateDuration(u.startDate,u.endDate),c;if(a!==void 0?(c=new Date(u.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 d=Fe.calculateEndDate(c,i),p=g=>g.map(h=>h.id===u.id?{...h,startDate:c,endDate:d}:h.subtasks?{...h,subtasks:p(h.subtasks)}:h);l=p(l),l=Fe.autoScheduleDependents(l,u.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let u=[],i=o.getTime(),c=1e3*60*60*24,d=Fe.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,h,y=new Set)=>{if(y.has(g))return;y.add(g);let v=Fe.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let x=r.findIndex(A=>A.id===f.id);if(x===-1)continue;let k=f.startDate.getTime(),T=(f.endDate.getTime()-k)/c,S=(k-i)/c*s,N=S+h*s,I=Math.max(T*s,s),O=l+x*n+(n-18)/2;u.push({taskId:f.id,taskName:f.name,originalX:S,previewX:N,width:I,y:O,rowIndex:x,daysDelta:h,color:f.color}),p(f.id,h,y);}};return p(t,a),u},splitTask:(e,t,a,r=3)=>{let o=Fe.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 l=new Date(o.endDate);l.setDate(l.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:u}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function gi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:u,dependencyLineStyle:i="curved",showTaskBarLabels:c=true,onTaskClick:d,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:h,onDependencyCreate:y,onDependencyDelete:v,showBaseline:f,showCriticalPath:x=true,showDependencies:k=true,highlightWeekends:w=true,canEditTask:T}){let S=Er(),N=useRef(null),[I,O]=useState([]),[A,K]=useState(null),[E,ce]=useState(null),[L,q]=useState(null),Ce=useRef(false),[je,M]=useState(new Set),[V,fe]=useState(null),We=useCallback($=>{if(L&&!Ce.current){let se=$.target,D=false;for(;se&&se!==$.currentTarget;){if(se.getAttribute?.("data-dependency-line")==="true"||se.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}se=se.parentElement;}D||q(null);}},[L]),z=useCallback($=>{ce($);},[]),te=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),X=r==="day"?60:r==="week"?20:8,Me=te*X*n,be=$=>{let se=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),D=se.getUTCDay()||7;se.setUTCDate(se.getUTCDate()+4-D);let Y=new Date(Date.UTC(se.getUTCFullYear(),0,1));return Math.ceil(((se.getTime()-Y.getTime())/864e5+1)/7)},$e=$=>{let se=$.getDay();return se===0||se===6},De=useCallback($=>{let se=Math.round($/(X*n)),D=new Date(o);return D.setDate(D.getDate()+se),D},[o,X,n]),Xe=useCallback(($,se)=>{if(se.startDate&&se.endDate)return;let D=$.currentTarget.ownerSVGElement;if(!D)return;let Y=D.createSVGPoint();Y.x=$.clientX,Y.y=$.clientY;let ie=Y.matrixTransform(D.getScreenCTM()?.inverse()),we=De(ie.x),W=new Date(we);W.setDate(W.getDate()+1),fe(null),h?.(se,we,W);},[De,h]),Z=useCallback(($,se,D)=>{let Y=$.currentTarget.ownerSVGElement;if(!Y)return;let ie=Y.createSVGPoint();ie.x=$.clientX,ie.y=$.clientY;let we=ie.matrixTransform(Y.getScreenCTM()?.inverse()),W=De(we.x),Le=Math.round(we.x/(X*n))*X*n;fe({taskId:se.id,x:Le,y:D*a+a/2,date:W});},[De,X,n,a]),Je=useCallback(()=>{fe(null);},[]),ue=useMemo(()=>{let $=ie=>ie.map(we=>{if(we.subtasks&&we.subtasks.length>0){let W=$(we.subtasks),ee=W.filter(Le=>Le.startDate&&Le.endDate);if(ee.length>0){let Le=ee.map(Ge=>Ge.startDate.getTime()),Te=ee.map(Ge=>Ge.endDate.getTime()),Be=new Date(Math.min(...Le)),Ne=new Date(Math.max(...Te));return {...we,subtasks:W,startDate:Be,endDate:Ne}}return {...we,subtasks:W}}return we}),se=(ie,we=[])=>{let W=[...ie].sort((ee,Le)=>(ee.position??0)-(Le.position??0));for(let ee of W)we.push(ee),ee.subtasks&&ee.subtasks.length>0&&(ee.isExpanded===void 0||ee.isExpanded)&&se(ee.subtasks,we);return we},D=$(e);return se(D)},[e]),Qe=useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let se=$.startDate.getTime(),D=$.endDate.getTime(),Y=o.getTime(),ie=(se-Y)/(1e3*60*60*24),we=(D-se)/(1e3*60*60*24)+1,W=ie*X*n,ee=Math.max(X*n,40),Le=Math.max(we*X*n,ee);return {x:W,width:Le}},[o,X,n]),ct=useMemo(()=>ue.filter($=>$.startDate&&$.endDate).map($=>{let{x:se,width:D}=Qe($),ie=ue.findIndex(we=>we.id===$.id)*a+(a-18)/2;return {id:$.id,x:se,y:ie,width:D,height:18}}),[ue,Qe]),wt=useCallback(($,se,D)=>{if(!D){O([]),K(null);return}if(K({taskId:$,daysDelta:se}),se===0){O([]);return}let Y=Fe.calculateCascadePreview(e,$,se,ue,o,X*n,a,48);O(Y);},[e,ue,o,X,n,a,48]),ye=useCallback(($,se)=>{if(!A)return se;let D=X*n,Y=A.daysDelta*D;if($===A.taskId)return {x:se.x+Y,width:se.width};let ie=I.find(we=>we.taskId===$);return ie?{x:ie.previewX,width:ie.width}:se},[A,I,X,n]),ut=useMemo(()=>{let $=[],se=new Date(o);for(;se<=s;){let ie=(se.getTime()-o.getTime())/864e5*X*n;if(r==="day")$.push({date:new Date(se),label:se.toLocaleDateString(l,{day:"numeric",month:"short"}),x:ie}),se.setDate(se.getDate()+1);else if(r==="week"){let we=be(se);$.push({date:new Date(se),label:`${S.labels.week} ${we}`,x:ie}),se.setDate(se.getDate()+7);}else $.push({date:new Date(se),label:se.toLocaleDateString(l,{month:"short",year:"numeric"}),x:ie}),se.setMonth(se.getMonth()+1);}return $},[o,s,r,X,n,l,S.labels.week]),tt=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*X*n,[o,X,n]),qe=Math.max(ue.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(Me,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Me,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),ut.map(($,se)=>jsxs("g",{children:[se>0&&jsx("line",{x1:$.x,y1:0,x2:$.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:$.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:$.label})]},`header-${se}`)),tt>=0&&tt<=Me&&jsxs("g",{children:[jsx("circle",{cx:tt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:tt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${tt-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:S.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:N,width:Math.max(Me,1e3),height:qe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:We,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(Me,1e3),height:qe,fill:t.bgPrimary}),ue.map(($,se)=>jsx("rect",{x:0,y:se*a,width:Math.max(Me,1e3),height:a,fill:se%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${$.id}`)),ut.map(($,se)=>se>0?jsx("line",{x1:$.x,y1:0,x2:$.x,y2:ue.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${se}`):null),w&&ut.map(($,se)=>{let D=ut[se+1]?.x||Me;return $e($.date)?jsxs("g",{children:[jsx("rect",{x:$.x,y:0,width:D-$.x,height:ue.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:$.x,y:0,width:D-$.x,height:ue.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${se}`):null}),ue.map(($,se)=>{let D=$.startDate&&$.endDate;return jsx("g",{children:!D&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:se*a,width:Me,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>Xe(Y,$),onMouseMove:Y=>Z(Y,$,se),onMouseLeave:()=>{Je();}},`clickable-${$.id}`),V&&V.taskId===$.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:V.x,y1:se*a+4,x2:V.x,y2:se*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}, ${se*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(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!V||V.taskId!==$.id)&&jsx("text",{x:tt>0?tt:100,y:se*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:S.labels.clickToSetDates},`placeholder-${$.id}`)]})},`row-group-${$.id}`)}),ue.map(($,se)=>{if(!$.startDate||!$.endDate)return null;let{x:D,width:Y}=Qe($),ie=se*a+(a-18)/2,we=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;if($.isMilestone)return jsx(pi,{task:$,x:D+Y/2,y:ie+12,theme:t,onClick:d},$.id);if(we){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ee=8,Le=ie+(a-18)/2+(18-ee)/2,Te=4,Be=$.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Ge=$.startDate&&Ne>=$.startDate,pt=$.endDate&&(()=>{let lt=new Date($.endDate);return lt.setHours(0,0,0,0),Ne>lt})(),it=$.startDate&&Ne<$.startDate,at=1;if(Ge&&$.startDate&&$.endDate&&!it){let lt=new Date($.startDate);lt.setHours(0,0,0,0);let St=new Date($.endDate);St.setHours(0,0,0,0);let Re=Math.max(1,(St.getTime()-lt.getTime())/(1e3*60*60*24)),ot=Math.min((Ne.getTime()-lt.getTime())/(1e3*60*60*24),Re)/Re*100;at=ot>0?Be/ot:1;}let Ze;Be>=100?Ze="#00E5CC":it?Ze="#4B5563":pt&&Be<100?Ze="#EF4444":at>=.95?Ze="#22C55E":at>=.8?Ze="#F59E0B":Ze="#EF4444";let At=Math.max(Be/100*Y,Be>0?Te*2:0),Dt=Y>100&&Be>0,mt=$.isCriticalPath;return jsxs("g",{onClick:()=>d?.($),onContextMenu:lt=>{lt.preventDefault(),lt.stopPropagation(),g?.($,lt);},onMouseMove:lt=>{z({task:$,x:D,y:Le,width:Y,height:ee,showBelow:Le<100,mouseX:lt.clientX,mouseY:lt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:x?mt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:D,y:ie,width:Y,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:D,y:Le,width:Y,height:ee,rx:Te,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Be>0&&jsx("rect",{x:D,y:Le,width:At,height:ee,rx:Te,fill:Ze}),x&&mt&&jsx("rect",{x:D,y:Le,width:Y,height:ee,rx:Te,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Dt&&jsxs("text",{x:D+At+6,y:Le+ee/2,dominantBaseline:"central",fill:W?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(Be),"%"]})]},$.id)}return jsx(ii,{task:$,x:D,y:ie,width:Y,theme:t,dayWidth:X*n,startDate:o,templates:u,onClick:d,onDoubleClick:p,onContextMenu:g,onDateChange:h,onDependencyCreate:y,allTaskPositions:ct,onDragMove:wt,onHoverChange:z,showBaseline:f,showTaskBarLabels:c,showCriticalPath:x,readOnly:T?!T($):false},$.id)}),k&&ue.map(($,se)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(D=>{let Y=ue.find(Ze=>Ze.id===D);if(!Y||!Y.startDate||!Y.endDate)return null;let ie=ue.findIndex(Ze=>Ze.id===D),we=ye(Y.id,Qe(Y)),W=ye($.id,Qe($)),ee=we.x+we.width,Le=ie*a+26,Te=W.x,Be=se*a+26,Ne=`dep-${D}-${$.id}`;if(je.has(Ne))return null;let Ge=x&&$.isCriticalPath&&Y.isCriticalPath;return jsx(qn,{x1:ee,y1:Le,x2:Te,y2:Be,theme:t,lineStyle:i,colorOverride:x?Ge?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:x?Ge?2:1:void 0,glowFilter:Ge?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>v?.($.id,D),onHoverChange:Ze=>{Ce.current=Ze,Ze&&q({key:Ne,fromId:D,toId:$.id,exitX:ee,exitY:Le,enterX:Te,enterY:Be});}},Ne)})),I.map($=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:$.previewX,y:$.y-48,width:$.width,height:18,rx:6,fill:$.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs($.daysDelta)>0&&jsx("text",{x:$.previewX+$.width/2,y:$.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:$.daysDelta>0?`+${$.daysDelta}d`:`${$.daysDelta}d`})]},`cascade-preview-${$.taskId}`)),k&&L&&jsx(qn,{x1:L.exitX,y1:L.exitY,x2:L.enterX,y2:L.enterY,theme:t,lineStyle:i,onDelete:()=>{let $=L.key;q(null),Ce.current=false,M(se=>new Set(se).add($)),v?.(L.toId,L.fromId);},hoverOverlayOnly:true,onHoverChange:$=>{Ce.current=$,$||q(null);}},`${L.key}-hover-overlay`),tt>=0&&tt<=Me&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:tt,y1:0,x2:tt,y2:qe,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:tt,y1:0,x2:tt,y2:qe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),E&&jsx(Qp,{tooltipData:E,theme:t,locale:l==="es"?"es":"en"})]})}var fv=['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"})}),bv=()=>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"})}),hv=()=>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"})}),yv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),xv=()=>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:l,onDependencyDelete:u}){let[i,c]=useState(false),[d,p]=useState(false),[g,h]=useState([]),[y,v]=useState(""),[f,x]=useState(false),[k,w]=useState(true),[T,C]=useState(""),[S,N]=useState(-1),[I,O]=useState(false),[A,K]=useState(0),E=useRef(null),ce=useRef(null),L=useRef(null),q=useRef(null),{enabled:Ce=true,placeholder:je='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:V,suggestions:fe=fv,maxHistory:We=50,persistHistory:z,mentionableUsers:te=[]}=a,X=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Me=X?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",be=X?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",$e=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)",De=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Xe=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Z=X?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Je=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",ue=X?"rgba(46, 148, 255, 0.9)":"#2E94FF",Qe=X?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ct=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",wt=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)",ye=X?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",ut=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",tt=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",qe=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",$=X?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",se=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)",Y=X?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ie=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",we="rgba(46, 148, 255, 0.04)",W=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",ee=X?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Le=X?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Te=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Be=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)",Ge=X?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",pt=X?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",it="rgba(46, 148, 255, 0.06)",at=X?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ze=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",At=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Dt=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",mt=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",bt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",lt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",St=X?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Re=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ae=X?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ot=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ae=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",me=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",b=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",B=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=z?.storageKey||"gantt-ai-history",_=z?.maxMessages??5,ne=te.filter(U=>{if(!T)return true;let oe=T.toLowerCase();return U.name.toLowerCase().includes(oe)||U.email&&U.email.toLowerCase().includes(oe)}).slice(0,5),he=useCallback(U=>{if(v(U),te.length===0)return;let oe=E.current;if(!oe)return;let Oe=oe.selectionStart||U.length,P=U.slice(0,Oe),ge=P.lastIndexOf("@");if(ge>=0&&((ge>0?P[ge-1]:" ")===" "||ge===0)){let Ye=P.slice(ge+1);if(Ye.length<=40){C(Ye),N(ge),O(true),K(0);return}}O(false),C(""),N(-1);},[te.length]),J=useCallback(U=>{let oe=y.slice(0,S),Oe=y.slice(S+1+T.length),P=`${oe}@${U.name} ${Oe}`;v(P),O(false),C(""),N(-1),setTimeout(()=>E.current?.focus(),0);},[y,S,T]),de=useCallback(U=>{if(!I||ne.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),K(oe=>oe<ne.length-1?oe+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),K(oe=>oe>0?oe-1:ne.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let oe=ne[A];return oe&&J(oe),true}return U.key==="Escape"?(O(false),true):false},[I,ne,A,J]);useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(H);if(U){let Oe=JSON.parse(U).map(P=>({...P,timestamp:new Date(P.timestamp)}));h(Oe.slice(-_));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,H,_]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(oe=>!oe.isLoading).slice(-_);localStorage.setItem(H,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,H,_]),useEffect(()=>{ce.current&&ce.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!d&&E.current&&setTimeout(()=>E.current?.focus(),100);},[i,d]);let _e=useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&u?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,u]),Ke=useCallback(async U=>{if(!U.trim()||f)return;let oe={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};h(P=>[...P.slice(-(We-1)),oe]),v(""),w(false),x(true);let Oe={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};h(P=>[...P,Oe]);try{if(V){let P=await V(U,e);h(ge=>{let He=ge.filter(qt=>!qt.isLoading),Ye={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...He,Ye]}),_e(P);}else h(P=>[...P.filter(He=>!He.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(P){h(ge=>[...ge.filter(Ye=>!Ye.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{x(false);}},[f,We,V,e,_e]),gt=U=>{U.preventDefault(),Ke(y);},Ot=U=>{v(U),E.current?.focus();};if(useEffect(()=>{let U=oe=>{(oe.metaKey||oe.ctrlKey)&&oe.key==="k"&&(oe.preventDefault(),c(Oe=>!Oe),i||p(false)),oe.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=Oe=>{let P=Oe.target;L.current&&!L.current.contains(P)&&c(false);},oe=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(oe),document.removeEventListener("mousedown",U);}},[i]),!Ce)return null;let Ht={"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(Bt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Ht[M]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Me,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${be}`,color:"#2E94FF",cursor:"pointer",boxShadow:$e,overflow:"visible"},onClick:()=>c(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${De}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Xe}`,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:ue,background:Z,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Je}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
362
362
  @keyframes ai-fab-pulse {
363
363
  0%, 100% { transform: scale(1); opacity: 0.4; }
364
364
  50% { transform: scale(1.15); opacity: 0; }
365
365
  }
366
- `})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Ht[M]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Qe,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ct}`,boxShadow:wt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ye,borderBottom:`1px solid ${ut}`},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:tt,border:`1px solid ${qe}`,color:"#2E94FF"},children:jsx(tm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:$},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=se;},children:jsx(yv,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=se;},children:jsx(hv,{})})]})]}),jsx(AnimatePresence,{children:!d&&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:ie,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:fe.slice(0,4).map((U,oe)=>jsx("button",{onClick:()=>Ot(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:we,color:ee,border:`1px solid ${W}`},onMouseEnter:Oe=>{Oe.currentTarget.style.borderColor=Le,Oe.currentTarget.style.color="#2E94FF";},onMouseLeave:Oe=>{Oe.currentTarget.style.borderColor=W,Oe.currentTarget.style.color=ee;},children:U.length>30?U.slice(0,30)+"...":U},oe))})]}),g.map(U=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?Te:Ne,color:U.role==="user"?"#2E94FF":pt,border:U.role==="user"?`1px solid ${Be}`:`1px solid ${Ge}`},children:[U.isLoading?jsx(xv,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:U.command.success?"#10B981":"#EF4444",border:`1px solid ${U.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[U.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsx("div",{ref:ce})]}),jsxs("form",{onSubmit:U=>{if(I&&ne.length>0){U.preventDefault();return}gt(U);},className:"p-3 relative",style:{borderTop:`1px solid ${it}`},children:[jsx(AnimatePresence,{children:I&&ne.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:St,border:`1px solid ${Re}`,boxShadow:Ae,backdropFilter:"blur(12px)"},children:ne.map((U,oe)=>jsxs("button",{type:"button",onClick:()=>J(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:oe===A?ot:"transparent",color:ae},onMouseEnter:()=>K(oe),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:b,border:`1px solid ${B}`,color:"#2E94FF"},children:U.name.split(" ").map(Oe=>Oe[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:U.name}),U.email&&jsx("div",{className:"text-xs truncate",style:{color:ge},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:at,border:`1px solid ${Ze}`},children:[jsx("input",{ref:E,type:"text",value:y,onChange:U=>he(U.target.value),onKeyDown:U=>{de(U);},placeholder:je,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:At,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!y.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:y.trim()?Dt:"transparent",color:y.trim()?"#2E94FF":bt,border:y.trim()?`1px solid ${mt}`:"1px solid transparent"},children:jsx(bv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:lt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function am(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,c=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!c)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),u=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function rm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=l?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&u&&n.key==="y"){n.preventDefault(),t();return}if(l&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Cv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Fe.formatDate(e.startDate)} - ${Fe.formatDate(e.endDate)}`);let a=Fe.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=>Fe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function om(e){return {...Cv,...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:l="comfortable",showThemeSelector:u=true,showExportButton:i=true,projectName:c,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:h,persistFilter:y,clearFiltersKey:v,aiAssistant:f,locale:x="en",customTranslations:k,showCreateTaskButton:w=false,createTaskLabel:T,onCreateTask:C,taskFilter:S,onTaskFilterChange:N,toolbarRightContent:I,showBaseline:O,viewMode:A,onViewModeChange:K,projectForecast:E,onThemeChange:ce,onTaskClick:L,onTaskDblClick:q,onTaskContextMenu:Ce,onTaskUpdate:je,onDependentTasksScheduled:M,onProgressChange:V,onTaskEdit:fe,onTaskAddSubtask:We,onTaskMarkIncomplete:z,onTaskSetInProgress:te,onDependencyCreate:X,onDependencyDelete:Me,onBeforeTaskAdd:be,onAfterTaskAdd:$e,onBeforeTaskUpdate:De,onAfterTaskUpdate:Xe,onBeforeTaskDelete:Z,onAfterTaskDelete:Je,permissions:ue,onCopySnapshotLink:Qe}=a,wt=useContext(qs)?.theme,[ye,ut]=useState(wt||s||"dark"),[tt,qe]=useState(n),[$,se]=useState(l),[D,Y]=useState(1),[ie,we]=useState("all"),[W,ee]=useState(A||"execution"),Le=A??W,Te=useCallback(F=>{ee(F),K?.(F);},[K]),Be=O??Le==="oracle",[Ne,Ge]=useState(a.showCriticalPath!==false),[pt,it]=useState(a.showDependencies!==false),[at,Ze]=useState(a.highlightWeekends!==false),At=useCallback(F=>{Ge(F),a.onShowCriticalPathChange?.(F);},[a.onShowCriticalPathChange]),Dt=useCallback(F=>{it(F),a.onShowDependenciesChange?.(F);},[a.onShowDependenciesChange]),mt=useCallback(F=>{Ze(F),a.onHighlightWeekendsChange?.(F);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(tt);},[tt]),useEffect(()=>{a.onZoomChange?.(D);},[D]);let bt=useRef(a.onDateRangeChange);bt.current=a.onDateRangeChange;let lt=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[St,Re]=useState(()=>{if(!y)return "all";try{let F=typeof y=="string"?y:"gantt-filter-state",R=localStorage.getItem(F);if(R){let j=JSON.parse(R);if(j.taskFilter)return j.taskFilter}}catch(F){console.warn("[GanttBoard] Error loading filter state from localStorage:",F);}return "all"}),Ae=S??St,ot=N??Re,[ae,ge]=useState(()=>{if(!y)return false;try{let F=typeof y=="string"?y:"gantt-filter-state",R=localStorage.getItem(F);if(R){let j=JSON.parse(R);if(typeof j.hideCompleted=="boolean")return j.hideCompleted}}catch(F){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",F);}return false});useEffect(()=>{let F=lt();if(F)try{let R={taskFilter:Ae,hideCompleted:ae};localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Ae,ae,lt]);let b=useRef(v);useEffect(()=>{if(b.current!==v&&v!==void 0){Re("all"),ge(false);let F=lt();if(F)try{localStorage.removeItem(F);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}b.current=v;},[v,lt]);let[B,H]=useState(0),[_,ne]=useState(false),[he,J]=useState(null),[de,_e]=useState({isOpen:false,x:0,y:0,task:null}),[Ke,gt]=useState(null),[Ot,Ht]=useState(null);useEffect(()=>{wt&&wt!==ye&&ut(wt);},[wt]),useEffect(()=>{s&&s!==ye&&ut(s);},[s]);let U=useCallback(F=>{ut(F),ce?.(F);},[ce]),{state:oe,setState:Oe,undo:P,redo:me,canUndo:He,canRedo:Ye,clearHistory:qt}=am(t,50),Lt=useMemo(()=>{let F=(R,j=0)=>{let Q=j;for(let xe of R)xe.subtasks?.length&&(Q=Math.max(Q,F(xe.subtasks,j+1)));return Q};return F(oe)+1},[oe]),Da=useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),Ba=useRef(new Map),Ra=useRef(false);if(!Ra.current&&h){Ra.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let R=localStorage.getItem(F);if(R){let j=JSON.parse(R);Array.isArray(j)&&(Ba.current=new Map(j));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let fa=useCallback(()=>{let F=Da();if(F)try{let R=Array.from(Ba.current.entries());localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Da]),ir=useRef(0),Tc=useRef(oe);useEffect(()=>{Tc.current=oe;},[oe]);let _o=useRef(false),Nc=useCallback(F=>{we(F),ir.current+=1,Oe(R=>{let j=(xe,Ee=0)=>xe.map(ht=>{let et=F==="all"||Ee<F-1;return ht.subtasks?.length&&Ba.current.set(ht.id,et),{...ht,isExpanded:et,subtasks:ht.subtasks?j(ht.subtasks,Ee+1):void 0}}),Q=j(R);return fa(),Q});},[Oe,fa]);useEffect(()=>{if(ir.current>0){ir.current-=1;return}let F=j=>{let Q=new Map;for(let xe of j){let Ee=xe.id;Q.get(Ee)||Q.set(Ee,xe);}return Array.from(Q.values())},R=j=>j.map(Q=>{let xe=Ba.current.get(Q.id),Ee=xe!==void 0?{...Q,isExpanded:xe}:Q;if(Ee.subtasks?.length){let ht=F(Ee.subtasks);return {...Ee,subtasks:R(ht)}}return Ee});if(Ba.current.size>0)Oe(yr(R(t)));else {let j=Q=>Q.map(xe=>xe.subtasks?.length?{...xe,subtasks:F(j(xe.subtasks))}:xe);Oe(yr(j(t)));}},[t,Oe]);let gs=useRef(t),Dc=useRef(true);useEffect(()=>{if(Dc.current){Dc.current=false,gs.current=oe;return}if(_o.current){_o.current=false,gs.current=oe;return}if(!r)return;let F=JSON.stringify(gs.current),R=JSON.stringify(oe);F!==R&&(gs.current=oe,r(oe));},[oe,r]);let Va=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(Va));useEffect(()=>{_i(F=>F.map(R=>({...R,label:Va.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Va]);let fs=useMemo(()=>jo.filter(R=>R.visible).reduce((R,j)=>R+j.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(","),j=Sc.current;if(R!==j){let Q=F.some(Ee=>Ee.id!=="name"),xe=j.includes(",");Q?!xe&&Q&&J(null):J(null),Sc.current=R;}},[jo]);let Ec=60,Fc=.6,H0=useMemo(()=>{let R=fs+Ec,j=typeof window<"u"?window.innerWidth*Fc:800,Q=Math.max(R,j);return he!==null?Math.max(200,Math.min(he,Q)):Math.max(200,R)},[he,fs]),ro=useRef(null),bs=useRef(null),Br=useRef(null),En=useRef(null),Zt=useMemo(()=>Np(ye),[ye]),z0=useMemo(()=>({theme:Zt,themeName:ye}),[Zt,ye]),Mc=useMemo(()=>om(p),[p]),ji=useMemo(()=>{if(!g)return oe;let F=Fe.calculateCriticalPathFull(oe),R=j=>j.map(Q=>{let xe=F.get(Q.id),Ee=Q.subtasks?R(Q.subtasks):void 0,ht=Ee?.some(la=>la.isCriticalPath||la.subtasks&&la.subtasks.some(It=>It.isCriticalPath))||false,et=xe?xe.isCritical:ht;return {...Q,isCriticalPath:et,cpmData:xe||void 0,subtasks:Ee}});return R(oe)},[oe,g]),U0=useMemo(()=>Fe.flattenTasks(oe).some(R=>R.dependencies&&R.dependencies.length>0),[oe]),Pc=useMemo(()=>{if(Ae==="all"&&!ae)return ji;let F=R=>{let j=[];for(let Q of R){let xe=Q.subtasks?.length?F(Q.subtasks):void 0,Ee=false;if(ae)Ee=Q.progress<100;else switch(Ae){case "all":Ee=true;break;case "incomplete":Ee=Q.progress<100;break;case "in_progress":Ee=Q.progress>0&&Q.progress<100;break;case "completed":Ee=Q.progress===100;break}(Ee||xe&&xe.length>0)&&j.push({...Q,subtasks:xe});}return j};return F(ji)},[ji,Ae,ae]),hs=Pv($);rm({undo:P,redo:me,canUndo:He,canRedo:Ye,enabled:true}),useImperativeHandle(o,()=>({getTask:F=>Fe.findTaskById(oe,F),addTask:(F,R)=>{Oe(j=>{if(!R)return [...j,{...F,level:0}];let Q=xe=>xe.map(Ee=>Ee.id===R?{...Ee,subtasks:[...Ee.subtasks||[],{...F,parentId:R,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:Q(Ee.subtasks)}:Ee);return Q(j)});},updateTask:(F,R)=>{Oe(j=>{let Q=xe=>xe.map(Ee=>Ee.id===F?{...Ee,...R}:Ee.subtasks?{...Ee,subtasks:Q(Ee.subtasks)}:Ee);return Q(j)});},deleteTask:F=>{Oe(R=>{let j=Q=>Q.filter(xe=>xe.id===F?false:(xe.subtasks&&(xe.subtasks=j(xe.subtasks)),true));return j(R)});},deleteTasks:F=>{Oe(R=>dd(R,F));},duplicateTask:F=>{if(a.onTaskDuplicate){let R=Fe.findTaskById(oe,F);R&&a.onTaskDuplicate(R);}else Oe(R=>Kn(R,[F]).tasks);},splitTask:(F,R,j=3)=>{Oe(Q=>Fe.splitTask(Q,F,R,j));},calculateEndDate:Fe.calculateEndDate,calculateDuration:Fe.calculateDuration,validateDependency:(F,R)=>!Fe.validateDependencies(oe,F,R),getAllTasks:()=>Fe.flattenTasks(oe),getTasksByStatus:F=>Fe.flattenTasks(oe).filter(R=>R.status===F),getTasksByParent:F=>F?Fe.findTaskById(oe,F)?.subtasks||[]:oe.filter(j=>!j.parentId),getCriticalPath:()=>Fe.flattenTasks(oe).filter(F=>F.isCriticalPath),indentTask:F=>{Oe(R=>yr(sd(R,[F])));},outdentTask:F=>{Oe(R=>yr(id(R,[F])));},moveTask:(F,R)=>{Oe(j=>ld(j,[F],R));},createSubtask:async F=>{let{tasks:R,newTask:j}=pd(oe,F);if(be){let Q=be({...j,parentId:F});if((Q instanceof Promise?await Q:Q)===false)return}Oe(yr(R)),$e&&$e({...j,parentId:F});},scrollToTask:F=>{let j=Fe.flattenTasks(oe).findIndex(Q=>Q.id===F);if(j!==-1&&ro.current){let Q=j*hs;ro.current.scrollTo({top:Q,behavior:"smooth"}),Br.current&&Br.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(F,R=2e3)=>{},expandTask:F=>{Oe(R=>{let j=Q=>Q.map(xe=>xe.id===F?{...xe,isExpanded:true}:xe.subtasks?{...xe,subtasks:j(xe.subtasks)}:xe);return j(R)});},collapseTask:F=>{Oe(R=>{let j=Q=>Q.map(xe=>xe.id===F?{...xe,isExpanded:false}:xe.subtasks?{...xe,subtasks:j(xe.subtasks)}:xe);return j(R)});},expandAll:()=>{Oe(F=>{let R=j=>j.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseAll:()=>{Oe(F=>{let R=j=>j.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseToLevel:F=>{Nc(F);},undo:P,redo:me,canUndo:()=>He,canRedo:()=>Ye,clearHistory:qt,exportToPNG:async()=>{if(!En.current||!ro.current||!Br.current)throw new Error("Gantt container not found");let F=En.current,R=ro.current,j=bs.current||R.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=j?.scrollTop||0,Ee=Q.scrollTop,ht=F.style.overflow,et=F.style.height,la=R.style.overflow;try{let It=j?.querySelector(".gantt-taskgrid-content"),Xt=Q.querySelector("svg"),Ga=It?.scrollHeight||j?.scrollHeight||600,lr=Xt?.getBoundingClientRect().height||Q.scrollHeight,No=(F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(Ga,lr)+20;j&&(j.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 Rr=await toPng(F,{backgroundColor:Zt.bgPrimary,pixelRatio:2,filter:Jo=>{if(!(Jo instanceof Element))return !0;let ys=window.getComputedStyle(Jo),Mn=parseInt(ys.zIndex,10);return (isNaN(Mn)||Mn<50)&&ys.position!=="fixed"}});return await(await fetch(Rr)).blob()}finally{F.style.overflow=ht,F.style.height=et,R.style.overflow=la,j&&(j.scrollTop=xe),Q.scrollTop=Ee;}},exportToPDF:async F=>{await Fe.exportToPDF(oe,F);},exportToExcel:async F=>{await Fe.exportToExcel(oe,F);},exportToJSON:()=>Fe.exportToJSON(oe),exportToCSV:()=>Fe.exportToCSV(oe),importFromJSON:F=>{let R=Fe.importFromJSON(F);Oe(R);},getTasks:()=>oe,refresh:()=>{Oe(F=>[...F]);},clearAll:()=>{Oe([]);}}),[oe,P,me,He,Ye,qt,Zt,hs]);let W0=useCallback(F=>{_i(R=>R.map(j=>j.id===F?{...j,visible:!j.visible}:j));},[]),G0=useCallback((F,R)=>{_i(j=>j.map(Q=>{if(Q.id!==F)return Q;let xe=Q.minWidth??100,Ee=Q.maxWidth??800,ht=Math.max(xe,Math.min(Ee,R));return {...Q,width:ht}}));},[]),V0=useCallback(F=>{Oe(R=>{let j=ud(R,F),Q=xe=>{for(let Ee of xe){if(Ee.id===F){Ba.current.set(F,Ee.isExpanded??true);return}Ee.subtasks?.length&&Q(Ee.subtasks);}};return Q(j),fa(),j}),a.onTaskToggleExpand?.(F);},[a,fa]),Ko=useCallback((F,R)=>{if(De&&De(F,R)===false)return;let Q=Fe.findTaskById(oe,F)?.progress,xe=ht=>ht.map(et=>et.id===F?{...et,...R}:et.subtasks?{...et,subtasks:xe(et.subtasks)}:et);Oe(xe(oe));let Ee=Fe.findTaskById(xe(oe),F);Ee&&(je?.(Ee),Xe?.(Ee),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&V?.(F,Q,R.progress));},[oe,je,De,Xe,V]),_0=useCallback(F=>{F.length!==0&&(ir.current+=1,_o.current=true,Oe(R=>yr(sd(R,F))),a.onTaskIndent?.(F[0]));},[a]),j0=useCallback(F=>{F.length!==0&&(ir.current+=1,_o.current=true,Oe(R=>yr(id(R,F))),a.onTaskOutdent?.(F[0]));},[a]),K0=useCallback((F,R,j)=>{ir.current+=1,_o.current=true,Oe(Q=>yr(Gp(Q,F,R,j))),a.onTaskReparent?.(F,R,j);},[a]),Y0=useCallback((F,R)=>{F.length!==0&&(ir.current+=1,_o.current=true,Oe(j=>ld(j,F,R)),a.onTaskMove?.(F[0],R));},[a]),Ki=useCallback(async F=>{let R=[];for(let j of F)Z&&await Promise.resolve(Z(j))===false||R.push(j);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(Oe(j=>yr(dd(j,R))),R.forEach(j=>a.onTaskDelete?.(j))),Je&&R.forEach(j=>Je(j)));},[a,Z,Je]),q0=useCallback(F=>{a.onTaskDuplicate?F.forEach(R=>{let j=Fe.findTaskById(oe,R);j&&a.onTaskDuplicate(j);}):Oe(R=>Kn(R,F).tasks);},[a,oe]),X0=useCallback((F,R)=>{Oe(j=>{let{tasks:Q,newTask:xe}=Wp(j,F,R);return be&&be(xe)===false?j:(a.onTaskCreate?.(xe.parentId,xe.position||0),$e?.(xe),Q)});},[a,be,$e]),J0=useCallback((F,R)=>{Oe(j=>cd(j,F,R)),a.onTaskRename?.(F,R);},[a]),Yi=useCallback(F=>{let{onTaskAddSubtask:R}=a;if(R){let j=ai(oe,F);if(j){R(j);return}}Oe(j=>{let{tasks:Q}=pd(j,F);return a.onTaskCreate?.(F,0),Q});},[a,oe]),Q0=useCallback((F,R,j)=>{let Q=!F.startDate&&!F.endDate,xe=F.startDate?Math.round((R.getTime()-F.startDate.getTime())/(1e3*60*60*24)):0,Ee=It=>It.map(Xt=>Xt.id===F.id?{...Xt,startDate:R,endDate:j,...F.segments&&{segments:F.segments}}:Xt.subtasks?{...Xt,subtasks:Ee(Xt.subtasks)}:Xt),ht=Ee(oe),et=ht;ht=Fe.autoScheduleDependents(ht,F.id,xe),ht=yr(ht),Oe(ht);let la={...F,startDate:R,endDate:j};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(F,R,j):je?.(la),M&&xe!==0){let It=Fe.flattenTasks(et),Xt=Fe.flattenTasks(ht),Ga=[];for(let lr of Xt){if(lr.id===F.id)continue;let oo=It.find(Rr=>Rr.id===lr.id);if(!oo)continue;let Xo=lr.startDate?.getTime()!==oo.startDate?.getTime(),No=lr.endDate?.getTime()!==oo.endDate?.getTime();(Xo||No)&&Ga.push(lr);}Ga.length>0&&M(Ga);}},[oe,je,M,a]),Z0=useCallback((F,R)=>{Ce?.(F,R),_e({isOpen:true,x:R.clientX,y:R.clientY,task:F});},[Ce]),ef=useCallback((F,R)=>{let j=Fe.splitTask(oe,F.id,R);Oe(j),_e({isOpen:false,x:0,y:0,task:null});},[oe]),Ac=useCallback(F=>{let R=Fe.findTaskById(oe,F.id)||F;q?.(R),fe||gt(R);},[oe,q,fe]),Lc=useCallback((F,R,j)=>{let Q=new Map,xe=It=>{It.forEach(Xt=>{Xt.dependencies&&Q.set(Xt.id,Xt.dependencies),Xt.subtasks&&xe(Xt.subtasks);});};xe(j);let Ee=Q.get(R)||[];Q.set(R,[...Ee,F]);let ht=new Set,et=new Set,la=It=>{if(!ht.has(It)){ht.add(It),et.add(It);let Xt=Q.get(It)||[];for(let Ga of Xt){if(!ht.has(Ga)&&la(Ga))return true;if(et.has(Ga))return true}}return et.delete(It),false};return la(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.
366
+ `})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Ht[M]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Qe,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ct}`,boxShadow:wt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ye,borderBottom:`1px solid ${ut}`},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:tt,border:`1px solid ${qe}`,color:"#2E94FF"},children:jsx(tm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:$},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=se;},children:jsx(yv,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=se;},children:jsx(hv,{})})]})]}),jsx(AnimatePresence,{children:!d&&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:ie,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:fe.slice(0,4).map((U,oe)=>jsx("button",{onClick:()=>Ot(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:we,color:ee,border:`1px solid ${W}`},onMouseEnter:Oe=>{Oe.currentTarget.style.borderColor=Le,Oe.currentTarget.style.color="#2E94FF";},onMouseLeave:Oe=>{Oe.currentTarget.style.borderColor=W,Oe.currentTarget.style.color=ee;},children:U.length>30?U.slice(0,30)+"...":U},oe))})]}),g.map(U=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?Te:Ne,color:U.role==="user"?"#2E94FF":pt,border:U.role==="user"?`1px solid ${Be}`:`1px solid ${Ge}`},children:[U.isLoading?jsx(xv,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:U.command.success?"#10B981":"#EF4444",border:`1px solid ${U.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[U.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsx("div",{ref:ce})]}),jsxs("form",{onSubmit:U=>{if(I&&ne.length>0){U.preventDefault();return}gt(U);},className:"p-3 relative",style:{borderTop:`1px solid ${it}`},children:[jsx(AnimatePresence,{children:I&&ne.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:St,border:`1px solid ${Re}`,boxShadow:Ae,backdropFilter:"blur(12px)"},children:ne.map((U,oe)=>jsxs("button",{type:"button",onClick:()=>J(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:oe===A?ot:"transparent",color:ae},onMouseEnter:()=>K(oe),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:b,border:`1px solid ${B}`,color:"#2E94FF"},children:U.name.split(" ").map(Oe=>Oe[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:U.name}),U.email&&jsx("div",{className:"text-xs truncate",style:{color:me},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:at,border:`1px solid ${Ze}`},children:[jsx("input",{ref:E,type:"text",value:y,onChange:U=>he(U.target.value),onKeyDown:U=>{de(U);},placeholder:je,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:At,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!y.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:y.trim()?Dt:"transparent",color:y.trim()?"#2E94FF":bt,border:y.trim()?`1px solid ${mt}`:"1px solid transparent"},children:jsx(bv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:lt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function am(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,c=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!c)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),u=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function rm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=l?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&u&&n.key==="y"){n.preventDefault(),t();return}if(l&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Cv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Fe.formatDate(e.startDate)} - ${Fe.formatDate(e.endDate)}`);let a=Fe.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=>Fe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function om(e){return {...Cv,...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:l="comfortable",showThemeSelector:u=true,showExportButton:i=true,projectName:c,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:h,persistFilter:y,clearFiltersKey:v,aiAssistant:f,locale:x="en",customTranslations:k,showCreateTaskButton:w=false,createTaskLabel:T,onCreateTask:C,taskFilter:S,onTaskFilterChange:N,toolbarRightContent:I,showBaseline:O,viewMode:A,onViewModeChange:K,projectForecast:E,onThemeChange:ce,onTaskClick:L,onTaskDblClick:q,onTaskContextMenu:Ce,onTaskUpdate:je,onDependentTasksScheduled:M,onProgressChange:V,onTaskEdit:fe,onTaskAddSubtask:We,onTaskMarkIncomplete:z,onTaskSetInProgress:te,onDependencyCreate:X,onDependencyDelete:Me,onBeforeTaskAdd:be,onAfterTaskAdd:$e,onBeforeTaskUpdate:De,onAfterTaskUpdate:Xe,onBeforeTaskDelete:Z,onAfterTaskDelete:Je,permissions:ue,onCopySnapshotLink:Qe}=a,wt=useContext(qs)?.theme,[ye,ut]=useState(wt||s||"dark"),[tt,qe]=useState(n),[$,se]=useState(l),[D,Y]=useState(1),[ie,we]=useState("all"),[W,ee]=useState(A||"execution"),Le=A??W,Te=useCallback(F=>{ee(F),K?.(F);},[K]),Be=O??Le==="oracle",[Ne,Ge]=useState(a.showCriticalPath!==false),[pt,it]=useState(a.showDependencies!==false),[at,Ze]=useState(a.highlightWeekends!==false),At=useCallback(F=>{Ge(F),a.onShowCriticalPathChange?.(F);},[a.onShowCriticalPathChange]),Dt=useCallback(F=>{it(F),a.onShowDependenciesChange?.(F);},[a.onShowDependenciesChange]),mt=useCallback(F=>{Ze(F),a.onHighlightWeekendsChange?.(F);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(tt);},[tt]),useEffect(()=>{a.onZoomChange?.(D);},[D]);let bt=useRef(a.onDateRangeChange);bt.current=a.onDateRangeChange;let lt=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[St,Re]=useState(()=>{if(!y)return "all";try{let F=typeof y=="string"?y:"gantt-filter-state",R=localStorage.getItem(F);if(R){let j=JSON.parse(R);if(j.taskFilter)return j.taskFilter}}catch(F){console.warn("[GanttBoard] Error loading filter state from localStorage:",F);}return "all"}),Ae=S??St,ot=N??Re,[ae,me]=useState(()=>{if(!y)return false;try{let F=typeof y=="string"?y:"gantt-filter-state",R=localStorage.getItem(F);if(R){let j=JSON.parse(R);if(typeof j.hideCompleted=="boolean")return j.hideCompleted}}catch(F){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",F);}return false});useEffect(()=>{let F=lt();if(F)try{let R={taskFilter:Ae,hideCompleted:ae};localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Ae,ae,lt]);let b=useRef(v);useEffect(()=>{if(b.current!==v&&v!==void 0){Re("all"),me(false);let F=lt();if(F)try{localStorage.removeItem(F);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}b.current=v;},[v,lt]);let[B,H]=useState(0),[_,ne]=useState(false),[he,J]=useState(null),[de,_e]=useState({isOpen:false,x:0,y:0,task:null}),[Ke,gt]=useState(null),[Ot,Ht]=useState(null);useEffect(()=>{wt&&wt!==ye&&ut(wt);},[wt]),useEffect(()=>{s&&s!==ye&&ut(s);},[s]);let U=useCallback(F=>{ut(F),ce?.(F);},[ce]),{state:oe,setState:Oe,undo:P,redo:ge,canUndo:He,canRedo:Ye,clearHistory:qt}=am(t,50),Lt=useMemo(()=>{let F=(R,j=0)=>{let Q=j;for(let xe of R)xe.subtasks?.length&&(Q=Math.max(Q,F(xe.subtasks,j+1)));return Q};return F(oe)+1},[oe]),Da=useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),Ba=useRef(new Map),Ra=useRef(false);if(!Ra.current&&h){Ra.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let R=localStorage.getItem(F);if(R){let j=JSON.parse(R);Array.isArray(j)&&(Ba.current=new Map(j));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let fa=useCallback(()=>{let F=Da();if(F)try{let R=Array.from(Ba.current.entries());localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Da]),ir=useRef(0),Tc=useRef(oe);useEffect(()=>{Tc.current=oe;},[oe]);let _o=useRef(false),Nc=useCallback(F=>{we(F),ir.current+=1,Oe(R=>{let j=(xe,Ee=0)=>xe.map(ht=>{let et=F==="all"||Ee<F-1;return ht.subtasks?.length&&Ba.current.set(ht.id,et),{...ht,isExpanded:et,subtasks:ht.subtasks?j(ht.subtasks,Ee+1):void 0}}),Q=j(R);return fa(),Q});},[Oe,fa]);useEffect(()=>{if(ir.current>0){ir.current-=1;return}let F=j=>{let Q=new Map;for(let xe of j){let Ee=xe.id;Q.get(Ee)||Q.set(Ee,xe);}return Array.from(Q.values())},R=j=>j.map(Q=>{let xe=Ba.current.get(Q.id),Ee=xe!==void 0?{...Q,isExpanded:xe}:Q;if(Ee.subtasks?.length){let ht=F(Ee.subtasks);return {...Ee,subtasks:R(ht)}}return Ee});if(Ba.current.size>0)Oe(yr(R(t)));else {let j=Q=>Q.map(xe=>xe.subtasks?.length?{...xe,subtasks:F(j(xe.subtasks))}:xe);Oe(yr(j(t)));}},[t,Oe]);let gs=useRef(t),Dc=useRef(true);useEffect(()=>{if(Dc.current){Dc.current=false,gs.current=oe;return}if(_o.current){_o.current=false,gs.current=oe;return}if(!r)return;let F=JSON.stringify(gs.current),R=JSON.stringify(oe);F!==R&&(gs.current=oe,r(oe));},[oe,r]);let Va=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(Va));useEffect(()=>{_i(F=>F.map(R=>({...R,label:Va.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Va]);let fs=useMemo(()=>jo.filter(R=>R.visible).reduce((R,j)=>R+j.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(","),j=Sc.current;if(R!==j){let Q=F.some(Ee=>Ee.id!=="name"),xe=j.includes(",");Q?!xe&&Q&&J(null):J(null),Sc.current=R;}},[jo]);let Ec=60,Fc=.6,H0=useMemo(()=>{let R=fs+Ec,j=typeof window<"u"?window.innerWidth*Fc:800,Q=Math.max(R,j);return he!==null?Math.max(200,Math.min(he,Q)):Math.max(200,R)},[he,fs]),ro=useRef(null),bs=useRef(null),Br=useRef(null),En=useRef(null),Zt=useMemo(()=>Np(ye),[ye]),z0=useMemo(()=>({theme:Zt,themeName:ye}),[Zt,ye]),Mc=useMemo(()=>om(p),[p]),ji=useMemo(()=>{if(!g)return oe;let F=Fe.calculateCriticalPathFull(oe),R=j=>j.map(Q=>{let xe=F.get(Q.id),Ee=Q.subtasks?R(Q.subtasks):void 0,ht=Ee?.some(la=>la.isCriticalPath||la.subtasks&&la.subtasks.some(It=>It.isCriticalPath))||false,et=xe?xe.isCritical:ht;return {...Q,isCriticalPath:et,cpmData:xe||void 0,subtasks:Ee}});return R(oe)},[oe,g]),U0=useMemo(()=>Fe.flattenTasks(oe).some(R=>R.dependencies&&R.dependencies.length>0),[oe]),Pc=useMemo(()=>{if(Ae==="all"&&!ae)return ji;let F=R=>{let j=[];for(let Q of R){let xe=Q.subtasks?.length?F(Q.subtasks):void 0,Ee=false;if(ae)Ee=Q.progress<100;else switch(Ae){case "all":Ee=true;break;case "incomplete":Ee=Q.progress<100;break;case "in_progress":Ee=Q.progress>0&&Q.progress<100;break;case "completed":Ee=Q.progress===100;break}(Ee||xe&&xe.length>0)&&j.push({...Q,subtasks:xe});}return j};return F(ji)},[ji,Ae,ae]),hs=Pv($);rm({undo:P,redo:ge,canUndo:He,canRedo:Ye,enabled:true}),useImperativeHandle(o,()=>({getTask:F=>Fe.findTaskById(oe,F),addTask:(F,R)=>{Oe(j=>{if(!R)return [...j,{...F,level:0}];let Q=xe=>xe.map(Ee=>Ee.id===R?{...Ee,subtasks:[...Ee.subtasks||[],{...F,parentId:R,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:Q(Ee.subtasks)}:Ee);return Q(j)});},updateTask:(F,R)=>{Oe(j=>{let Q=xe=>xe.map(Ee=>Ee.id===F?{...Ee,...R}:Ee.subtasks?{...Ee,subtasks:Q(Ee.subtasks)}:Ee);return Q(j)});},deleteTask:F=>{Oe(R=>{let j=Q=>Q.filter(xe=>xe.id===F?false:(xe.subtasks&&(xe.subtasks=j(xe.subtasks)),true));return j(R)});},deleteTasks:F=>{Oe(R=>dd(R,F));},duplicateTask:F=>{if(a.onTaskDuplicate){let R=Fe.findTaskById(oe,F);R&&a.onTaskDuplicate(R);}else Oe(R=>Kn(R,[F]).tasks);},splitTask:(F,R,j=3)=>{Oe(Q=>Fe.splitTask(Q,F,R,j));},calculateEndDate:Fe.calculateEndDate,calculateDuration:Fe.calculateDuration,validateDependency:(F,R)=>!Fe.validateDependencies(oe,F,R),getAllTasks:()=>Fe.flattenTasks(oe),getTasksByStatus:F=>Fe.flattenTasks(oe).filter(R=>R.status===F),getTasksByParent:F=>F?Fe.findTaskById(oe,F)?.subtasks||[]:oe.filter(j=>!j.parentId),getCriticalPath:()=>Fe.flattenTasks(oe).filter(F=>F.isCriticalPath),indentTask:F=>{Oe(R=>yr(sd(R,[F])));},outdentTask:F=>{Oe(R=>yr(id(R,[F])));},moveTask:(F,R)=>{Oe(j=>ld(j,[F],R));},createSubtask:async F=>{let{tasks:R,newTask:j}=pd(oe,F);if(be){let Q=be({...j,parentId:F});if((Q instanceof Promise?await Q:Q)===false)return}Oe(yr(R)),$e&&$e({...j,parentId:F});},scrollToTask:F=>{let j=Fe.flattenTasks(oe).findIndex(Q=>Q.id===F);if(j!==-1&&ro.current){let Q=j*hs;ro.current.scrollTo({top:Q,behavior:"smooth"}),Br.current&&Br.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(F,R=2e3)=>{},expandTask:F=>{Oe(R=>{let j=Q=>Q.map(xe=>xe.id===F?{...xe,isExpanded:true}:xe.subtasks?{...xe,subtasks:j(xe.subtasks)}:xe);return j(R)});},collapseTask:F=>{Oe(R=>{let j=Q=>Q.map(xe=>xe.id===F?{...xe,isExpanded:false}:xe.subtasks?{...xe,subtasks:j(xe.subtasks)}:xe);return j(R)});},expandAll:()=>{Oe(F=>{let R=j=>j.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseAll:()=>{Oe(F=>{let R=j=>j.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseToLevel:F=>{Nc(F);},undo:P,redo:ge,canUndo:()=>He,canRedo:()=>Ye,clearHistory:qt,exportToPNG:async()=>{if(!En.current||!ro.current||!Br.current)throw new Error("Gantt container not found");let F=En.current,R=ro.current,j=bs.current||R.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=j?.scrollTop||0,Ee=Q.scrollTop,ht=F.style.overflow,et=F.style.height,la=R.style.overflow;try{let It=j?.querySelector(".gantt-taskgrid-content"),Xt=Q.querySelector("svg"),Ga=It?.scrollHeight||j?.scrollHeight||600,lr=Xt?.getBoundingClientRect().height||Q.scrollHeight,No=(F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(Ga,lr)+20;j&&(j.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 Rr=await toPng(F,{backgroundColor:Zt.bgPrimary,pixelRatio:2,filter:Jo=>{if(!(Jo instanceof Element))return !0;let ys=window.getComputedStyle(Jo),Mn=parseInt(ys.zIndex,10);return (isNaN(Mn)||Mn<50)&&ys.position!=="fixed"}});return await(await fetch(Rr)).blob()}finally{F.style.overflow=ht,F.style.height=et,R.style.overflow=la,j&&(j.scrollTop=xe),Q.scrollTop=Ee;}},exportToPDF:async F=>{await Fe.exportToPDF(oe,F);},exportToExcel:async F=>{await Fe.exportToExcel(oe,F);},exportToJSON:()=>Fe.exportToJSON(oe),exportToCSV:()=>Fe.exportToCSV(oe),importFromJSON:F=>{let R=Fe.importFromJSON(F);Oe(R);},getTasks:()=>oe,refresh:()=>{Oe(F=>[...F]);},clearAll:()=>{Oe([]);}}),[oe,P,ge,He,Ye,qt,Zt,hs]);let W0=useCallback(F=>{_i(R=>R.map(j=>j.id===F?{...j,visible:!j.visible}:j));},[]),G0=useCallback((F,R)=>{_i(j=>j.map(Q=>{if(Q.id!==F)return Q;let xe=Q.minWidth??100,Ee=Q.maxWidth??800,ht=Math.max(xe,Math.min(Ee,R));return {...Q,width:ht}}));},[]),V0=useCallback(F=>{Oe(R=>{let j=ud(R,F),Q=xe=>{for(let Ee of xe){if(Ee.id===F){Ba.current.set(F,Ee.isExpanded??true);return}Ee.subtasks?.length&&Q(Ee.subtasks);}};return Q(j),fa(),j}),a.onTaskToggleExpand?.(F);},[a,fa]),Ko=useCallback((F,R)=>{if(De&&De(F,R)===false)return;let Q=Fe.findTaskById(oe,F)?.progress,xe=ht=>ht.map(et=>et.id===F?{...et,...R}:et.subtasks?{...et,subtasks:xe(et.subtasks)}:et);Oe(xe(oe));let Ee=Fe.findTaskById(xe(oe),F);Ee&&(je?.(Ee),Xe?.(Ee),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&V?.(F,Q,R.progress));},[oe,je,De,Xe,V]),_0=useCallback(F=>{F.length!==0&&(ir.current+=1,_o.current=true,Oe(R=>yr(sd(R,F))),a.onTaskIndent?.(F[0]));},[a]),j0=useCallback(F=>{F.length!==0&&(ir.current+=1,_o.current=true,Oe(R=>yr(id(R,F))),a.onTaskOutdent?.(F[0]));},[a]),K0=useCallback((F,R,j)=>{ir.current+=1,_o.current=true,Oe(Q=>yr(Gp(Q,F,R,j))),a.onTaskReparent?.(F,R,j);},[a]),Y0=useCallback((F,R)=>{F.length!==0&&(ir.current+=1,_o.current=true,Oe(j=>ld(j,F,R)),a.onTaskMove?.(F[0],R));},[a]),Ki=useCallback(async F=>{let R=[];for(let j of F)Z&&await Promise.resolve(Z(j))===false||R.push(j);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(Oe(j=>yr(dd(j,R))),R.forEach(j=>a.onTaskDelete?.(j))),Je&&R.forEach(j=>Je(j)));},[a,Z,Je]),q0=useCallback(F=>{a.onTaskDuplicate?F.forEach(R=>{let j=Fe.findTaskById(oe,R);j&&a.onTaskDuplicate(j);}):Oe(R=>Kn(R,F).tasks);},[a,oe]),X0=useCallback((F,R)=>{Oe(j=>{let{tasks:Q,newTask:xe}=Wp(j,F,R);return be&&be(xe)===false?j:(a.onTaskCreate?.(xe.parentId,xe.position||0),$e?.(xe),Q)});},[a,be,$e]),J0=useCallback((F,R)=>{Oe(j=>cd(j,F,R)),a.onTaskRename?.(F,R);},[a]),Yi=useCallback(F=>{let{onTaskAddSubtask:R}=a;if(R){let j=ai(oe,F);if(j){R(j);return}}Oe(j=>{let{tasks:Q}=pd(j,F);return a.onTaskCreate?.(F,0),Q});},[a,oe]),Q0=useCallback((F,R,j)=>{let Q=!F.startDate&&!F.endDate,xe=F.startDate?Math.round((R.getTime()-F.startDate.getTime())/(1e3*60*60*24)):0,Ee=It=>It.map(Xt=>Xt.id===F.id?{...Xt,startDate:R,endDate:j,...F.segments&&{segments:F.segments}}:Xt.subtasks?{...Xt,subtasks:Ee(Xt.subtasks)}:Xt),ht=Ee(oe),et=ht;ht=Fe.autoScheduleDependents(ht,F.id,xe),ht=yr(ht),Oe(ht);let la={...F,startDate:R,endDate:j};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(F,R,j):je?.(la),M&&xe!==0){let It=Fe.flattenTasks(et),Xt=Fe.flattenTasks(ht),Ga=[];for(let lr of Xt){if(lr.id===F.id)continue;let oo=It.find(Rr=>Rr.id===lr.id);if(!oo)continue;let Xo=lr.startDate?.getTime()!==oo.startDate?.getTime(),No=lr.endDate?.getTime()!==oo.endDate?.getTime();(Xo||No)&&Ga.push(lr);}Ga.length>0&&M(Ga);}},[oe,je,M,a]),Z0=useCallback((F,R)=>{Ce?.(F,R),_e({isOpen:true,x:R.clientX,y:R.clientY,task:F});},[Ce]),ef=useCallback((F,R)=>{let j=Fe.splitTask(oe,F.id,R);Oe(j),_e({isOpen:false,x:0,y:0,task:null});},[oe]),Ac=useCallback(F=>{let R=Fe.findTaskById(oe,F.id)||F;q?.(R),fe||gt(R);},[oe,q,fe]),Lc=useCallback((F,R,j)=>{let Q=new Map,xe=It=>{It.forEach(Xt=>{Xt.dependencies&&Q.set(Xt.id,Xt.dependencies),Xt.subtasks&&xe(Xt.subtasks);});};xe(j);let Ee=Q.get(R)||[];Q.set(R,[...Ee,F]);let ht=new Set,et=new Set,la=It=>{if(!ht.has(It)){ht.add(It),et.add(It);let Xt=Q.get(It)||[];for(let Ga of Xt){if(!ht.has(Ga)&&la(Ga))return true;if(et.has(Ga))return true}}return et.delete(It),false};return la(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 j=Q=>Q.map(xe=>{if(xe.id===R){let Ee=xe.dependencies||[];if(!Ee.includes(F.id))return {...xe,dependencies:[...Ee,F.id]}}return xe.subtasks?{...xe,subtasks:j(xe.subtasks)}:xe});ir.current+=1,Oe(Q=>j(Q)),X?.(F.id,R);},[X,Lc]),Bc=useCallback((F,R)=>{let j=Q=>Q.map(xe=>{if(xe.id===F&&xe.dependencies){let Ee=xe.dependencies.filter(ht=>ht!==R);return {...xe,dependencies:Ee}}return xe.subtasks?{...xe,subtasks:j(xe.subtasks)}:xe});ir.current+=1,Oe(Q=>j(Q)),Me?.(F,R);},[Me]),{startDate:Yo,endDate:qi}=useMemo(()=>{let F=oe.filter(Ee=>Ee.startDate&&Ee.endDate);if(F.length===0){let Ee=new Date,ht=new Date(Ee);ht.setDate(ht.getDate()-30);let et=new Date(Ee);return et.setDate(et.getDate()+60),{startDate:ht,endDate:et}}let R=F.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),j=new Date(Math.min(...R.map(Ee=>Ee.getTime()))),Q=new Date(Math.max(...R.map(Ee=>Ee.getTime()))),xe=tt==="day"?7:tt==="week"?14:30;return j.setDate(j.getDate()-xe),Q.setDate(Q.getDate()+xe),{startDate:j,endDate:Q}},[oe,tt]);useEffect(()=>{bt.current?.(Yo,qi);},[Yo,qi]);let tf=useCallback(async()=>{if(!En.current||!ro.current||!Br.current)return;await new Promise(No=>setTimeout(No,200));let F=En.current,R=ro.current,j=bs.current||R.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=j?.scrollTop||0,Ee=j?.scrollLeft||0,ht=Q.scrollTop,et=Q.scrollLeft,la=F.style.overflow,It=F.style.height,Xt=j?.style.overflow||"",Ga=Q.style.overflow,lr=R.style.overflow,oo=F.style.width,Xo=Q.style.width;try{let No=j?.querySelector(".gantt-taskgrid-content"),Rr=Q.querySelector("svg"),Ji=Rr?.getAttribute("height")?parseInt(Rr.getAttribute("height"),10):Rr?.getBoundingClientRect().height||0,Jo=No?.scrollHeight||j?.scrollHeight||600,ys=Math.max(Ji,Q.scrollHeight),Mn=Rr?.getAttribute("width")?parseInt(Rr.getAttribute("width"),10):Rr?.getBoundingClientRect().width||Q.scrollWidth,cf=F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Qi=Math.max(Jo,ys,Ji),$c=cf+Qi+50,Hc=(j?.offsetWidth||R.offsetWidth||300)+Mn+10;j&&(j.scrollTop=0,j.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",j&&(j.style.overflow="visible",j.style.height=`${Qi+50}px`),Q.style.overflow="visible",Q.style.height=`${Qi+50}px`,Q.style.width=`${Mn+10}px`,await new Promise(xs=>setTimeout(xs,150));let uf=await toPng(F,{backgroundColor:Zt.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=uf,Zi.click();}finally{F.style.overflow=la,F.style.height=It,F.style.width=oo,R.style.overflow=lr,j&&(j.style.overflow=Xt,j.style.height="",j.scrollTop=xe,j.scrollLeft=Ee),Q.style.overflow=Ga,Q.style.height="",Q.style.width=Xo,Q.scrollTop=ht,Q.scrollLeft=et;}},[Zt]),af=useCallback(async()=>{await Fe.exportToPDF(oe);},[oe]),rf=useCallback(async()=>{let F=new Date,R=xe=>String(xe).padStart(2,"0"),j=`${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 Fe.exportToExcel(oe,`${Q}_${j}.xlsx`);},[oe,c]),of=useCallback(()=>{let F=Fe.exportToCSV(oe),R=new Blob([F],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[oe]),nf=useCallback(()=>{let F=Fe.exportToJSON(oe),R=new Blob([F],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[oe]),sf=useCallback(()=>{Fe.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),lf=F=>{F.preventDefault(),ne(true);},qo=useRef(false),[Xi,Rc]=useState(false),Fn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let F=Br.current,R=ro.current?.querySelector(".gantt-grid-scroll");if(!F||!R)return;let j=()=>{if(qo.current)return;qo.current=true;let et=F.scrollTop;H(et),R.scrollTop=et,requestAnimationFrame(()=>{qo.current=false;});},Q=()=>{if(qo.current)return;qo.current=true;let et=R.scrollTop;H(et),F.scrollTop=et,requestAnimationFrame(()=>{qo.current=false;});},xe=et=>{if(_&&R){let It=R.parentElement?.getBoundingClientRect()?.left||0,Xt=et.clientX-It,Ga=200,lr=fs+Ec,oo=window.innerWidth*Fc,Xo=Math.max(lr,oo);Xt>=Ga&&Xt<=Xo&&J(Xt);}if(Xi&&F){let la=et.clientX-Fn.current.x,It=et.clientY-Fn.current.y;F.scrollLeft=Fn.current.scrollLeft-la,F.scrollTop=Fn.current.scrollTop-It;}},Ee=()=>{ne(false),Rc(false);},ht=et=>{if(et.button!==0)return;let la=et.target;la.closest("[data-task-bar]")||la.closest("[data-dependency-line]")||la.closest("button")||la.closest('[role="button"]')||la.tagName==="rect"&&la.getAttribute("data-clickable")==="true"||(Rc(true),Fn.current={x:et.clientX,y:et.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},et.preventDefault());};return F.addEventListener("scroll",j),R.addEventListener("scroll",Q),F.addEventListener("mousedown",ht),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",Ee),()=>{F.removeEventListener("scroll",j),R.removeEventListener("scroll",Q),F.removeEventListener("mousedown",ht),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",Ee);}},[_,Xi,fs]);let Oc=useRef(false),df=useRef(null);return useLayoutEffect(()=>{if(Oc.current||oe.length===0||!Br.current)return;Oc.current=true,df.current=Yo;let F=Br.current,R=new Date,j=tt==="day"?60:tt==="week"?20:8,Q=(R.getTime()-Yo.getTime())/(1e3*60*60*24),xe=F.clientWidth,ht=Q*j*D-xe/2;Q>=0&&xe>0&&(F.scrollLeft=Math.max(0,ht));},[oe.length,Yo,tt,D]),jsx(un.Provider,{value:Va,children:jsx(ol.Provider,{value:z0,children:jsxs("div",{ref:En,className:"flex flex-col h-full w-full",style:{backgroundColor:Zt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Zt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Zt.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:Zt,timeScale:tt,onTimeScaleChange:qe,zoom:D,onZoomChange:Y,currentTheme:ye,onThemeChange:U,rowDensity:$,onRowDensityChange:se,showThemeSelector:u,showCreateTaskButton:w&&ue?.canCreateTask!==false&&!ue?.canCreateSubtaskOnly,createTaskLabel:T,onCreateTask:C,taskFilter:Ae,onTaskFilterChange:ot,hideCompleted:ae,onHideCompletedChange:ge,toolbarRightContent:I,wbsLevel:ie,onWbsLevelChange:Nc,maxWbsDepth:Lt,viewMode:Le,onViewModeChange:Te,projectForecast:E,onExportPNG:i?tf:void 0,onExportPDF:i?af:void 0,onExportExcel:i?rf:void 0,onExportCSV:i?of:void 0,onExportJSON:i?nf:void 0,onExportMSProject:i?sf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:At,showDependencies:pt,onShowDependenciesChange:Dt,highlightWeekends:at,onHighlightWeekendsChange:mt,showBaseline:Be,onShowBaselineChange:F=>{F&&Le!=="oracle"&&Te("oracle"),!F&&Le==="oracle"&&Te("execution");},onCopySnapshotLink:Qe,hasDependencies:U0})}),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:Pc,theme:Zt,rowHeight:hs,availableUsers:d,templates:Mc,showCriticalPath:Ne,onTaskClick:L,onTaskDblClick:Ac,onTaskContextMenu:Ce,onTaskToggle:V0,scrollTop:B,columns:jo,onToggleColumn:W0,onColumnResize:G0,onTaskUpdate:Ko,onTaskIndent:_0,onTaskOutdent:j0,onTaskMove:Y0,onMultiTaskDelete:Ki,onTaskDuplicate:q0,onTaskCreate:X0,onTaskRename:J0,onCreateSubtask:Yi,onOpenTaskModal:L?F=>L(F):void 0,onDeleteRequest:(F,R)=>Ht({taskId:F,taskName:R}),onTaskReparent:K0,scrollContainerRef:bs})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Zt.border,zIndex:15},onMouseDown:lf}),jsx("div",{ref:Br,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:Pc,theme:Zt,rowHeight:hs,timeScale:tt,startDate:Yo,endDate:qi,zoom:D,locale:x,templates:Mc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:L,onTaskDblClick:Ac,onTaskContextMenu:Z0,onTaskDateChange:Q0,onDependencyCreate:Ic,onDependencyDelete:Bc,showBaseline:Be,showCriticalPath:Ne,showDependencies:pt,highlightWeekends:at,canEditTask:ue?.canEditTask})})]}),de.task&&jsx(gn,{isOpen:de.isOpen,x:de.x,y:de.y,theme:Zt,onClose:()=>_e({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=de.task;if(!F)return [];let R=Fe.findTaskById(oe,F.id)||F,j=R.subtasks&&R.subtasks.length>0,Q=ue?.canCreateTask!==false,xe=ue?.canDeleteTask!==false;if(j){let It=[],Xt=ue?.canDuplicateTask!==false;return Q&&It.push({id:"addSubtask",label:Va.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{We?We(R):Yi(R.id);}}),Xt&&It.push({id:"duplicate",label:Va.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):Oe(Ga=>Kn(Ga,[R.id]).tasks),_e({isOpen:false,x:0,y:0,task:null});}}),xe&&(It.length>0&&It.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),It.push({id:"delete",label:Va.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{Ht({taskId:R.id,taskName:R.name});}})),It}let Ee=ue?.canUpdateTask!==false,ht=ue?.canDuplicateTask!==false,et=[];return Ee&&et.push({id:"edit",label:Va.contextMenu?.editTask||"Edit Task",icon:Kt.Pencil,onClick:()=>{fe?fe(R):gt(R);}}),Q&&et.push({id:"addSubtask",label:Va.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{We?We(R):Yi(R.id);}}),et.length>0&&Ee&&et.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ee&&(et.push({id:"markIncomplete",label:Va.contextMenu?.markIncomplete||"Mark Incomplete",icon:Kt.MarkIncomplete,onClick:()=>{z?z(R):Ko(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),et.push({id:"setInProgress",label:Va.contextMenu?.setInProgress||"Set In Progress",icon:Kt.SetInProgress,onClick:()=>{te?te(R):Ko(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),et.push({id:"markComplete",label:Va.contextMenu?.markComplete||"Mark Complete",icon:Kt.MarkComplete,onClick:()=>{Ko(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(ht||Ee&&R.startDate&&R.endDate)&&et.length>0&&et.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),ht&&et.push({id:"duplicate",label:Va.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):Oe(It=>Kn(It,[R.id]).tasks),_e({isOpen:false,x:0,y:0,task:null});}}),Ee&&R.startDate&&R.endDate&&et.push({id:"split",label:Va.contextMenu?.splitTask||"Split Task",icon:Kt.Split,onClick:()=>{let It=R.startDate.getTime(),Xt=R.endDate.getTime(),Ga=It+(Xt-It)/2,lr=new Date(Ga);ef(R,lr);}}),xe&&(et.length>0&&et.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),et.push({id:"delete",label:Va.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{Ht({taskId:R.id,taskName:R.name});}})),et})()}),jsx(Xr,{task:Ke,isOpen:!!Ke,onClose:()=>gt(null),onTaskUpdate:F=>{Ke&&(Ko(Ke.id,F),gt(null));},theme:ye==="light"?"light":"dark",locale:x==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Ot&&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:()=>Ht(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:Zt.bgSecondary,border:`1px solid ${Zt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Zt.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:Zt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Va.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Zt.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:Zt.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:Zt.textPrimary},children:['"',Ot.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Zt.bgPrimary,borderTop:`1px solid ${Zt.border}`},children:[jsx("button",{onClick:()=>Ht(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Zt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=Zt.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:x==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Ki([Ot.taskId]),Ht(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:oe,theme:Zt,config:f,onTasksUpdate:Oe,onTaskUpdate:Ko,onTaskCreate:F=>{Oe(R=>[...R,F]);},onTaskDelete:F=>{Ki([F]);},onDependencyCreate:(F,R)=>{let j=Fe.findTaskById(oe,F);j&&Ic(j,R);},onDependencyDelete:Bc})]})})})});function Wv(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 Gv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}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:l=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:h,defaultStatus:y}){let v=[...fd,...i.filter(D=>!fd.some(Y=>Y.id===D.id))],f=nt[u]||nt.dark,[x,k]=useState(false),[w,T]=useState(false),[C,S]=useState(false),[N,I]=useState(false),[O,A]=useState({top:0,left:0}),[K,E]=useState(null),[ce,L]=useState(new Date),[q,Ce]=useState({top:0,left:0}),[je,M]=useState(false),[V,fe]=useState([]),[We,z]=useState(false),[te,X$1]=useState(""),Me=useRef(null),be=useRef(null),$e=useRef(null),De=useRef(null),Xe=useRef(null),[Z,Je]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[ue,Qe]=useState({});useEffect(()=>{a?(Je({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)&&M(true)):(Je({name:"",description:"",progress:0,status:y||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),M(false),fe([]));},[a,e,y]),useEffect(()=>{let D=Y=>{Me.current&&!Me.current.contains(Y.target)&&k(false),be.current&&!be.current.contains(Y.target)&&T(false),$e.current&&!$e.current.contains(Y.target)&&S(false),De.current&&!De.current.contains(Y.target)&&I(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let ct=()=>{let D={};return Z.name.trim()||(D.name="El nombre es requerido"),Z.startDate&&Z.endDate&&Z.startDate>Z.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),Qe(D),Object.keys(D).length===0},wt=async D=>{if(D.preventDefault(),!!ct())try{let Y=l==="create"&&V.length>0?{...Z,pendingFiles:V}:Z;await s(Y),fe([]),t();}catch(Y){console.error("Error submitting task:",Y);}},ye=(D,Y)=>{Je(ie=>{let we={...ie,[D]:Y};if(D==="status"){let W=Y;W==="todo"?we.progress=0:W==="in-progress"?(ie.progress===0||ie.progress===100)&&(we.progress=50):W==="completed"||W==="closed"?we.progress=100:(W==="in-review"||W==="review")&&(we.progress=75);}if(D==="progress"){let W=typeof Y=="number"?Y:parseInt(Y,10);W===100&&ie.status!=="completed"?we.status="completed":W>0&&W<100&&ie.status==="todo"?we.status="in-progress":W===0&&ie.status!=="todo"&&(we.status="todo");}return we}),ue[D]&&Qe(ie=>{let we={...ie};return delete we[D],we});},ut=v.find(D=>D.id===Z.status)??fd[0],tt=bd.find(D=>D.id===Z.priority)??bd[1],qe=Po.find(D=>D.value===Z.color)??Po[0],$=u==="dark",se={backgroundColor:$?"#141414":f.bgSecondary,border:`1px solid ${$?"#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:$?"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":u,style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,WebkitBackdropFilter:$?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:$?"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:ut.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:l==="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:wt,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:Z.name,onChange:D=>ye("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:Z.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),ue.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),ue.name]})]}),jsx("div",{children:jsx("textarea",{value:Z.description||"",onChange:D=>ye("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:Me,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:{...se,borderColor:ut.color,backgroundColor:`${ut.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:ut.color}}),jsx("span",{style:{color:ut.color},children:ut.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:ut.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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.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:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{ye("status",D.id),k(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,Z.status===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxs("div",{ref:be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&T(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:tt.color}}),jsx("span",{children:tt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children: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:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{ye("priority",D.id),T(false);},children:[jsx("span",{children:D.icon}),D.label,Z.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:$e,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&S(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[Z.assignees&&Z.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:Z.assignees.slice(0,3).map((D,Y)=>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},Y))}),Z.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",Z.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:C&&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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let Y=Z.assignees?.some(ie=>ie.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:ie=>ie.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=Y?(Z.assignees||[]).filter(we=>we.name!==D.name):[...Z.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(we=>we[0]).join("").toUpperCase().slice(0,2),color:f.accent}];ye("assignees",ie);},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:Y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxs("div",{ref:De,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(N)I(false);else {if(De.current){let D=De.current.getBoundingClientRect(),Y=window.innerHeight,ie=120,W=Y-D.bottom<ie?D.top-ie-8:D.bottom+8;A({top:W,left:D.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Z.color}}),jsx("span",{children:qe.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:N&&jsxs(Bt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Po.slice(0,18).map(D=>{let Y=Z.color===D.value;return jsx("button",{type:"button",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),ye("color",D.value),I(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:Y?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),c.length>0||d?jsx(lo,{selectedTags:Z.tags||[],availableTags:c,onChange:D=>ye("tags",D),onCreateTag:d,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:Xe,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(K==="start")E(null);else {if(Xe.current){let D=Xe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,W=Y-D.bottom<ie?D.top-ie-8:D.bottom+8;Ce({top:W,left:D.left});}E("start"),L(Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.startDate?Z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(K==="end")E(null);else {if(Xe.current){let D=Xe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,W=Y-D.bottom<ie?D.top-ie-8:D.bottom+8;Ce({top:W,left:D.left});}E("end"),L(Z.endDate||Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.endDate?Z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:K&&jsxs(Bt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:$?"#0a0a0a":f.bgPrimary,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${$?"#262626":f.border}`},children:[(()=>{let D=new Date,Y=new Date(D);Y.setDate(D.getDate()+1);let ie=new Date(D);ie.setDate(D.getDate()+7);let we=new Date(D);return we.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:Y},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:we}].map((ee,Le)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{K==="start"?(ye("startDate",ee.date),(!Z.endDate||ee.date>Z.endDate)&&ye("endDate",ee.date),E("end")):(ye("endDate",ee.date),(!Z.startDate||ee.date<Z.startDate)&&ye("startDate",ee.date),E(null));},children:ee.label},Le))})(),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:()=>{ye("startDate",void 0),ye("endDate",void 0),E(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>L(new Date(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:()=>L(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,Y)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},Y))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=ce.getFullYear(),Y=ce.getMonth(),ie=new Date(D,Y,1).getDay(),we=new Date(D,Y+1,0).getDate(),W=new Date,ee=[];for(let Te=ie-1;Te>=0;Te--)ee.push({day:new Date(D,Y,-Te).getDate(),date:new Date(D,Y-1,new Date(D,Y,-Te).getDate()),isCurrentMonth:false});for(let Te=1;Te<=we;Te++)ee.push({day:Te,date:new Date(D,Y,Te),isCurrentMonth:true});let Le=42-ee.length;for(let Te=1;Te<=Le;Te++)ee.push({day:Te,date:new Date(D,Y+1,Te),isCurrentMonth:false});return ee.map((Te,Be)=>{let Ne=Te.date.toDateString()===W.toDateString(),Ge=Z.startDate?.toDateString()===Te.date.toDateString(),pt=Z.endDate?.toDateString()===Te.date.toDateString(),it=Z.startDate&&Z.endDate&&Te.date>=Z.startDate&&Te.date<=Z.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Te.isCurrentMonth?Ge||pt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ge?f.accent:pt?"#7C3AED":it?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!Ge&&!pt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{K==="start"?(ye("startDate",Te.date),Z.endDate&&Te.date>Z.endDate&&ye("endDate",Te.date),E("end")):(ye("endDate",Te.date),Z.startDate&&Te.date<Z.startDate&&ye("startDate",Te.date),E(null));},children:Te.day},Be)})})()})]})]})]})})]}),ue.endDate&&jsx("span",{className:"text-xs text-red-400",children:ue.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:Z.progress,onChange:D=>ye("progress",parseInt(D.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:Z.progress<30?"#EF4444":Z.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:`${Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"}20`,color:Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[Z.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>M(!je),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 ${je?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:je&&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:Z.effortMinutes?Wv(Z.effortMinutes):"",onChange:D=>{let Y=Gv(D.target.value);ye("effortMinutes",Y);},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||p.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color: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 ",l==="create"?V.length>0&&`(${V.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(Ur,{cardId:"pending",attachments:V.map((D,Y)=>({id:`pending-${Y}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>fe(Y=>[...Y,...D]),onDelete:D=>{let Y=parseInt(D.replace("pending-",""),10);fe(ie=>ie.filter((we,W)=>W!==Y));},maxSizeMB:10,maxFiles:20}):jsx(Ur,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:h,maxSizeMB:10,maxFiles:20}),l==="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:Z.isMilestone,onChange:D=>ye("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"]}),Z.dependencies&&Z.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Z.dependencies.map(D=>{let Y=r.find(ie=>ie.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:[Y?.name||D.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ie=(Z.dependencies||[]).filter(we=>we!==D);ye("dependencies",ie);},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:()=>{z(!We),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:We&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsx("input",{type:"text",value:te,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=>te===""||D.name.toLowerCase().includes(te.toLowerCase())).map(D=>{let Y=Z.dependencies?.includes(D.id);return jsxs("button",{type:"button",onClick:()=>{let ie=Z.dependencies||[],we;Y?we=ie.filter(W=>W!==D.id):we=[...ie,D.id],ye("dependencies",we);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Y?`${f.accent}10`:"transparent"},onMouseEnter:ie=>{Y||(ie.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor=Y?`${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:Y?f.accent:"transparent",borderColor:Y?f.accent:f.borderLight},children:Y&&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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var pm=`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 j=Q=>Q.map(xe=>{if(xe.id===R){let Ee=xe.dependencies||[];if(!Ee.includes(F.id))return {...xe,dependencies:[...Ee,F.id]}}return xe.subtasks?{...xe,subtasks:j(xe.subtasks)}:xe});ir.current+=1,Oe(Q=>j(Q)),X?.(F.id,R);},[X,Lc]),Bc=useCallback((F,R)=>{let j=Q=>Q.map(xe=>{if(xe.id===F&&xe.dependencies){let Ee=xe.dependencies.filter(ht=>ht!==R);return {...xe,dependencies:Ee}}return xe.subtasks?{...xe,subtasks:j(xe.subtasks)}:xe});ir.current+=1,Oe(Q=>j(Q)),Me?.(F,R);},[Me]),{startDate:Yo,endDate:qi}=useMemo(()=>{let F=oe.filter(Ee=>Ee.startDate&&Ee.endDate);if(F.length===0){let Ee=new Date,ht=new Date(Ee);ht.setDate(ht.getDate()-30);let et=new Date(Ee);return et.setDate(et.getDate()+60),{startDate:ht,endDate:et}}let R=F.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),j=new Date(Math.min(...R.map(Ee=>Ee.getTime()))),Q=new Date(Math.max(...R.map(Ee=>Ee.getTime()))),xe=tt==="day"?7:tt==="week"?14:30;return j.setDate(j.getDate()-xe),Q.setDate(Q.getDate()+xe),{startDate:j,endDate:Q}},[oe,tt]);useEffect(()=>{bt.current?.(Yo,qi);},[Yo,qi]);let tf=useCallback(async()=>{if(!En.current||!ro.current||!Br.current)return;await new Promise(No=>setTimeout(No,200));let F=En.current,R=ro.current,j=bs.current||R.querySelector(".gantt-grid-scroll"),Q=Br.current,xe=j?.scrollTop||0,Ee=j?.scrollLeft||0,ht=Q.scrollTop,et=Q.scrollLeft,la=F.style.overflow,It=F.style.height,Xt=j?.style.overflow||"",Ga=Q.style.overflow,lr=R.style.overflow,oo=F.style.width,Xo=Q.style.width;try{let No=j?.querySelector(".gantt-taskgrid-content"),Rr=Q.querySelector("svg"),Ji=Rr?.getAttribute("height")?parseInt(Rr.getAttribute("height"),10):Rr?.getBoundingClientRect().height||0,Jo=No?.scrollHeight||j?.scrollHeight||600,ys=Math.max(Ji,Q.scrollHeight),Mn=Rr?.getAttribute("width")?parseInt(Rr.getAttribute("width"),10):Rr?.getBoundingClientRect().width||Q.scrollWidth,cf=F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Qi=Math.max(Jo,ys,Ji),$c=cf+Qi+50,Hc=(j?.offsetWidth||R.offsetWidth||300)+Mn+10;j&&(j.scrollTop=0,j.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",j&&(j.style.overflow="visible",j.style.height=`${Qi+50}px`),Q.style.overflow="visible",Q.style.height=`${Qi+50}px`,Q.style.width=`${Mn+10}px`,await new Promise(xs=>setTimeout(xs,150));let uf=await toPng(F,{backgroundColor:Zt.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=uf,Zi.click();}finally{F.style.overflow=la,F.style.height=It,F.style.width=oo,R.style.overflow=lr,j&&(j.style.overflow=Xt,j.style.height="",j.scrollTop=xe,j.scrollLeft=Ee),Q.style.overflow=Ga,Q.style.height="",Q.style.width=Xo,Q.scrollTop=ht,Q.scrollLeft=et;}},[Zt]),af=useCallback(async()=>{await Fe.exportToPDF(oe);},[oe]),rf=useCallback(async()=>{let F=new Date,R=xe=>String(xe).padStart(2,"0"),j=`${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 Fe.exportToExcel(oe,`${Q}_${j}.xlsx`);},[oe,c]),of=useCallback(()=>{let F=Fe.exportToCSV(oe),R=new Blob([F],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[oe]),nf=useCallback(()=>{let F=Fe.exportToJSON(oe),R=new Blob([F],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(R),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[oe]),sf=useCallback(()=>{Fe.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),lf=F=>{F.preventDefault(),ne(true);},qo=useRef(false),[Xi,Rc]=useState(false),Fn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let F=Br.current,R=ro.current?.querySelector(".gantt-grid-scroll");if(!F||!R)return;let j=()=>{if(qo.current)return;qo.current=true;let et=F.scrollTop;H(et),R.scrollTop=et,requestAnimationFrame(()=>{qo.current=false;});},Q=()=>{if(qo.current)return;qo.current=true;let et=R.scrollTop;H(et),F.scrollTop=et,requestAnimationFrame(()=>{qo.current=false;});},xe=et=>{if(_&&R){let It=R.parentElement?.getBoundingClientRect()?.left||0,Xt=et.clientX-It,Ga=200,lr=fs+Ec,oo=window.innerWidth*Fc,Xo=Math.max(lr,oo);Xt>=Ga&&Xt<=Xo&&J(Xt);}if(Xi&&F){let la=et.clientX-Fn.current.x,It=et.clientY-Fn.current.y;F.scrollLeft=Fn.current.scrollLeft-la,F.scrollTop=Fn.current.scrollTop-It;}},Ee=()=>{ne(false),Rc(false);},ht=et=>{if(et.button!==0)return;let la=et.target;la.closest("[data-task-bar]")||la.closest("[data-dependency-line]")||la.closest("button")||la.closest('[role="button"]')||la.tagName==="rect"&&la.getAttribute("data-clickable")==="true"||(Rc(true),Fn.current={x:et.clientX,y:et.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},et.preventDefault());};return F.addEventListener("scroll",j),R.addEventListener("scroll",Q),F.addEventListener("mousedown",ht),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",Ee),()=>{F.removeEventListener("scroll",j),R.removeEventListener("scroll",Q),F.removeEventListener("mousedown",ht),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",Ee);}},[_,Xi,fs]);let Oc=useRef(false),df=useRef(null);return useLayoutEffect(()=>{if(Oc.current||oe.length===0||!Br.current)return;Oc.current=true,df.current=Yo;let F=Br.current,R=new Date,j=tt==="day"?60:tt==="week"?20:8,Q=(R.getTime()-Yo.getTime())/(1e3*60*60*24),xe=F.clientWidth,ht=Q*j*D-xe/2;Q>=0&&xe>0&&(F.scrollLeft=Math.max(0,ht));},[oe.length,Yo,tt,D]),jsx(un.Provider,{value:Va,children:jsx(ol.Provider,{value:z0,children:jsxs("div",{ref:En,className:"flex flex-col h-full w-full",style:{backgroundColor:Zt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Zt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Zt.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:Zt,timeScale:tt,onTimeScaleChange:qe,zoom:D,onZoomChange:Y,currentTheme:ye,onThemeChange:U,rowDensity:$,onRowDensityChange:se,showThemeSelector:u,showCreateTaskButton:w&&ue?.canCreateTask!==false&&!ue?.canCreateSubtaskOnly,createTaskLabel:T,onCreateTask:C,taskFilter:Ae,onTaskFilterChange:ot,hideCompleted:ae,onHideCompletedChange:me,toolbarRightContent:I,wbsLevel:ie,onWbsLevelChange:Nc,maxWbsDepth:Lt,viewMode:Le,onViewModeChange:Te,projectForecast:E,onExportPNG:i?tf:void 0,onExportPDF:i?af:void 0,onExportExcel:i?rf:void 0,onExportCSV:i?of:void 0,onExportJSON:i?nf:void 0,onExportMSProject:i?sf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:At,showDependencies:pt,onShowDependenciesChange:Dt,highlightWeekends:at,onHighlightWeekendsChange:mt,showBaseline:Be,onShowBaselineChange:F=>{F&&Le!=="oracle"&&Te("oracle"),!F&&Le==="oracle"&&Te("execution");},onCopySnapshotLink:Qe,hasDependencies:U0})}),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:Pc,theme:Zt,rowHeight:hs,availableUsers:d,templates:Mc,showCriticalPath:Ne,onTaskClick:L,onTaskDblClick:Ac,onTaskContextMenu:Ce,onTaskToggle:V0,scrollTop:B,columns:jo,onToggleColumn:W0,onColumnResize:G0,onTaskUpdate:Ko,onTaskIndent:_0,onTaskOutdent:j0,onTaskMove:Y0,onMultiTaskDelete:Ki,onTaskDuplicate:q0,onTaskCreate:X0,onTaskRename:J0,onCreateSubtask:Yi,onOpenTaskModal:L?F=>L(F):void 0,onDeleteRequest:(F,R)=>Ht({taskId:F,taskName:R}),onTaskReparent:K0,scrollContainerRef:bs})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Zt.border,zIndex:15},onMouseDown:lf}),jsx("div",{ref:Br,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:Pc,theme:Zt,rowHeight:hs,timeScale:tt,startDate:Yo,endDate:qi,zoom:D,locale:x,templates:Mc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:L,onTaskDblClick:Ac,onTaskContextMenu:Z0,onTaskDateChange:Q0,onDependencyCreate:Ic,onDependencyDelete:Bc,showBaseline:Be,showCriticalPath:Ne,showDependencies:pt,highlightWeekends:at,canEditTask:ue?.canEditTask})})]}),de.task&&jsx(gn,{isOpen:de.isOpen,x:de.x,y:de.y,theme:Zt,onClose:()=>_e({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=de.task;if(!F)return [];let R=Fe.findTaskById(oe,F.id)||F,j=R.subtasks&&R.subtasks.length>0,Q=ue?.canCreateTask!==false,xe=ue?.canDeleteTask!==false;if(j){let It=[],Xt=ue?.canDuplicateTask!==false;return Q&&It.push({id:"addSubtask",label:Va.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{We?We(R):Yi(R.id);}}),Xt&&It.push({id:"duplicate",label:Va.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):Oe(Ga=>Kn(Ga,[R.id]).tasks),_e({isOpen:false,x:0,y:0,task:null});}}),xe&&(It.length>0&&It.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),It.push({id:"delete",label:Va.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{Ht({taskId:R.id,taskName:R.name});}})),It}let Ee=ue?.canUpdateTask!==false,ht=ue?.canDuplicateTask!==false,et=[];return Ee&&et.push({id:"edit",label:Va.contextMenu?.editTask||"Edit Task",icon:Kt.Pencil,onClick:()=>{fe?fe(R):gt(R);}}),Q&&et.push({id:"addSubtask",label:Va.contextMenu?.addSubtask||"Add Subtask",icon:Kt.Add,onClick:()=>{We?We(R):Yi(R.id);}}),et.length>0&&Ee&&et.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ee&&(et.push({id:"markIncomplete",label:Va.contextMenu?.markIncomplete||"Mark Incomplete",icon:Kt.MarkIncomplete,onClick:()=>{z?z(R):Ko(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),et.push({id:"setInProgress",label:Va.contextMenu?.setInProgress||"Set In Progress",icon:Kt.SetInProgress,onClick:()=>{te?te(R):Ko(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),et.push({id:"markComplete",label:Va.contextMenu?.markComplete||"Mark Complete",icon:Kt.MarkComplete,onClick:()=>{Ko(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(ht||Ee&&R.startDate&&R.endDate)&&et.length>0&&et.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),ht&&et.push({id:"duplicate",label:Va.contextMenu?.duplicateTask||"Duplicate Task",icon:Kt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):Oe(It=>Kn(It,[R.id]).tasks),_e({isOpen:false,x:0,y:0,task:null});}}),Ee&&R.startDate&&R.endDate&&et.push({id:"split",label:Va.contextMenu?.splitTask||"Split Task",icon:Kt.Split,onClick:()=>{let It=R.startDate.getTime(),Xt=R.endDate.getTime(),Ga=It+(Xt-It)/2,lr=new Date(Ga);ef(R,lr);}}),xe&&(et.length>0&&et.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),et.push({id:"delete",label:Va.contextMenu?.deleteTask||"Delete Task",icon:Kt.Delete,onClick:()=>{Ht({taskId:R.id,taskName:R.name});}})),et})()}),jsx(Xr,{task:Ke,isOpen:!!Ke,onClose:()=>gt(null),onTaskUpdate:F=>{Ke&&(Ko(Ke.id,F),gt(null));},theme:ye==="light"?"light":"dark",locale:x==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Ot&&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:()=>Ht(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:Zt.bgSecondary,border:`1px solid ${Zt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Zt.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:Zt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Va.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Zt.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:Zt.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:Zt.textPrimary},children:['"',Ot.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Zt.bgPrimary,borderTop:`1px solid ${Zt.border}`},children:[jsx("button",{onClick:()=>Ht(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Zt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=Zt.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:x==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Ki([Ot.taskId]),Ht(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:oe,theme:Zt,config:f,onTasksUpdate:Oe,onTaskUpdate:Ko,onTaskCreate:F=>{Oe(R=>[...R,F]);},onTaskDelete:F=>{Ki([F]);},onDependencyCreate:(F,R)=>{let j=Fe.findTaskById(oe,F);j&&Ic(j,R);},onDependencyDelete:Bc})]})})})});function Wv(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 Gv(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}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:l=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:h,defaultStatus:y}){let v=[...fd,...i.filter(D=>!fd.some(Y=>Y.id===D.id))],f=nt[u]||nt.dark,[x,k]=useState(false),[w,T]=useState(false),[C,S]=useState(false),[N,I]=useState(false),[O,A]=useState({top:0,left:0}),[K,E]=useState(null),[ce,L]=useState(new Date),[q,Ce]=useState({top:0,left:0}),[je,M]=useState(false),[V,fe]=useState([]),[We,z]=useState(false),[te,X$1]=useState(""),Me=useRef(null),be=useRef(null),$e=useRef(null),De=useRef(null),Xe=useRef(null),[Z,Je]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[ue,Qe]=useState({});useEffect(()=>{a?(Je({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)&&M(true)):(Je({name:"",description:"",progress:0,status:y||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),M(false),fe([]));},[a,e,y]),useEffect(()=>{let D=Y=>{Me.current&&!Me.current.contains(Y.target)&&k(false),be.current&&!be.current.contains(Y.target)&&T(false),$e.current&&!$e.current.contains(Y.target)&&S(false),De.current&&!De.current.contains(Y.target)&&I(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let ct=()=>{let D={};return Z.name.trim()||(D.name="El nombre es requerido"),Z.startDate&&Z.endDate&&Z.startDate>Z.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),Qe(D),Object.keys(D).length===0},wt=async D=>{if(D.preventDefault(),!!ct())try{let Y=l==="create"&&V.length>0?{...Z,pendingFiles:V}:Z;await s(Y),fe([]),t();}catch(Y){console.error("Error submitting task:",Y);}},ye=(D,Y)=>{Je(ie=>{let we={...ie,[D]:Y};if(D==="status"){let W=Y;W==="todo"?we.progress=0:W==="in-progress"?(ie.progress===0||ie.progress===100)&&(we.progress=50):W==="completed"||W==="closed"?we.progress=100:(W==="in-review"||W==="review")&&(we.progress=75);}if(D==="progress"){let W=typeof Y=="number"?Y:parseInt(Y,10);W===100&&ie.status!=="completed"?we.status="completed":W>0&&W<100&&ie.status==="todo"?we.status="in-progress":W===0&&ie.status!=="todo"&&(we.status="todo");}return we}),ue[D]&&Qe(ie=>{let we={...ie};return delete we[D],we});},ut=v.find(D=>D.id===Z.status)??fd[0],tt=bd.find(D=>D.id===Z.priority)??bd[1],qe=Po.find(D=>D.value===Z.color)??Po[0],$=u==="dark",se={backgroundColor:$?"#141414":f.bgSecondary,border:`1px solid ${$?"#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:$?"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":u,style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,WebkitBackdropFilter:$?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:$?"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:ut.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:l==="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:wt,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:Z.name,onChange:D=>ye("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:Z.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),ue.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),ue.name]})]}),jsx("div",{children:jsx("textarea",{value:Z.description||"",onChange:D=>ye("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:Me,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:{...se,borderColor:ut.color,backgroundColor:`${ut.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:ut.color}}),jsx("span",{style:{color:ut.color},children:ut.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:ut.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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.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:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{ye("status",D.id),k(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,Z.status===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxs("div",{ref:be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&T(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:tt.color}}),jsx("span",{children:tt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children: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:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{ye("priority",D.id),T(false);},children:[jsx("span",{children:D.icon}),D.label,Z.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:$e,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&S(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[Z.assignees&&Z.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:Z.assignees.slice(0,3).map((D,Y)=>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},Y))}),Z.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",Z.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:C&&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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let Y=Z.assignees?.some(ie=>ie.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:ie=>ie.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=Y?(Z.assignees||[]).filter(we=>we.name!==D.name):[...Z.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(we=>we[0]).join("").toUpperCase().slice(0,2),color:f.accent}];ye("assignees",ie);},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:Y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxs("div",{ref:De,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(N)I(false);else {if(De.current){let D=De.current.getBoundingClientRect(),Y=window.innerHeight,ie=120,W=Y-D.bottom<ie?D.top-ie-8:D.bottom+8;A({top:W,left:D.left});}I(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Z.color}}),jsx("span",{children:qe.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:N&&jsxs(Bt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Po.slice(0,18).map(D=>{let Y=Z.color===D.value;return jsx("button",{type:"button",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),ye("color",D.value),I(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:Y?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),c.length>0||d?jsx(lo,{selectedTags:Z.tags||[],availableTags:c,onChange:D=>ye("tags",D),onCreateTag:d,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:Xe,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(K==="start")E(null);else {if(Xe.current){let D=Xe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,W=Y-D.bottom<ie?D.top-ie-8:D.bottom+8;Ce({top:W,left:D.left});}E("start"),L(Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.startDate?Z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(K==="end")E(null);else {if(Xe.current){let D=Xe.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,W=Y-D.bottom<ie?D.top-ie-8:D.bottom+8;Ce({top:W,left:D.left});}E("end"),L(Z.endDate||Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:Z.isMilestone?.5:1,cursor:Z.isMilestone?"not-allowed":"pointer"},disabled:n||Z.isMilestone,children:Z.endDate?Z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:K&&jsxs(Bt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:$?"#0a0a0a":f.bgPrimary,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${$?"#262626":f.border}`},children:[(()=>{let D=new Date,Y=new Date(D);Y.setDate(D.getDate()+1);let ie=new Date(D);ie.setDate(D.getDate()+7);let we=new Date(D);return we.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:Y},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:we}].map((ee,Le)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{K==="start"?(ye("startDate",ee.date),(!Z.endDate||ee.date>Z.endDate)&&ye("endDate",ee.date),E("end")):(ye("endDate",ee.date),(!Z.startDate||ee.date<Z.startDate)&&ye("startDate",ee.date),E(null));},children:ee.label},Le))})(),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:()=>{ye("startDate",void 0),ye("endDate",void 0),E(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>L(new Date(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:()=>L(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,Y)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},Y))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=ce.getFullYear(),Y=ce.getMonth(),ie=new Date(D,Y,1).getDay(),we=new Date(D,Y+1,0).getDate(),W=new Date,ee=[];for(let Te=ie-1;Te>=0;Te--)ee.push({day:new Date(D,Y,-Te).getDate(),date:new Date(D,Y-1,new Date(D,Y,-Te).getDate()),isCurrentMonth:false});for(let Te=1;Te<=we;Te++)ee.push({day:Te,date:new Date(D,Y,Te),isCurrentMonth:true});let Le=42-ee.length;for(let Te=1;Te<=Le;Te++)ee.push({day:Te,date:new Date(D,Y+1,Te),isCurrentMonth:false});return ee.map((Te,Be)=>{let Ne=Te.date.toDateString()===W.toDateString(),Ge=Z.startDate?.toDateString()===Te.date.toDateString(),pt=Z.endDate?.toDateString()===Te.date.toDateString(),it=Z.startDate&&Z.endDate&&Te.date>=Z.startDate&&Te.date<=Z.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Te.isCurrentMonth?Ge||pt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ge?f.accent:pt?"#7C3AED":it?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!Ge&&!pt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{K==="start"?(ye("startDate",Te.date),Z.endDate&&Te.date>Z.endDate&&ye("endDate",Te.date),E("end")):(ye("endDate",Te.date),Z.startDate&&Te.date<Z.startDate&&ye("startDate",Te.date),E(null));},children:Te.day},Be)})})()})]})]})]})})]}),ue.endDate&&jsx("span",{className:"text-xs text-red-400",children:ue.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:Z.progress,onChange:D=>ye("progress",parseInt(D.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:Z.progress<30?"#EF4444":Z.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:`${Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981"}20`,color:Z.progress<30?"#EF4444":Z.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[Z.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>M(!je),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 ${je?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:je&&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:Z.effortMinutes?Wv(Z.effortMinutes):"",onChange:D=>{let Y=Gv(D.target.value);ye("effortMinutes",Y);},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||p.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color: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 ",l==="create"?V.length>0&&`(${V.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(Ur,{cardId:"pending",attachments:V.map((D,Y)=>({id:`pending-${Y}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>fe(Y=>[...Y,...D]),onDelete:D=>{let Y=parseInt(D.replace("pending-",""),10);fe(ie=>ie.filter((we,W)=>W!==Y));},maxSizeMB:10,maxFiles:20}):jsx(Ur,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:h,maxSizeMB:10,maxFiles:20}),l==="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:Z.isMilestone,onChange:D=>ye("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"]}),Z.dependencies&&Z.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Z.dependencies.map(D=>{let Y=r.find(ie=>ie.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:[Y?.name||D.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ie=(Z.dependencies||[]).filter(we=>we!==D);ye("dependencies",ie);},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:()=>{z(!We),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:We&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsx("input",{type:"text",value:te,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=>te===""||D.name.toLowerCase().includes(te.toLowerCase())).map(D=>{let Y=Z.dependencies?.includes(D.id);return jsxs("button",{type:"button",onClick:()=>{let ie=Z.dependencies||[],we;Y?we=ie.filter(W=>W!==D.id):we=[...ie,D.id],ye("dependencies",we);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Y?`${f.accent}10`:"transparent"},onMouseEnter:ie=>{Y||(ie.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor=Y?`${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:Y?f.accent:"transparent",borderColor:Y?f.accent:f.borderLight},children:Y&&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:l==="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
@@ -410,7 +410,7 @@ If ambiguous, ask for clarification in the message field.`;function mm(e){return
410
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 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(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let u=l.name.toLowerCase();return n.every(i=>u.includes(i))})}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 p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let h=new Date(r),y=h.getDay(),v=g-y;return v<=0&&(v+=7),h.setDate(h.getDate()+v),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 p=parseInt(s[1],10),g=s[2].toLowerCase(),h=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?h.setDate(h.getDate()+p):g==="week"||g==="semana"||g==="semanas"?h.setDate(h.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&h.setMonth(h.getMonth()+p),h}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),g=parseInt(l[2],10)-1,h=parseInt(l[3],10);return new Date(h,g,p)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),g=u[i[2].toLowerCase()],h=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(h,g,p)}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},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=c[d[1].toLowerCase()],g=parseInt(d[2],10),h=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(h,p,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 i=r[1].trim(),c=r[2].trim(),d=ao(t,i),p=hd(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.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=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,h=new Date(p);return h.setDate(h.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:h},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),d=ao(t,i),p=yd(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),d=ao(t,i),p=xd(c);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,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 i=n[1].trim(),c=n[2].trim(),d=ao(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=ao(t,i),p=ao(t,c);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),c=ao(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function 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 _v(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 d=a.find(p=>p.id===c);return d?{name:d.name,initials:d.initials,color:d.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},l=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||l&&u&&Math.abs(u.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:u,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:i,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:_v(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),l=useRef(null);useEffect(()=>{let g=h=>{l.current&&!l.current.contains(h.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=vm(e),i=Cd[0],c=Cd.find(g=>g.value===u)??i,d=c.icon,p=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(d,{className:m("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(d,{className:m("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:m("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:m("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:y=>{y.stopPropagation(),t(g.value),n(false);},className:m("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",u===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(h,{className:m("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(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),l=useRef(null);useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let u=Td.find(c=>c.value===e)??Td[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:m("w-4 h-4",u.color)}),jsx("span",{className:m("text-sm",a?"text-white/60":"text-gray-500"),children:u.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:m("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:m("w-4 h-4",u.color)}),jsx("span",{className:m("text-sm",a?"text-white/60":"text-gray-500"),children:u.label[i]}),jsx(ChevronDown,{className:m("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:m("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:d=>{d.stopPropagation(),t(c.value),n(false);},className:m("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:m("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},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,l]=useState(false),[u,i]=useState(""),c=useRef(null),d=useRef(null);useEffect(()=>{let y=v=>{c.current&&!c.current.contains(v.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(y=>y.name.toLowerCase().includes(u.toLowerCase())),g=y=>e.some(v=>v.name===y),h=y=>{if(a){if(g(y.name))a(e.filter(v=>v.name!==y.name));else {let v={name:y.name,initials:Zn(y.name),color:y.color||Nd(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl,id:y.id};a([...e,v]);}l(false),i("");}};return s||!a?e.length===0?jsx("span",{className:m("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((y,v)=>jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!y.avatar&&Nd(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||Zn(y.name)},`${y.name}-${v}`)),e.length>3&&jsxs("div",{className:m("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:y=>{y.stopPropagation(),l(!n);},className:m("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:m("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:m("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((y,v)=>jsx("div",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!y.avatar&&Nd(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||Zn(y.name)},`${y.name}-${v}`)),e.length>2&&jsxs("span",{className:m("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:d,type:"text",value:u,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:y=>y.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((y,v)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:y.color?`${y.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:y.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:y.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||Zn(y.name)}),y.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(x=>x.name!==y.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}})})]},`${y.name}-${v}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(y=>{let v=g(y.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),h(y);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?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=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(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:y.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:y.avatarUrl?jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):Zn(y.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name}),v&&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"}})})]},y.id)})})]})]})}function Mm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:u}){let[i,c]=useState(false),[d,p]=useState(o),[g,h]=useState(()=>{let S=o==="start"?e:t;if(S){let N=S instanceof Date?S:new Date(S);return new Date(N.getFullYear(),N.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),y=useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let S=N=>{y.current&&!y.current.contains(N.target)&&c(false);};return i&&document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[i]),useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let x=S=>S?S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):u||"-",k=useCallback(()=>{let S=g.getFullYear(),N=g.getMonth(),I=new Date(S,N,1),A=new Date(S,N+1,0).getDate(),K=I.getDay(),E=[],L=new Date(S,N,0).getDate();for(let Ce=K-1;Ce>=0;Ce--)E.push({date:new Date(S,N-1,L-Ce),isCurrentMonth:false});for(let Ce=1;Ce<=A;Ce++)E.push({date:new Date(S,N,Ce),isCurrentMonth:true});let q=42-E.length;for(let Ce=1;Ce<=q;Ce++)E.push({date:new Date(S,N+1,Ce),isCurrentMonth:false});return E},[g]),w=S=>{if(r)o==="start"?a(S,f||void 0):a(v||void 0,S),c(false);else if(d==="start"){let N=f&&S>f?S:f;a(S,N||void 0),p("end");}else {let N=v&&S<v?S:v;a(N||void 0,S),c(false);}},T=()=>{let S=new Date,N=new Date(S);N.setDate(S.getDate()+1);let I=new Date(S);I.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let O=new Date(S);O.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let A=new Date(S);A.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let K=new Date(S);K.setDate(S.getDate()+14);let E=new Date(S);return E.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:I,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:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:K,display:K.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let S=r&&o==="start"?v:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:m("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:m("text-sm",s?"text-white/60":"text-gray-500"),children:x(S)})]})}let C=r&&o==="start"?v:f;return jsxs("div",{ref:y,className:"relative",children:[jsxs("button",{onClick:S=>{S.stopPropagation(),c(!i);let N=o==="start"?v:f;N&&h(new Date(N.getFullYear(),N.getMonth(),1));},className:m("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:m("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:m("text-sm",s?"text-white/60":"text-gray-500"),children:x(C)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxs("div",{className:m("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:S=>S.stopPropagation(),children:[jsxs("div",{className:m("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[T().map((S,N)=>jsxs("button",{className:m("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:()=>w(S.date),children:[jsx("span",{children:S.label}),jsx("span",{className:m("text-xs",s?"text-white/30":"text-gray-400"),children:S.display})]},N)),jsx("div",{className:m("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(v||void 0,void 0):a(void 0,void 0),c(false);},className:m("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:m("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:m("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:m("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:m("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:m("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>h(new Date(g.getFullYear(),g.getMonth()+1)),className:m("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:m("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(S=>jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:S},S))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:k().map((S,N)=>{let I=S.date.toDateString()===new Date().toDateString(),O=v?.toDateString()===S.date.toDateString(),A=f?.toDateString()===S.date.toDateString(),K=O||A,E=!r&&v&&f&&S.date>=v&&S.date<=f;return jsx("button",{onClick:()=>w(new Date(S.date)),className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),S.isCurrentMonth&&(s?"text-white":"text-gray-900"),I&&"ring-2 ring-[#007BFF]",O&&"bg-[#007BFF] text-white",A&&!O&&"bg-[#7C3AED] text-white",E&&!K&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!K&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:S.date.getDate()},N)})})]})]})]})]})}function Ni({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let u=e?e instanceof Date?e:new Date(e):null;return jsx(Mm,{startDate:s==="start"?u:n||null,endDate:s==="end"?u:l||null,onChange:(p,g)=>{t&&t(s==="start"?p: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),[l,u]=useState(false),i=useRef(e),c=useRef([]);return useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,p=e,g=p-d,h=r/o;u(true);for(let y=1;y<=o;y++){let v=setTimeout(()=>{let f=y/o,x=1-Math.pow(1-f,3),k=Math.round(d+g*x);n(k),y===o&&(u(false),n(p));},h*y);c.current.push(v);}return i.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Pm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,l]=useState(0),u=useRef(null),i=useRef(null),c=useCallback(g=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(g),l(0);let h=Date.now();i.current=setInterval(()=>{let y=Date.now()-h,v=Math.min(y/a*100,100);l(v);},16),u.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=useCallback(()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:d}}function Im({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:l}=wn(),{displayValue:u,isAnimating:i}=Di(e,{enabled:o,duration:300,steps:6}),c=p=>{if(r||!t)return;p.stopPropagation();let g=p.currentTarget.getBoundingClientRect(),h=p.clientX-g.left,y=Math.round(h/g.width*100),v=Math.max(0,Math.min(100,y));v!==e&&(t(v),s&&l());},d=u??e;return jsxs("div",{className:m("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:m("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:m("h-full rounded-full transition-[width]",d===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",i&&"transition-none"),style:{width:`${d}%`}})}),jsxs("span",{className:m("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[d,"%"]})]})}function Om({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[l,u]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{u(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?c():p.key==="Escape"&&(u(e),n(false));};return o||!t?jsx("span",{className:m("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:p=>u(p.target.value),onBlur:c,onKeyDown:d,onClick:p=>p.stopPropagation(),className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:m("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:l=true,enableSaveFlash:u=true}){let[i,c]=useState(false),[d,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:h,triggerFlash:y}=wn(),{displayValue:v,isAnimating:f}=Di(e,{enabled:l&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let x=()=>{let w=parseFloat(d);if(!isNaN(w)){let T=w;o!==void 0&&(T=Math.max(o,T)),s!==void 0&&(T=Math.min(s,T)),T!==e&&(t?.(T),u&&y());}c(false);},k=w=>{w.key==="Enter"?x():w.key==="Escape"&&(p(e?.toString()||""),c(false));};return n||!t?jsx("span",{className:m("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsx("input",{ref:g,type:"number",value:d,onChange:w=>p(w.target.value),onBlur:x,onKeyDown:k,onClick:w=>w.stopPropagation(),min:o,max:s,className:m("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:w=>{w.stopPropagation(),c(true);},className:m("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",v===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:v!==void 0?v:r})}function Um({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),u=useRef(null);return useEffect(()=>{let i=c=>{u.current&&!u.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:m("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:m("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:m("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:m("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:m("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:m("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:m("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===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function Gm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:u,startChange:i,cancelChange:c}=Pm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?c():i(!e):t(!e));},p=l?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:m("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${u/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:g=>{g.stopPropagation(),c();},className:m("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:m("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:m("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 S2(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 E2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),u=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+u}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:l=false,lens:u="hours",hourlyRate:i=0}){let[c,d]=useState(false),[p,g]=useState(""),h=useRef(null),{isFlashing:y,triggerFlash:v}=wn(),f=u==="financial"&&i>0,x=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:S2(e,r);useEffect(()=>{c&&h.current&&(h.current.focus(),h.current.select());},[c]),useEffect(()=>{if(e){let C=Math.floor(e/60),S=e%60;C>0&&S>0?g(`${C}h ${S}m`):C>0?g(`${C}h`):g(`${S}m`);}else g("");},[e,c]);let k=()=>{let C=E2(p);C!==e&&(t?.(C),n&&v()),d(false);},w=C=>{C.key==="Enter"?k():C.key==="Escape"&&d(false);};if(l)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:m("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 T=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(T,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:m("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:p,onChange:C=>g(C.target.value),onBlur:k,onKeyDown:w,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:m("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:C=>{C.stopPropagation(),d(true);},className:m("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",y&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(T,{className:m("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:m("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=l=>l.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let l=o==="es";return a===0?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:l?"En Tiempo":"On Track"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",l?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",l?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:m("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:l,lens:u="hours",hourlyRate:i=0}){let c=a==="es",d=u==="financial"&&i>0,p=M=>d?`$${Math.round(M*i).toLocaleString("en-US")}`:`${M}h`,[g,h]=useState(false),[y,v]=useState(false),[f,x]=useState(null),k=useRef(null),w=e.timeLoggedMinutes||0,T=e.effortMinutes||0,C=e.soldEffortMinutes||0,S=Math.round(w/60*10)/10,N=Math.round(T/60*10)/10,I=Math.round(C/60*10)/10,O=T>0?w/T*100:0,A=O>100?Math.round((w-T)/60*10)/10:0,K=O>100?"#FF2D20":O>=80?"#FFD60A":"#3BF06E";useEffect(()=>{if(!y&&!f)return;let M=V=>{k.current&&!k.current.contains(V.target)&&(v(false),x(null));};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[y,f]);let E=M=>{if(M.stopPropagation(),r&&!o&&!s){x("log");return}if(r||o||s){v(V=>!V),x(null);return}l&&l(e);},ce=M=>{v(false),x(M);},L=async(M,V)=>{f==="log"&&r&&M?r(e,M,V):f==="estimate"&&o?o(e,M):f==="quoted"&&s&&s(e,M),x(null);},q=r||o||s||l,Ce=[{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(M=>M.show),je=f==="estimate"?T:f==="quoted"?C:void 0;return T===0&&w===0&&C===0?jsxs("div",{ref:k,className:"relative flex items-center gap-2",onClick:M=>M.stopPropagation(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),children:[jsx("span",{className:m("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&q&&jsx("button",{onClick:E,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",M.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",M.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:Ce.map(M=>jsxs("button",{onClick:V=>{V.stopPropagation(),ce(M.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(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.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($r,{mode:f,locale:a,isDark:t,currentValue:je||void 0,onSave:L,onClose:()=>x(null)})})})})]}):jsxs("div",{ref:k,className:"relative flex items-center gap-2 w-full",onClick:M=>M.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:p(S)}),T>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(N)]}),A>0&&jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF2D20"},children:["+",p(A)," ",c?"Exceso":"Over"]})]}),T>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:K,borderRadius:2,transition:"width 0.3s"}})}),C>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:p(I)})]})]}),q&&jsx("button",{onClick:E,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:g?1:0,pointerEvents:g?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",M.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",M.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:Ce.map(M=>jsxs("button",{onClick:V=>{V.stopPropagation(),ce(M.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(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.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($r,{mode:f,locale:a,isDark:t,currentValue:je||void 0,onSave:L,onClose:()=>x(null)})})})})]})}function Zm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsx("span",{className:m("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:m("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsx("div",{className:m("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:m("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxs("span",{className:m("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var I2={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:m("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:m("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",I2[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 Z2(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:l,onColumnHide:u,onColumnSort:i,availableUsers:c=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g}){let h=useRef(null),y=r==="es"?rg.es:rg.en;if(useEffect(()=>{let w=C=>{h.current&&!h.current.contains(C.target)&&t();},T=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",w),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",T);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let w=[];return o&&w.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),w.push({id:"sep1",label:"",icon:null,separator:true}),l&&(w.push({id:"status",label:y.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),w.push({id:"priority",label:y.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&w.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(T=>({id:`assign-${T.id}`,label:T.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:T.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],N=C.some(I=>I.name===T.name)?C.filter(I=>I.name!==T.name):[...C,{name:T.name,initials:Q2(T.name),color:T.color||Z2(T.name),avatar:T.avatarUrl}];l({...e.task,assignees:N}),t();}}))})),d&&w.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&w.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&w.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),w.push({id:"sep2",label:"",icon:null,separator:true}),s&&w.push({id:"duplicate",label:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&w.push({id:"delete",label:y.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),w},f=()=>{if(!e.columnId)return [];let w=[];return i&&(w.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),w.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(w.push({id:"sep-hide",label:"",icon:null,separator:true}),w.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),w},x=e.type==="task"?v():f(),k={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:h,style:k,className:m("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:x.map(w=>w.separator?jsx("div",{className:m("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},w.id):w.submenu?jsx(e1,{item:w,isDark:a},w.id):jsxs("button",{onClick:w.onClick,className:m("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",w.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:m(w.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:w.icon}),w.label]},w.id))})}function e1({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:m("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:m("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:m("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var 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"})},h1=["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:l}){let[u,i]=useState(""),[c,d]=useState(null),p=useRef(null),g=l==="es"?gg.es:gg.en;if(useLayoutEffect(()=>{if(!e||!p.current)return;let w=()=>{if(!p.current)return;let T=p.current.getBoundingClientRect(),S=window.innerHeight-T.top-20;d(Math.max(300,S));};return requestAnimationFrame(w),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[e]),useEffect(()=>{if(!e)return;let w=setTimeout(()=>{let T=S=>{p.current&&!p.current.contains(S.target)&&t();},C=S=>{S.key==="Escape"&&t();};document.addEventListener("mousedown",T),document.addEventListener("keydown",C),p._cleanup=()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(w),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let h=w=>g.columns[w]||w,y=w=>{if(w==="name")return;let T=a.map(C=>C.id===w?{...C,visible:!C.visible}:C);o(T);},v=(w,T)=>{let C=a.find(N=>N.type===w&&(!T||N.customFieldId===T));if(C){y(C.id);return}let S={id:T||w,type:w,label:T?r.find(N=>N.id===T)?.name||w:h(w),width:120,visible:true,sortable:true,resizable:true,customFieldId:T};o([...a,S]);},f=h1.filter(w=>h(w).toLowerCase().includes(u.toLowerCase())),x=r.filter(w=>w.name.toLowerCase().includes(u.toLowerCase())),k=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:p,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:w=>{w.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",w.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent",w.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:u,onChange:w=>i(w.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:w=>{w&&w.style.setProperty("--focus-border",k);},onFocus:w=>{w.currentTarget.style.borderColor=k,w.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:w=>{w.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",w.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:w=>w.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(w=>{let T=a.find(N=>N.type===w&&!N.customFieldId),C=T?.visible??false,S=w==="name";return jsxs("button",{onClick:()=>{S||(T?y(T.id):v(w));},disabled:S,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:S?.4:1,cursor:S?"not-allowed":"pointer"},onMouseEnter:N=>{S||(N.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:N=>{N.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:C?k:"transparent",border:C?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${k}40`:"none"},children:C&&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:C?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:mg[w]}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?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(w)})]},w)})})]}),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(w=>{let C=a.find(S=>S.customFieldId===w.id)?.visible??false;return jsxs("button",{onClick:()=>v(w.type,w.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:S=>{S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:S=>{S.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:C?k:"transparent",border:C?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${k}40`:"none"},children:C&&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:C?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:mg[w.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?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:w.name})]},w.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 D1=[{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(""),[l,u]=useState("text"),[i,c]=useState([""]),d=o==="es"?hg.es:hg.en;useEffect(()=>{e&&(n(""),u("text"),c([""]));},[e]),useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let p=()=>{if(!s.trim())return;let v={name:s.trim(),type:l};l==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{c([...i,""]);},h=(v,f)=>{let x=[...i];x[v]=f,c(x);},y=v=>{i.length>1&&c(i.filter((f,x)=>x!==v));};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:m("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:m("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:m("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:m("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:m("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:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:d.fieldNamePlaceholder,className:m("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:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:D1.map(v=>jsxs("button",{onClick:()=>u(v.type),className:m("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsx("span",{className:m("text-xs",l===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[v.type]})]},v.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:v,onChange:x=>h(f,x.target.value),placeholder:`${d.option} ${f+1}`,className:m("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")}),i.length>1&&jsx("button",{onClick:()=>y(f),className:m("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:m("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:m("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:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var 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,l]=useState(false),u=useRef(null),i=useRef(0),c=s==="es"?wg.es:wg.en;useEffect(()=>{if(!n)return;let g=y=>{Date.now()-i.current<100||u.current&&!u.current.contains(y.target)&&l(false);},h=y=>{y.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",h);}},[n]);let d=[{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"}],p=e!=="all"||t;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(h=>!h);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),c.filters,p&&jsx("span",{className:m("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:m("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:m("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:m("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let h=e===g.value&&!t,y=()=>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),l(false);},className:m("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:m(h?g.color:"text-gray-400","flex-shrink-0"),children:y()}),jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),h&&jsx(Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:m("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"),l(false);},className:m("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:m("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:m("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:m("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:m("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:m("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:m("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,l=n>0?Math.min(Math.round(s/n*100),100):0,u=s>n&&n>0,i=u?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:m("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:m("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:m("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:m("text-[11px] font-mono font-bold",u?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Cg(s)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:m("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:m("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Cg(n)})]}),n>0&&jsx("div",{className:m("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:m("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:m("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:m("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:m("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:m("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:m("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:m("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:m("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,l=s<0,u=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:m("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:u})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:m("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 l=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:m("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxs("span",{className:m("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsx("div",{className:m("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:l}})})]},`${s.name}-${n}`)})})]})]})}var W1=[{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 Mg(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(...Mg(r.subtasks,t+1));return a}function G1(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(),u=s.endDate.getTime()-n;if(u<=0)continue;let c=Math.max(0,Math.min(a.getTime()-n,u))/u*100;if(c<=0)continue;let d=(s.progress||0)/c;r+=d,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 Pg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:u=[],toolbarRightContent:i}){let{theme:c="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:h=true,tableColumns:y,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:x=true,showCreateTaskButton:k=false,onCreateTask:w,persistFilter:T=false,financialBlur:C,healthSidebar:S,lens:N="hours",hourlyRate:I=0,aggregateParentHours:O=false,showProjectTotals:A=false}=t,K=ki(d,p),E=c==="dark",ce=useCallback(()=>{if(!T||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let b=localStorage.getItem(T);if(b){let B=JSON.parse(b);return {statusFilter:B.statusFilter||"all",hideCompleted:B.hideCompleted||!1}}}catch(b){console.error("Error loading persisted filter:",b);}return {statusFilter:"all",hideCompleted:false}},[T]),L=useMemo(()=>{function b(B){let H=0,_=0,ne=0;for(let he of B)if(he.subtasks&&he.subtasks.length>0){let J=b(he.subtasks);H+=J.spent,_+=J.allocated,ne+=J.quoted;}else H+=he.timeLoggedMinutes??0,_+=he.effortMinutes??0,ne+=he.soldEffortMinutes??0;return {spent:H,allocated:_,quoted:ne}}return b(e)},[e]),q=useMemo(()=>!S?.enabled||!S.data?S:{...S,data:{...S.data,totalHoursSpentMinutes:L.spent,totalHoursAllocatedMinutes:L.allocated}},[S,L]),[Ce,je]=useState(true),[M,V]=useState("position"),[fe,We]=useState("asc"),[z,te]=useState(""),[X,Me]=useState(()=>ce().statusFilter),[be,$e]=useState(()=>ce().hideCompleted),[De,Xe]=useState(y||W1),[Z,Je]=useState(false),[ue,Qe]=useState(false),[ct,wt]=useState({isOpen:false,x:0,y:0,type:"task"}),[ye,ut]=useState(null),[tt,qe]=useState(0),[$,se]=useState(0),D=useRef(null),[Y,ie]=useState(null),[we,W]=useState(null);useEffect(()=>{y&&Xe(y);},[y]),useEffect(()=>{if(!(!T||typeof window>"u"))try{localStorage.setItem(T,JSON.stringify({statusFilter:X,hideCompleted:be}));}catch(b){console.error("Error persisting filter state:",b);}},[T,X,be]);let ee=useMemo(()=>{let b=new Set;function B(H){for(let _ of H)_.subtasks?.length&&(_.isExpanded!==false&&b.add(_.id),B(_.subtasks));}return B(e),b},[e]),Le=useMemo(()=>De.filter(b=>b.visible),[De]),Te=useCallback(b=>{a.onTaskToggleExpand?.(b);},[a]),Be=useCallback(b=>{M===b?We(B=>B==="asc"?"desc":"asc"):(V(b),We("asc")),a.onSortChange?.({column:b,direction:fe==="asc"?"desc":"asc"});},[M,fe,a]),Ne=useCallback(b=>{Xe(b),a.onColumnsChange?.(b);},[a]),Ge=useCallback(b=>{let B=De.map(H=>H.id===b?{...H,visible:false}:H);Ne(B);},[De,Ne]),pt=useCallback((b,B)=>{V(b),We(B);},[]),it=useCallback((b,B,H)=>{x&&(b.preventDefault(),wt({isOpen:true,x:b.clientX,y:b.clientY,type:B?"task":"header",task:B,columnId:H}));},[x]),at=useCallback(()=>{wt(b=>({...b,isOpen:false}));},[]),Ze=useCallback((b,B)=>{if(!f)return;b.preventDefault(),b.stopPropagation();let H=De.find(_=>_.id===B);H&&(ut(B),qe(b.clientX),se(H.width));},[De,f]);useEffect(()=>{if(!ye)return;let b=H=>{let _=H.clientX-tt,ne=Math.max(50,$+_),he=De.map(J=>J.id===ye?{...J,width:ne}:J);Xe(he);},B=()=>{ye&&a.onColumnsChange?.(De),ut(null);};return document.addEventListener("mousemove",b),document.addEventListener("mouseup",B),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",B);}},[ye,tt,$,De,a]);let At=useCallback((b,B)=>{if(B==="name"){b.preventDefault();return}ie(B),b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("text/plain",B),b.currentTarget instanceof HTMLElement&&(b.currentTarget.style.opacity="0.5");},[]),Dt=useCallback(b=>{b.currentTarget instanceof HTMLElement&&(b.currentTarget.style.opacity="1"),ie(null),W(null);},[]),mt=useCallback((b,B)=>{b.preventDefault(),B!=="name"&&(b.dataTransfer.dropEffect="move",W(B));},[]),bt=useCallback(()=>{W(null);},[]),lt=useCallback((b,B)=>{if(b.preventDefault(),!Y||Y===B||B==="name")return;let H=[...De],_=H.findIndex(J=>J.id===Y),ne=H.findIndex(J=>J.id===B);if(_===-1||ne===-1)return;let he=H.splice(_,1);he[0]&&(H.splice(ne,0,he[0]),Ne(H),ie(null),W(null));},[Y,De,Ne]),St=useCallback(async b=>{if(a.onCreateCustomField){let B={...b,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(B);}Qe(false);},[a]),Re=useCallback(b=>b.progress===100||b.status==="completed"?"completed":b.progress&&b.progress>0||b.status==="in-progress"?"in-progress":"todo",[]),Ae=useMemo(()=>{let b=Mg(e);if(z.trim()){let B=z.toLowerCase();b=b.filter(H=>H.name.toLowerCase().includes(B));}return X!=="all"&&(b=b.filter(B=>Re(B)===X)),be&&(b=b.filter(B=>Re(B)!=="completed")),b.sort((B,H)=>{let _,ne;switch(M){case "name":_=B.name.toLowerCase(),ne=H.name.toLowerCase();break;case "startDate":_=B.startDate?.getTime()||0,ne=H.startDate?.getTime()||0;break;case "endDate":_=B.endDate?.getTime()||0,ne=H.endDate?.getTime()||0;break;case "progress":_=B.progress||0,ne=H.progress||0;break;case "status":_=B.status||"todo",ne=H.status||"todo";break;case "priority":let he={urgent:0,high:1,medium:2,low:3,none:4};_=he[B.priority]??4,ne=he[H.priority]??4;break;case "position":return 0;default:return 0}return _<ne?fe==="asc"?-1:1:_>ne?fe==="asc"?1:-1:0}),b},[e,z,X,be,M,fe,Re]),ot=useCallback((b,B)=>{let H=he=>{a.onTaskUpdate?.({...b,...he});},_=he=>he?b.customFields?.find(de=>de.fieldId===he)?.value:void 0,ne=(he,J)=>{if(!he)return;let _e=[...b.customFields||[]],Ke=_e.findIndex(gt=>gt.fieldId===he);Ke>=0?_e[Ke]={fieldId:he,value:J}:_e.push({fieldId:he,value:J}),H({customFields:_e});};switch(B.type){case "name":return null;case "status":return jsx(wm,{value:b.status||(b.progress===100?"completed":b.progress&&b.progress>0?"in-progress":"todo"),onChange:J=>{H({status:J,progress:J==="completed"?100:J==="in-progress"?50:0});},isDark:E,locale:d,translations:K.status});case "priority":return jsx(Cm,{value:b.priority,onChange:J=>H({priority:J}),isDark:E,locale:d});case "assignees":return jsx(Sm,{value:b.assignees||[],availableUsers:l,onChange:J=>H({assignees:J}),isDark:E,locale:d});case "startDate":return jsx(Ni,{value:b.startDate,onChange:J=>H({startDate:J}),isDark:E,locale:d,dateField:"start",startDate:b.startDate,endDate:b.endDate});case "endDate":return jsx(Ni,{value:b.endDate,onChange:J=>H({endDate:J}),isDark:E,locale:d,dateField:"end",startDate:b.startDate,endDate:b.endDate});case "progress":return jsx(Im,{value:b.progress||0,onChange:J=>{let de=J===100?"completed":J>0?"in-progress":"todo";H({progress:J,status:de});},isDark:E});case "tags":return jsx(jm,{value:b.tags||[],isDark:E});case "text":return jsx(Om,{value:_(B.customFieldId)||"",onChange:J=>ne(B.customFieldId,J),isDark:E});case "number":return jsx(zm,{value:_(B.customFieldId)||0,onChange:J=>ne(B.customFieldId,J),isDark:E});case "date":let he=_(B.customFieldId);return jsx(Ni,{value:he?new Date(he):void 0,onChange:J=>ne(B.customFieldId,J),isDark:E,locale:d});case "dropdown":return jsx(Um,{value:_(B.customFieldId)||"",options:B.options||[],onChange:J=>ne(B.customFieldId,J),isDark:E});case "checkbox":return jsx(Gm,{value:_(B.customFieldId)||false,onChange:J=>ne(B.customFieldId,J),isDark:E});case "estimatedTime":{let J=b.status==="completed"||b.progress===100;return jsx(mr,{value:b.estimatedTime,onChange:de=>H({estimatedTime:de}),isDark:E,locale:d,disabled:J,lens:N,hourlyRate:I})}case "quotedTime":{let J=b.status==="completed"||b.progress===100,de=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsx(mr,{value:b.quotedTime,onChange:_e=>H({quotedTime:_e}),isDark:E,locale:d,disabled:J,isBlurred:de,lens:N,hourlyRate:I})}case "elapsedTime":{let J=b.status==="completed"||b.progress===100;return jsx(mr,{value:b.elapsedTime,onChange:de=>H({elapsedTime:de}),isDark:E,locale:d,disabled:J,lens:N,hourlyRate:I})}case "effortMinutes":{if(O&&b.subtasks&&b.subtasks.length>0){let{allocated:de}=Nn(b);return jsx(mr,{value:de>0?de:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I})}let J=b.status==="completed"||b.progress===100;return jsx(mr,{value:b.effortMinutes,onChange:de=>H({effortMinutes:de}),isDark:E,locale:d,disabled:J,lens:N,hourlyRate:I})}case "timeLoggedMinutes":{if(O&&b.subtasks&&b.subtasks.length>0){let{spent:de}=Nn(b);return jsx(mr,{value:de>0?de:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I})}let J=b.status==="completed"||b.progress===100;return jsx(mr,{value:b.timeLoggedMinutes,onChange:a.onLogTime?de=>{a.onLogTime?.(b,de);}:void 0,isDark:E,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:J,lens:N,hourlyRate:I})}case "soldEffortMinutes":{if(O&&b.subtasks&&b.subtasks.length>0){let{quoted:_e}=Nn(b),Ke=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsx(mr,{value:_e>0?_e:void 0,isDark:E,locale:d,disabled:true,isBlurred:Ke,lens:N,hourlyRate:I})}let J=b.status==="completed"||b.progress===100,de=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsx(mr,{value:b.soldEffortMinutes,onChange:_e=>H({soldEffortMinutes:_e}),isDark:E,locale:d,disabled:J,isBlurred:de,lens:N,hourlyRate:I})}case "scheduleVariance":return jsx(Xm,{startDate:b.startDate,endDate:b.endDate,scheduleVariance:b.scheduleVariance,isDark:E,locale:d});case "hoursBar":{if(O&&b.hasChildren){let{spent:J,allocated:de,quoted:_e}=Nn(b),Ke=J>de&&de>0;return jsxs("span",{className:m("text-[11px] font-mono flex items-center gap-1.5",E?"text-white/50":"text-gray-500"),children:[jsx("span",{className:m("font-bold",Ke?"text-[#FF453A]":E?"text-white/80":"text-gray-800"),children:Tn(J)}),de>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:E?"text-white/60":"text-gray-600",children:Tn(de)})]}),_e>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:E?"text-amber-400/70":"text-amber-600",children:Tn(_e)})]})]})}return jsx(Qm,{task:b,isDark:E,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:N,hourlyRate:I})}case "teamLoad":return jsx(Zm,{task:b,isDark:E});case "blockers":return jsx(tg,{blockers:b.blockers,isDark:E,locale:d});default:return jsx("span",{className:m("text-sm",E?"text-white/60":"text-gray-500"),children:"-"})}},[a,E,d,l,K,O]),ae=useCallback(b=>{let H={name:K.columns.name,status:K.columns.status,priority:K.columns.priority,assignees:K.columns.assignees,startDate:K.columns.startDate,endDate:K.columns.endDate,progress:K.columns.progress,tags:K.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:K.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:K.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:K.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:K.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:K.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:K.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:K.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:K.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:K.columns.teamLoad||(d==="es"?"Carga Equipo":"Team Load"),blockers:K.columns.blockers||(d==="es"?"Bloqueantes":"Blockers")}[b.type]||b.label;return typeof H=="string"?H:String(H||b.type)},[K,d]),ge=useMemo(()=>{let H=Le.reduce((ne,he)=>ne+he.width,0)+(v?48:0),_={};for(let ne of Le)_[ne.id]=`${ne.width/H*100}%`;return _},[Le,v]);return r?jsx("div",{className:m("flex-1 flex items-center justify-center",E?"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:m("text-sm",E?"text-white/60":"text-gray-600"),children:[K.empty.noTasks,"..."]})]})}):o?jsx("div",{className:m("flex-1 flex items-center justify-center",E?"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:m("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:m("text-sm",E?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:m("flex-1 flex items-center justify-center",E?"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:m("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:K.empty.noTasks}),jsx("p",{className:m("text-sm",E?"text-white/60":"text-gray-600"),children:K.empty.addFirstTask})]})}):jsxs("div",{ref:D,className:m(E?"bg-[#0D0D0D]":"bg-white",ye&&"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:m("flex-shrink-0 px-6 py-4 border-b",E?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:m("text-sm",E?"text-white/60":"text-gray-600"),children:[Ae.length," ",K.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",E?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:z,onChange:b=>te(b.target.value),placeholder:K.toolbar.searchPlaceholder,className:m("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",E?"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"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),jsx(kg,{value:X,hideCompleted:be,onChange:Me,onHideCompletedChange:$e,isDark:E,locale:d}),q?.enabled&&q.data&&!Ce&&jsx("button",{onClick:()=>je(true),className:m("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",E?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),k&&w&&jsxs(motion.button,{onClick:w,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:K.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:m("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",E?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Le.map(b=>{let B=b.id!=="name",H=we===b.id&&Y!==b.id;return jsxs("div",{className:m("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",E?"text-white/60":"text-gray-500",B&&"cursor-grab",Y===b.id&&"opacity-50",H&&(E?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:ge[b.id],minWidth:b.minWidth},draggable:B,onDragStart:B?_=>At(_,b.id):void 0,onDragEnd:B?Dt:void 0,onDragOver:B?_=>mt(_,b.id):void 0,onDragLeave:B?bt:void 0,onDrop:B?_=>lt(_,b.id):void 0,onContextMenu:_=>it(_,void 0,b.id),children:[B&&jsx(GripVertical,{className:m("w-3 h-3 flex-shrink-0 transition-opacity",E?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),b.sortable?jsxs("button",{draggable:false,onClick:()=>Be(b.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[ae(b),jsx(ArrowUpDown,{className:m("w-3 h-3",M===b.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:ae(b)}),f&&b.resizable&&jsx("div",{className:m("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ye===b.id&&"bg-[#007BFF]"),onMouseDown:_=>Ze(_,b.id)})]},b.id)}),v&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:b=>{b.stopPropagation(),Je(B=>!B);},className:m("p-0.5 rounded transition-colors",E?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Z&&(E?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(fg,{isOpen:Z,onClose:()=>Je(false),columns:De,customFields:u,onColumnsChange:Ne,onCreateCustomField:()=>{Je(false),Qe(true);},isDark:E,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ae.map((b,B)=>{let H=ee.has(b.id),_=Math.min(B*.01,.2),ne=b.hasChildren&&b.level===0,he=b.subtasks?.length||0;if(ne){let{spent:J,allocated:de,quoted:_e}=Nn(b),Ke=G1(b),gt=V1(b);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:_},className:m("flex items-center border-y cursor-pointer",E?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>Te(b.id),children:Le.map(Ot=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:ge[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Ht=>{Ht.stopPropagation(),Te(b.id);},className:m("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:H?jsx(ChevronDown,{className:m("w-4 h-4",E?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:m("w-4 h-4",E?"text-white/40":"text-gray-500")})}),H?jsx(FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"}}),b.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"},children:b.wbsCode}),jsx("span",{title:b.name,className:m("text-[11px] font-semibold uppercase tracking-wide truncate",E?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:b.name}),jsxs("span",{className:m("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",E?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",he," ",d==="es"?he===1?"Tarea":"Tareas":he===1?"Item":"Items",")"]}),Ke!==null&&jsxs("span",{className:m("text-[10px] font-mono flex-shrink-0",Ke>=1?"text-[#32D74B]":Ke>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",Ke.toFixed(2)]}),gt>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",gt]})]}):Ot.type==="timeLoggedMinutes"?jsx(mr,{value:J>0?J:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I}):Ot.type==="soldEffortMinutes"?jsx(mr,{value:_e>0?_e:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I}):Ot.type==="effortMinutes"?jsx(mr,{value:de>0?de:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I}):ot(b,Ot)},Ot.id))},b.id)}return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:_},className:m("flex items-center border-b transition-colors",E?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(b),onDoubleClick:()=>a.onTaskDoubleClick?.(b),onContextMenu:J=>it(J,b),children:[Le.map(J=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:ge[J.id],minWidth:J.minWidth},children:J.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[h&&b.level>0&&jsx("div",{style:{width:`${b.level*24}px`},className:"flex-shrink-0"}),h&&b.hasChildren&&jsx("button",{onClick:de=>{de.stopPropagation(),Te(b.id);},className:m("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:H?jsx(ChevronDown,{className:m("w-4 h-4",E?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:m("w-4 h-4",E?"text-white/60":"text-gray-400")})}),h&&!b.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(b.wbsCode||b.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[b.wbsCode&&jsx("span",{className:m("text-[10px] font-mono",E?"text-[#007BFF]":"text-blue-600"),children:b.wbsCode}),b.taskCode&&jsx("span",{className:m("text-[10px] font-mono",E?"text-white/40":"text-gray-400"),children:b.taskCode})]}),jsx("span",{className:m("truncate font-bold text-[13px]",E?"text-white":"text-gray-900",b.progress===100&&(E?"line-through text-white/30":"line-through text-gray-400")),children:b.name}),b.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${b.tags[0].color}20`,color:b.tags[0].color},children:b.tags[0].name})]})]}):ot(b,J)},J.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},b.id)})}),A&&Ae.length>0&&(()=>{let{spent:b,allocated:B,quoted:H}=L,_=B-b,ne=_<0,he=ne?`+${Tn(Math.abs(_))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Tn(_)} ${d==="es"?"AHORRADO":"SAVED"}`,J=N==="financial"&&I>0,de=gt=>J?`$${(gt/60*I).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Tn(gt),_e=J?Math.abs(_/60*I):0,Ke=J?`${ne?"+":"-"}$${_e.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ne?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:he;return jsxs("div",{className:m("flex items-center sticky bottom-0 z-10",E?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:E?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Le.map(gt=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:ge[gt.id],minWidth:gt.minWidth},children:gt.type==="name"?jsx("span",{className:m("text-[11px] font-black uppercase tracking-widest",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):gt.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:m("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:de(b)}),jsx("span",{className:m("text-[11px]",E?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:m("text-[11px]",E?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:de(B)}),B>0&&jsx("span",{className:m("text-[10px] font-semibold ml-1",ne?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:J?Ke:he})]}):gt.type==="soldEffortMinutes"?jsx("span",{className:m("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:H>0?de(H):"\u2013"}):gt.type==="effortMinutes"?jsx("span",{className:m("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:B>0?de(B):"\u2013"}):gt.type==="timeLoggedMinutes"?jsx("span",{className:m("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:b>0?de(b):"\u2013"}):jsx("span",{className:m("text-[11px]",E?"text-white/30":"text-gray-300"),children:"\u2013"})},gt.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ae.length===0&&z&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:m("w-12 h-12 mx-auto mb-4",E?"text-white/30":"text-gray-400")}),jsx("p",{className:m(E?"text-white/60":"text-gray-600"),children:K.empty.noResults})]})})]})}),q?.enabled&&q.data&&Ce&&jsx(Tg,{data:q.data,isDark:E,locale:d,onClose:()=>je(false)})]}),jsx(ng,{state:ct,onClose:at,isDark:E,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ge,onColumnSort:pt,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(yg,{isOpen:ue,onClose:()=>Qe(false),onSave:St,isDark:E,locale:d})]})}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 Gd={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"}},Li={en:Gd,es:Vd};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:m("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Gg=26,Q1=22,Z1=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 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 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 e5({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:u,spanCols:i,lane:c,isStart:d,isEnd:p}=e,g=u.progress===100||u.status==="completed",h=u.isCriticalPath,y=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",v=p?Kd(u.effortMinutes,n,l):null,f=p?Vg(u,n,l):null,x=p?u.blockers?.find(k=>k.severity==="critical"):null;return jsxs(motion.button,{onClick:k=>{k.stopPropagation(),a();},whileHover:{scale:1.005},className:m("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",y,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*Gg}px`,left:"1px",width:`calc(${i*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:d?"3px":void 0,borderLeftColor:d?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&&d&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:u.name}),p&&(v||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:m(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]}),u.progress>0&&u.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${u.progress}%`}})]})}function _g({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:u=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:p,currentUser:g,mentionableUsers:h,onUploadCommentAttachments:y,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,timerState:w,onLogTime:T,onUpdateEstimate:C,onUpdateSoldEffort:S,onStartTimer:N,onStopTimer:I,onDiscardTimer:O,blurFinancials:A=false,suppressDetailModal:K=false,lens:E="hours",hourlyRate:ce=0}){let{theme:L="dark",locale:q="en",customTranslations:Ce,showBacklog:je=true}=t,M=Ii(q,Ce),V=L==="dark"||L==="neutral",[fe,We]=useState(r||new Date),[z,te]=useState(null),[X$1,Me]=useState(null),[be,$e]=useState(null),[De,Xe]=useState({}),Z=3,Je=3,ue=useCallback(W=>{Me(W.id),K||te(W),v?.(W.id);},[K,v]),[Qe,ct]=useState(null),wt=useCallback(()=>{We(new Date(fe.getFullYear(),fe.getMonth()-1,1));},[fe]),ye=useCallback(()=>{We(new Date(fe.getFullYear(),fe.getMonth()+1,1));},[fe]),ut=useCallback(()=>{We(new Date);},[]),tt=useMemo(()=>{let W=fe.getFullYear(),ee=fe.getMonth(),Le=new Date(W,ee,1),Te=new Date(W,ee+1,0),Be=Le.getDay(),Ne=Te.getDate(),Ge=ns(e),pt=new Date;pt.setHours(0,0,0,0);let it=[],at=Be,Ze=new Date(W,ee,0).getDate();for(let Dt=at-1;Dt>=0;Dt--){let mt=new Date(W,ee-1,Ze-Dt);it.push({date:mt,isCurrentMonth:false,isToday:false,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ge.filter(bt=>jd(mt,bt)).map(bt=>({id:bt.id,title:bt.name,start:bt.startDate,end:bt.endDate,task:bt}))});}for(let Dt=1;Dt<=Ne;Dt++){let mt=new Date(W,ee,Dt),bt=mt.getTime()===pt.getTime();it.push({date:mt,isCurrentMonth:true,isToday:bt,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ge.filter(lt=>jd(mt,lt)).map(lt=>({id:lt.id,title:lt.name,start:lt.startDate,end:lt.endDate,task:lt}))});}let At=42-it.length;for(let Dt=1;Dt<=At;Dt++){let mt=new Date(W,ee+1,Dt);it.push({date:mt,isCurrentMonth:false,isToday:false,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ge.filter(bt=>jd(mt,bt)).map(bt=>({id:bt.id,title:bt.name,start:bt.startDate,end:bt.endDate,task:bt}))});}return it},[fe,e]),qe=useMemo(()=>ns(e).filter(W=>!W.startDate||!W.endDate),[e]),$=useMemo(()=>{let W=ns(e),ee=0,Le=0,Te=0,Be=0,Ne=0;W.forEach(Ze=>{Ze.effortMinutes&&(ee+=Ze.effortMinutes),Ze.soldEffortMinutes&&(Le+=Ze.soldEffortMinutes),Ze.scheduleVariance!=null&&(Te+=Ze.scheduleVariance,Be++),Ze.soldEffortMinutes&&Ze.effortMinutes&&(Ne+=Ze.soldEffortMinutes-Ze.effortMinutes);});let Ge=Le>0?Math.min(100,Math.round(ee/Le*100)):0,pt=Be>0?Math.round(Te/Be):0,at=`${Ne<0?"-":"+"}${Wg(Ne,E,ce)}`;return {budgetUtil:Ge,avgVariance:pt,costDisplay:at,hasCostData:Le>0}},[e,E,ce]),se=useMemo(()=>{let W=[0,0,0,0,0,0];return tt.forEach((ee,Le)=>{let Te=Math.floor(Le/7);ee.events.forEach(Be=>{if(Be.task.startDate&&Be.task.soldEffortMinutes){let Ne=new Date(Be.task.startDate),Ge=ee.date;Ne.getFullYear()===Ge.getFullYear()&&Ne.getMonth()===Ge.getMonth()&&Ne.getDate()===Ge.getDate()&&Te<W.length&&(W[Te]-=Be.task.soldEffortMinutes);}});}),W},[tt]),D=useMemo(()=>{let W=ns(e),ee=new Map,Le=new Set,Te=[0,0,0,0,0,0];if(tt.length===0)return {segmentsByCell:ee,multiDayTaskIds:Le,maxLanesPerRow:Te};let Be=at=>new Date(at.getFullYear(),at.getMonth(),at.getDate()),Ne=Be(tt[0].date),Ge=Be(tt[tt.length-1].date),pt=[];for(let at of W){if(!at.startDate||!at.endDate)continue;let Ze=Be(at.startDate),At=Be(at.endDate);if(Ze.getTime()===At.getTime()||At<Ne||Ze>Ge)continue;let Dt=Ze<Ne?Ne:Ze,mt=At>Ge?Ge:At,bt=Ug(Dt,Ne),lt=Ug(mt,Ne);bt<0||bt>41||lt<0||lt>41||bt!==lt&&(Le.add(at.id),pt.push({task:at,startIdx:bt,endIdx:lt}));}pt.sort((at,Ze)=>at.startIdx!==Ze.startIdx?at.startIdx-Ze.startIdx:Ze.endIdx-Ze.startIdx-(at.endIdx-at.startIdx));let it=[[],[],[],[],[],[]];for(let{task:at,startIdx:Ze,endIdx:At}of pt){let Dt=Math.floor(Ze/7),mt=Math.floor(At/7),bt=Be(at.startDate),lt=Be(at.endDate),St=false;for(let Re=Dt;Re<=mt;Re++){let Ae=Re===Dt?Ze%7:0,ot=Re===mt?At%7:6,ae=ot-Ae+1,ge=0,b=it[Re]??[];for(it[Re]||(it[Re]=b);ge<b.length&&(b[ge]??-1)>=Ae;)ge++;if(ge>=Z1){St=true;break}ge>=b.length?b.push(ot):b[ge]=ot,Te[Re]=Math.max(Te[Re]??0,ge+1);let B=Re===Dt&&bt>=Ne,H=Re===mt&&lt<=Ge,_=Re*7+Ae,ne={taskId:at.id,task:at,rowIndex:Re,startCol:Ae,endCol:ot,spanCols:ae,lane:ge,isStart:B,isEnd:H};ee.has(_)||ee.set(_,[]),ee.get(_).push(ne);}St&&(Le.delete(at.id),ee.forEach((Re,Ae)=>{let ot=Re.filter(ae=>ae.taskId!==at.id);ot.length===0?ee.delete(Ae):ee.set(Ae,ot);}));}return {segmentsByCell:ee,multiDayTaskIds:Le,maxLanesPerRow:Te}},[tt,e]),Y=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=fe.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),we=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsx("div",{className:m("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:l,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:m("text-sm font-mono",V?"text-white/30":"text-gray-600"),children:[M.labels.noEvents,"..."]})]})}):s?jsx("div",{className:m("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:m("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:m("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:m("text-sm",V?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:m("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:m("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:m("w-8 h-8",V?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:m("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:M.labels.noEvents}),jsx("p",{className:m("text-sm",V?"text-white/30":"text-gray-600"),children:M.labels.newTask})]})}):jsxs("div",{className:m("flex-1 flex flex-col w-full h-full overflow-hidden",V?"bg-[#050505]":"bg-white",n),style:l,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:m("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:m("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:m("w-3.5 h-3.5",V?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:m("font-medium",V?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:m("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:wt,className:m("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:m("text-sm font-semibold tracking-tight min-w-[150px] text-center",V?"text-white":"text-gray-900"),children:we}),jsx("button",{onClick:ye,className:m("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:m("h-4 w-px",V?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:ut,className:m("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:M.navigation.today})]})]}),jsx("div",{className:m("grid grid-cols-7 sticky top-0 z-10",V?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(W=>jsx("div",{className:m("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:m("grid grid-cols-7 min-h-[800px]",V?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Me(null),children:tt.map((W,ee)=>{let Le=ee%7===6,Te=ee>=35;return jsxs("div",{className:m("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Le&&(V?"border-r border-[#222]":"border-r border-gray-200"),!Te&&(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:m("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 Be=Math.floor(ee/7),Ne=(D.maxLanesPerRow[Be]??0)*Gg,Ge=D.segmentsByCell.get(ee);return Ne===0&&!Ge?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:Ge?.map(pt=>jsx(e5,{segment:pt,isDark:V,blurFinancials:A,isSelected:X$1===pt.taskId,t:M,lens:E,hourlyRate:ce,onClick:()=>{ue(pt.task),a.onEventClick?.({id:pt.task.id,title:pt.task.name,start:pt.task.startDate,end:pt.task.endDate,task:pt.task});}},pt.taskId))})})(),(()=>{let Be=W.events.filter(Ne=>Ne.task.isMilestone&&!D.multiDayTaskIds.has(Ne.id));return Be.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Be.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:Ge=>{Ge.stopPropagation(),ue(Ne.task);}},Ne.id)),Be.length>4&&jsxs("span",{className:m("text-[8px] font-mono",V?"text-white/30":"text-gray-400"),children:["+",Be.length-4]})]})})(),(()=>{let Be=[];W.events.forEach(Ge=>{Ge.task.blockers?.forEach(pt=>{(pt.severity==="warning"||pt.severity==="critical")&&Be.push({taskId:Ge.id,type:pt.type,severity:pt.severity,variance:Ge.task.scheduleVariance});});});let Ne=Be[0];return Ne?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:m("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:[M.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${M.labels.delay})`:""]})]})}):null})(),(()=>{let Be=W.events.filter(it=>!D.multiDayTaskIds.has(it.id)),Ne=De[ee]||Z,Ge=Be.slice(0,Ne),pt=Be.length-Ne;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ge.map(it=>jsxs(motion.button,{onClick:()=>{ue(it.task),a.onEventClick?.(it);},whileHover:{scale:1.01},className:m("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",it.task.progress===100||it.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?it.task.progress===100||it.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)"}:it.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:m("flex-shrink-0 text-[9px]",it.task.isMilestone?V?"text-amber-400":"text-amber-600":it.task.isCriticalPath?"text-red-400":V?"text-[#1264FF]":"text-gray-400"),children:it.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:it.title})]},it.id)),pt>0&&jsxs("button",{onClick:it=>{it.stopPropagation(),Xe(at=>({...at,[ee]:Ne+Je}));},className:m("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:["+",pt," ",q==="es"?"m\xE1s":"more"]}),Ne>Z&&Be.length>Z&&jsx("button",{onClick:it=>{it.stopPropagation(),Xe(at=>({...at,[ee]:Z}));},className:m("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 Be=ee>=28,Ne=ee%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Ge=>{Ge.stopPropagation(),ct(Qe===ee?null:ee);},className:m("w-5 h-5 rounded flex items-center justify-center transition-all",Qe===ee?"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:m("w-3.5 h-3.5 transition-transform",Qe===ee&&"rotate-45")})}),jsx(AnimatePresence,{children:Qe===ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ct(null)}),jsx(motion.div,{initial:{opacity:0,y:Be?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Be?-5:5,scale:.95},transition:{duration:.12},className:m("absolute w-[320px] rounded-lg shadow-2xl z-50",Be?"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:Ge=>{a.onTaskCreate?.({name:Ge.name,startDate:Ge.startDate||W.date,endDate:Ge.endDate||W.date,priority:Ge.priority,assignees:Ge.assignee?[Ge.assignee]:void 0}),ct(null);},onCancel:()=>ct(null),availableUsers:t.availableUsers,isDark:V,locale:q==="es"?"es":"en",defaultDate:W.date,dropdownDirection:Be?"up":"down"})})]})})]})})()}),ee%7===6&&(()=>{let Be=Math.floor(ee/7),Ne=se[Be];if(!Ne||Ne===0)return null;let Ge=Wg(Ne,E,ce);return jsxs("div",{className:m("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:[M.labels.cashOut,": ",Ne<0?"-":"+",Ge]})})()]},ee)})})})]}),je&&jsxs("aside",{className:m("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:m("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:m("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:M.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:m("text-[10px] font-mono tabular-nums",V?"text-white/20":"text-gray-400"),children:qe.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:qe.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:m("w-10 h-10 rounded-xl flex items-center justify-center mb-3",V?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:m("w-5 h-5",V?"text-white/20":"text-gray-400")})}),jsx("p",{className:m("text-xs font-mono",V?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):qe.map(W=>jsxs("button",{onClick:()=>{ue(W);},className:m("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:m("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",V?"bg-white/20":"bg-gray-300")}),jsx("span",{className:m("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(ee=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ee.color}15`,color:ee.color,border:`1px solid ${ee.color}30`},children:ee.name},ee.id)),W.tags.length>3&&jsxs("span",{className:m("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:m("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",V?"text-white/25":"text-gray-400",A&&"blur-sm select-none"),children:[Kd(W.effortMinutes,E,ce)&&jsxs("span",{children:[M.labels.estimate,": ",Kd(W.effortMinutes,E,ce)]}),(()=>{let ee=Vg(W,E,ce);return ee?jsx("span",{className:ee.isNegative?"text-red-400":"text-emerald-400",children:ee.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:m("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((ee,Le)=>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:ee.color||"#007FFF"},title:ee.name,children:ee.initials||ee.name?.slice(0,2).toUpperCase()},Le))})]})]},W.id))}),a.onTaskCreate&&jsx("div",{className:m("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:M.labels.typeToAdd,className:m("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="");}})}),$.hasCostData&&jsxs("div",{className:m("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:m("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:["\u25C8 ",M.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:m("text-[10px] font-mono",V?"text-white/40":"text-gray-500"),children:M.labels.budgetUtil}),jsxs("span",{className:m("text-[10px] font-mono font-bold tabular-nums",V?"text-white/60":"text-gray-700",A&&"blur-sm select-none"),children:[$.budgetUtil,"%"]})]}),jsx("div",{className:m("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:`${$.budgetUtil}%`,background:$.budgetUtil>90?"#EF4444":$.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:m("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:m("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:M.labels.variance}),jsxs("div",{className:m("text-[11px] font-mono font-bold tabular-nums",$.avgVariance>0?"text-emerald-400":$.avgVariance<0?"text-red-400":V?"text-white/50":"text-gray-600"),children:[$.avgVariance>0?"+":"",$.avgVariance," ",M.labels.days]})]}),jsxs("div",{className:m("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:m("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:M.labels.cost}),jsx("div",{className:m("text-[11px] font-mono font-bold tabular-nums",$.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:$.costDisplay})]})]})]})]})]}),!K&&jsx(Xr,{task:z,isOpen:!!z,onClose:()=>te(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),te(W);},theme:L==="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:u,onCreateTag:i,attachments:z?c?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ns(e).filter(W=>W.id!==z?.id),comments:d?.filter(W=>W.taskId===z?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:h,onUploadCommentAttachments:y,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,isTimerRunning:w?.isRunning,timerElapsedSeconds:w?.elapsedSeconds,onTimeLog:T,onEstimateUpdate:C,onSoldEffortUpdate:S,onTimerStart:N,onTimerStop:I,onTimerDiscard:O,blurFinancials:A}),jsx(AnimatePresence,{children:be&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>$e(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:m("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:m("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:m("font-medium text-sm",V?"text-white/90":"text-gray-900"),children:be.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>$e(null),className:m("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:be.events.map(W=>jsxs("button",{onClick:()=>{$e(null),ue(W.task);},className:m("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:m("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 a5({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[u,i]=useState(false),c=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=c.length,h=new Set(c.flatMap(f=>f.assignedUserIds||[])).size,y=c.map(f=>f.priority).filter(Boolean),v=new Set(c.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:h,priorities:y,labels:v}},[c]),p=()=>{o?.(e.id);};return jsxs("div",{className:m("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:m("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),u&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children: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:l}){let u=useMemo(()=>({...Yg,...n}),[n]),[i,c]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let x=new Map;return e.forEach(k=>{let w=k.timestamp.toISOString().split("T")[0],T=x.get(w);T?T.push(k):x.set(w,[k]);}),Array.from(x.entries()).sort((k,w)=>w[0].localeCompare(k[0])).map(([k,w])=>({date:new Date(k),events:w.sort((T,C)=>C.timestamp.getTime()-T.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:g,uniqueTypes:h}=useMemo(()=>{let x=new Set,k=new Set;return e.forEach(w=>{x.add(w.userId),k.add(w.type);}),{uniqueUsers:Array.from(x),uniqueTypes:Array.from(k)}},[e]),y=x=>{c(k=>{let w=new Set(k);return w.has(x)?w.delete(x):w.add(x),w});},v=x=>{let w=new Date().getTime()-x.getTime(),T=Math.floor(w/6e4),C=Math.floor(w/36e5),S=Math.floor(w/864e5);return T<1?"just now":T<60?`${T}m ago`:C<24?`${C}h ago`:S<7?`${S}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&&d.current){let x=d.current.querySelector(`[data-event-id="${s}"]`);x&&x.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:m("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:m("history-timeline",u.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange: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:d,children:p.map(x=>jsxs("div",{className:"history-timeline-group",children:[u.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,w)=>{let T=i.has(k.id),C=s===k.id,S=qg(k.type);return jsxs("div",{"data-event-id":k.id,className:m("history-timeline-event",T&&"expanded",C&&"selected"),onClick:()=>o?.(k),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:S},children:u.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:ls(k.type)})}),w<x.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:S}})]}),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:[u.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:u.useRelativeTime?v(k.timestamp):k.timestamp.toLocaleString()})]}),Object.keys(k.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:N=>{N.stopPropagation(),y(k.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(k.changes).map(([N,I])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[N,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},N)),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(([N,I])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[N,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},N))]})]})]})]},k.id)})})]},x.date?.toISOString()||"all"))})]})}function Qg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:u,className:i}){let c=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:m("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:m("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&ls(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&is(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,h)=>jsx("div",{className:m("history-replay-progress-marker",h===e.currentIndex&&"active"),style:{left:`${h/(e.totalEvents-1)*100}%`},onClick:()=>l(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:m("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>u(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:m("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function 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 l5(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(c=>{let d=a/2,p=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(g=>{if(c.id===g.id)return;let h=c.x-g.x,y=c.y-g.y,v=Math.sqrt(h*h+y*y)||1,f=o.chargeStrength*i/(v*v);c.vx+=h/v*f,c.vy+=y/v*f;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),p=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!p)return;let g=p.x-d.x,h=p.y-d.y,y=Math.sqrt(g*g+h*h)||1,v=(y-o.linkDistance)/y*o.forceStrength*i;d.vx+=g*v,d.vy+=h*v,p.vx-=g*v,p.vy-=h*v;}),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:l,className:u}){let i=useRef(null),[c,d]=useState([]),[p,g]=useState(null),[h,y]=useState(null),[v,f]=useState(null),[x,k]=useState(1),[w,T]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let E=l5(e,t,a.width,a.height,a,150);d(E);},[e,t,a]);let C=useCallback((E,ce)=>{a.enableDragging&&(ce.stopPropagation(),g(E));},[a.enableDragging]),S=useCallback(E=>{if(!p||!i.current)return;let L=i.current.getBoundingClientRect(),q=(E.clientX-L.left-w.x)/x,Ce=(E.clientY-L.top-w.y)/x;d(je=>je.map(M=>M.id===p?{...M,x:q,y:Ce,fx:q,fy:Ce}:M));},[p,x,w]),N=useCallback(()=>{g(null);},[]),I=useCallback((E,ce)=>{ce.stopPropagation(),l?.({type:"node-click",node:E,position:{x:ce.clientX,y:ce.clientY}});},[l]),O=useCallback((E,ce)=>{ce.stopPropagation(),l?.({type:"edge-click",edge:E,position:{x:ce.clientX,y:ce.clientY}});},[l]),A=useCallback(E=>{let ce=c.find(L=>L.id===E);return ce?{x:ce.x,y:ce.y}:{x:0,y:0}},[c]),K=useCallback(E=>{if(E.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return E.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ce=E.card.priority;return ce==="URGENT"?"#ef4444":ce==="HIGH"?"#f59e0b":ce==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return E.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:m("relationships-graph-empty",u),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:m("relationships-graph",u),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(E=>Math.min(E+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(x*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k(E=>Math.max(E-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{k(1),T({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(E=>E.type))).map(E=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Jd(E)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Zg(E)," ",Qd(E)]})]},E))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:S,onMouseUp:N,onMouseLeave:N,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${x})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(E=>{let ce=A(typeof E.source=="string"?E.source:E.source.id),L=A(typeof E.target=="string"?E.target:E.target.id),q=e0(E.type),Ce=v===E.id,je=E.onCriticalPath;return jsxs("g",{className:m("relationships-graph-edge",Ce&&"hovered",je&&"critical"),onMouseEnter:()=>f(E.id),onMouseLeave:()=>f(null),onClick:M=>O(E,M),children:[jsx("line",{x1:ce.x,y1:ce.y,x2:L.x,y2:L.y,stroke:Jd(E.type),strokeWidth:je?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Ce?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Ce&&jsx("text",{x:(ce.x+L.x)/2,y:(ce.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Qd(E.type)})]},E.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(E=>{let ce=h===E.id,L=E.onCriticalPath;return jsxs("g",{className:m("relationships-graph-node",ce&&"hovered",L&&"critical"),transform:`translate(${E.x}, ${E.y})`,onMouseDown:q=>C(E.id,q),onMouseEnter:()=>y(E.id),onMouseLeave:()=>y(null),onClick:q=>I(E,q),children:[jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:K(E),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:ce?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:E.card.title.length>20?E.card.title.substring(0,20)+"...":E.card.title})]},E.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(""),[l,u]=useState(false),[i,c]=useState(null),[d,p]=useState(null),g=useRef(null),h=l||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let x=k=>{k.key==="Escape"&&!h&&y();};if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,h]);let y=()=>{h||(n(""),c(null),p(null),t());},v=async()=>{if(!(!s.trim()||h)){u(true),c(null),p(null);try{let x=await r(s.trim());p(x);}catch(x){c(x instanceof Error?x.message:"Failed to generate plan");}finally{u(false);}}},f=()=>{d&&(a(d),y());};return e?jsxs(Bt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),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:y,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:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((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 (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.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)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange: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."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((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:y,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"}),d?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:v,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 c5={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},u5={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 p5(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=p5(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),l=a.filter(d=>d.success),u=a.reduce((d,p)=>d+p.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?u/r:0,successRate:r>0?l.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 l=this.operations.filter(c=>c.timestamp>=n).length,u=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:u,percentUsed:i,isExceeded:l>=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 u=setInterval(()=>{o(Uo.getStats()),n(Uo.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let l=Uo.getRecentOperations(5);return jsxs(Bt,{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:u=>u.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(([u,i])=>{let c=r.costsByFeature[u]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:u.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children: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:`${d}%`}})})]},u)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ds(u.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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,l]=useState(""),[u,i]=useState(""),[c,d]=useState(""),[p,g]=useState(false),[h,y]=useState(null),[v,f]=useState(null),[x,k]=useState(null),w=useRef(null),T=p||o;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let O=A=>{A.key==="Escape"&&!T&&C();};if(e)return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[e,T]);let C=()=>{T||(l(""),i(""),d(""),y(null),f(null),k(null),t());},S=async()=>{if(!(!n.trim()||T)){g(true),y(null),f(null),k(null);try{let O=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||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){y(O instanceof Error?O.message:"Failed to generate tasks");}finally{g(false);}}},N=()=>{v&&(a(v),C());};if(!e)return null;let I=x?.similarity?((x.similarity||0)*100).toFixed(0):"0";return jsxs(Bt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),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:C,disabled:T,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:v?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 (",I,"% 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:[v.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((O,A)=>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:["#",A+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:w,value:n,onChange:O=>l(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:T}),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:u,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:T})]}),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=>d(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:T})]})]}),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,A)=>jsx("button",{onClick:()=>l(O),disabled:T,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},A))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:T&&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:C,disabled:T,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"}),v?jsx("button",{onClick:N,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:S,disabled:!n.trim()||T,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:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function zi({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(v=>{t&&Cs(()=>Promise.resolve(t(v)),{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(v,f,x)=>{r(k=>{let w=k.cards.find(O=>O.id===v);if(!w)return k;let T=w.columnId,C={...w,columnId:f,position:x},S=k.cards.map(O=>O.id===v?C:O),N=k.columns.map(O=>{if(O.id===T)return {...O,cardIds:O.cardIds.filter(A=>A!==v)};if(O.id===f){let A=S.filter(K=>K.columnId===f).sort((K,E)=>K.position-E.position);return {...O,cardIds:A.map(K=>K.id)}}return O}),I={...k,cards:S,columns:N};return o(I),I});},[o]),n=useCallback(async(v,f)=>{r(x=>{let k=x.cards.map(T=>T.id===v?{...T,...f}:T),w={...x,cards:k};return o(w),w});},[o]),l=useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...v,id:f},w=x.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),T={...x,cards:[...x.cards,k],columns:w};return o(T),T});},[o]),u=useCallback(async v=>{r(f=>{let x=f.cards.find(C=>C.id===v);if(!x)return f;let k=f.cards.filter(C=>C.id!==v),w=f.columns.map(C=>C.id===x.columnId?{...C,cardIds:C.cardIds.filter(S=>S!==v)}:C),T={...f,cards:k,columns:w};return o(T),T});},[o]),i=useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...v,id:f,cardIds:[]},w={...x,columns:[...x.columns,k]};return o(w),w});},[o]),c=useCallback(async(v,f)=>{r(x=>{let k=x.columns.map(T=>T.id===v?{...T,...f}:T),w={...x,columns:k};return o(w),w});},[o]),d=useCallback(async v=>{r(f=>{let x=f.cards.filter(T=>T.columnId!==v),k=f.columns.filter(T=>T.id!==v),w={...f,cards:x,columns:k};return o(w),w});},[o]),p=useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),f},[l]),g=useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),h=useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:u,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:u,deleteColumn:d,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:(u,i,c={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(d=>d.columnId===u).length,...c});},addColumn:(u,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:u,position:i??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}),l=useCallback(y=>{o(v=>({...v,...y}));},[]),u=useCallback(y=>{n(v=>({...v,...y}));},[]),i=useCallback(()=>{o(cs),n(g0);},[]),c=useCallback(()=>{a&&o({...cs,assignees:[a]});},[a]),d=useCallback(()=>{o({...cs,dateFilter:"overdue"});},[]),p=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(y=>{let v=[...y];if(r.search){let f=r.search.toLowerCase();v=v.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"),w=String(f.getDate()).padStart(2,"0"),T=`${x}-${k}-${w}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let S=C.endDate||C.dueDate;if(!S)return false;let N;if(typeof S=="string")N=S.split("T")[0]||S;else {let I=S.getUTCFullYear(),O=String(S.getUTCMonth()+1).padStart(2,"0"),A=String(S.getUTCDate()).padStart(2,"0");N=`${I}-${O}-${A}`;}switch(r.dateFilter){case "overdue":return N<T;case "today":return N===T;case "this-week":let I=new Date(T+"T00:00:00"),O=new Date(N+"T00:00:00"),A=new Date(I);return A.setDate(A.getDate()+7),O>=I&&O<=A;case "custom":if(r.dateRange){let K=typeof S=="string"?new Date(S):S;return K>=r.dateRange.start&&K<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(k=>r.assignees.includes(k)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(x=>r.labels.includes(x)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,x)=>{let k=0;switch(s.by){case "created":let w=f.createdAt?new Date(f.createdAt).getTime():0,T=x.createdAt?new Date(x.createdAt).getTime():0;k=w-T;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},S=C[f.priority||"LOW"],N=C[x.priority||"LOW"];k=S-N;break;case "dueDate":let I=f.endDate||f.dueDate,O=x.endDate||x.dueDate;if(!I)return 1;if(!O)return -1;let A=typeof I=="string"?new Date(I).getTime():I.getTime(),K=typeof O=="string"?new Date(O).getTime():O.getTime();k=A-K;break;case "title":k=f.title.localeCompare(x.title);break;case "estimate":let E=f.estimatedTime||0,ce=x.estimatedTime||0;k=E-ce;break;default:k=0;}return s.order==="asc"?k:-k}),v},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:u,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:p,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 d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),u=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:u,onGenerateSubtasks:i,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(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,h=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(y=>y!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(h&&a.lastSelectedCardId){let y=t.find(f=>f.id===d),v=t.find(f=>f.id===a.lastSelectedCardId);if(y&&v&&y.columnId===v.columnId){let f=t.filter(N=>N.columnId===y.columnId).sort((N,I)=>N.position-I.position),x=f.findIndex(N=>N.id===a.lastSelectedCardId),k=f.findIndex(N=>N.id===d),[w,T]=x<k?[x,k]:[k,x],C=f.slice(w,T+1).map(N=>N.id),S=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:S,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:u,toggleCard:i,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([]),l=useCallback((y,v,f,x,k)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:y,cardIds:v,columnId:f,strategy:x,color:k,isExpanded:true,position:s.filter(T=>T.columnId===f).length,createdAt:new Date};n(T=>[...T,w]);},[o.minCardsPerStack,s]),u=useCallback(y=>{n(v=>v.filter(f=>f.id!==y));},[]),i=useCallback(y=>{n(v=>v.map(f=>f.id===y?{...f,isExpanded:!f.isExpanded}:f));},[]),c=useCallback((y,v)=>{n(f=>f.map(x=>x.id===y&&!x.cardIds.includes(v)?{...x,cardIds:[...x.cardIds,v]}:x));},[]),d=useCallback((y,v)=>{n(f=>f.map(x=>{if(x.id===y){let k=x.cardIds.filter(w=>w!==v);return k.length<o.minCardsPerStack?null:{...x,cardIds:k}}return x}).filter(x=>x!==null));},[o.minCardsPerStack]),p=useCallback(y=>s.filter(v=>v.columnId===y).sort((v,f)=>v.position-f.position),[s]),g=useCallback(async y=>{let v=t.filter(T=>T.columnId===y);if(v.length<o.minCardsPerStack*2)return [];let f=[],x=new Map;v.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(C=>{x.has(C)||x.set(C,[]),x.get(C).push(T);});}),x.forEach((T,C)=>{T.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:T.map(S=>S.id),columnId:y,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${C}"`,confidence:.85});});let k=new Map;v.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(C=>{k.has(C)||k.set(C,[]),k.get(C).push(T);});}),k.forEach((T,C)=>{T.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:T.map(S=>S.id),columnId:y,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(v.forEach(T=>{T.priority&&(w.has(T.priority)||w.set(T.priority,[]),w.get(T.priority).push(T));}),w.forEach((T,C)=>{if(T.length>=o.minCardsPerStack){let S={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${S} ${C} Priority`,cardIds:T.map(N=>N.id),columnId:y,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of v){let S=(await r.findSimilar(T,v)).filter(N=>N.similarity>=o.autoStackConfidenceThreshold);if(S.length>=o.minCardsPerStack-1){let N=[T.id,...S.map(O=>O.card.id)],I=S.reduce((O,A)=>O+A.similarity,0)/S.length;f.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:N,columnId:y,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${S.length+1} similar tasks`,confidence:I});}}return f.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,C)=>C.confidence-T.confidence).slice(0,5)},[t,o,r]),h=useCallback(y=>{l(y.stack.title,y.stack.cardIds,y.stack.columnId,y.stack.strategy,y.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),x=f[0];f.length>0&&x&&x.confidence>=.9&&h(x);});},[]),{stacks:s,createStack:l,deleteStack:u,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:p,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(u=>{let{Column:i}=vs("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=vs("@libxai/core");n.set(u.id,new i(u));});let l=null;if(t?.board){let{Board:u}=vs("@libxai/core");l=new u(t.board);}r.current=new BoardStore({board:l,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 l=useCallback(x=>{e.updateBoard(x);},[e]),u=useCallback(x=>{e.addColumn(x);},[e]),i=useCallback((x,k)=>{e.updateColumn(x,k);},[e]),c=useCallback(x=>{e.deleteColumn(x);},[e]),d=useCallback(x=>e.getColumn(x),[e]),p=useCallback(x=>{e.addCard(x);},[e]),g=useCallback((x,k)=>{e.updateCard(x,k);},[e]),h=useCallback(x=>{e.deleteCard(x);},[e]),y=useCallback((x,k,w)=>{e.moveCard(x,k,w);},[e]),v=useCallback(x=>e.getCard(x),[e]),f=useCallback(x=>e.getCardsByColumn(x),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:u,updateColumn:i,deleteColumn:c,getColumn:d,addCard:p,updateCard:g,deleteCard:h,moveCard:y,getCard:v,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 l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=u-i;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=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 l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{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);}},F5=new Wi;function F0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:u}){let i=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),p={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:i,style:p,className:o,children:jsx("div",{style:g,children:d.map(h=>{let y=e[h.index];if(!y)return null;let v=u?u(y,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(y,h.index)},v)})})})}function M0(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:l=16,getItemKey:u,horizontal:i=true}){let c=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},h={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:c,style:g,className:s,children:jsx("div",{style:h,children:p.map(y=>{let v=e[y.index];if(!v)return null;let f=u?u(v,y.index):y.index,x={position:"absolute",top:0,left:y.start,width:y.size,height:"100%"};return jsx("div",{style:x,"data-index":y.index,children:o(v,y.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}},Gi={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 A5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function xc(e="asakaa"){let t=yc(Gi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=A5(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(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let u=l.name.toLowerCase();return n.every(i=>u.includes(i))})}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 p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let h=new Date(r),y=h.getDay(),v=g-y;return v<=0&&(v+=7),h.setDate(h.getDate()+v),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 p=parseInt(s[1],10),g=s[2].toLowerCase(),h=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?h.setDate(h.getDate()+p):g==="week"||g==="semana"||g==="semanas"?h.setDate(h.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&h.setMonth(h.getMonth()+p),h}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),g=parseInt(l[2],10)-1,h=parseInt(l[3],10);return new Date(h,g,p)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),g=u[i[2].toLowerCase()],h=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(h,g,p)}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},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=c[d[1].toLowerCase()],g=parseInt(d[2],10),h=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(h,p,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 i=r[1].trim(),c=r[2].trim(),d=ao(t,i),p=hd(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.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=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,h=new Date(p);return h.setDate(h.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:h},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),d=ao(t,i),p=yd(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),d=ao(t,i),p=xd(c);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,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 i=n[1].trim(),c=n[2].trim(),d=ao(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=ao(t,i),p=ao(t,c);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),c=ao(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function 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 _v(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 d=a.find(p=>p.id===c);return d?{name:d.name,initials:d.initials,color:d.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},l=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||l&&u&&Math.abs(u.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:u,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:i,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:_v(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),l=useRef(null);useEffect(()=>{let g=h=>{l.current&&!l.current.contains(h.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=vm(e),i=Cd[0],c=Cd.find(g=>g.value===u)??i,d=c.icon,p=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(d,{className:m("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(d,{className:m("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:m("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:m("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:y=>{y.stopPropagation(),t(g.value),n(false);},className:m("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",u===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(h,{className:m("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(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),l=useRef(null);useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let u=Td.find(c=>c.value===e)??Td[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:m("w-4 h-4",u.color)}),jsx("span",{className:m("text-sm",a?"text-white/60":"text-gray-500"),children:u.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:m("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:m("w-4 h-4",u.color)}),jsx("span",{className:m("text-sm",a?"text-white/60":"text-gray-500"),children:u.label[i]}),jsx(ChevronDown,{className:m("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:m("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:d=>{d.stopPropagation(),t(c.value),n(false);},className:m("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:m("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},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,l]=useState(false),[u,i]=useState(""),c=useRef(null),d=useRef(null);useEffect(()=>{let y=v=>{c.current&&!c.current.contains(v.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(y=>y.name.toLowerCase().includes(u.toLowerCase())),g=y=>e.some(v=>v.name===y),h=y=>{if(a){if(g(y.name))a(e.filter(v=>v.name!==y.name));else {let v={name:y.name,initials:Zn(y.name),color:y.color||Nd(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl,id:y.id};a([...e,v]);}l(false),i("");}};return s||!a?e.length===0?jsx("span",{className:m("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((y,v)=>jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!y.avatar&&Nd(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||Zn(y.name)},`${y.name}-${v}`)),e.length>3&&jsxs("div",{className:m("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:y=>{y.stopPropagation(),l(!n);},className:m("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:m("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:m("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((y,v)=>jsx("div",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!y.avatar&&Nd(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||Zn(y.name)},`${y.name}-${v}`)),e.length>2&&jsxs("span",{className:m("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:d,type:"text",value:u,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:y=>y.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((y,v)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:y.color?`${y.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:y.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:y.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||Zn(y.name)}),y.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(x=>x.name!==y.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}})})]},`${y.name}-${v}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(y=>{let v=g(y.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),h(y);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?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=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(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:y.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:y.avatarUrl?jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):Zn(y.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name}),v&&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"}})})]},y.id)})})]})]})}function Mm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:u}){let[i,c]=useState(false),[d,p]=useState(o),[g,h]=useState(()=>{let S=o==="start"?e:t;if(S){let N=S instanceof Date?S:new Date(S);return new Date(N.getFullYear(),N.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),y=useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let S=N=>{y.current&&!y.current.contains(N.target)&&c(false);};return i&&document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[i]),useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let x=S=>S?S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):u||"-",k=useCallback(()=>{let S=g.getFullYear(),N=g.getMonth(),I=new Date(S,N,1),A=new Date(S,N+1,0).getDate(),K=I.getDay(),E=[],L=new Date(S,N,0).getDate();for(let Ce=K-1;Ce>=0;Ce--)E.push({date:new Date(S,N-1,L-Ce),isCurrentMonth:false});for(let Ce=1;Ce<=A;Ce++)E.push({date:new Date(S,N,Ce),isCurrentMonth:true});let q=42-E.length;for(let Ce=1;Ce<=q;Ce++)E.push({date:new Date(S,N+1,Ce),isCurrentMonth:false});return E},[g]),w=S=>{if(r)o==="start"?a(S,f||void 0):a(v||void 0,S),c(false);else if(d==="start"){let N=f&&S>f?S:f;a(S,N||void 0),p("end");}else {let N=v&&S<v?S:v;a(N||void 0,S),c(false);}},T=()=>{let S=new Date,N=new Date(S);N.setDate(S.getDate()+1);let I=new Date(S);I.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let O=new Date(S);O.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let A=new Date(S);A.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let K=new Date(S);K.setDate(S.getDate()+14);let E=new Date(S);return E.setDate(S.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:N,display:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:I,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:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:K,display:K.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let S=r&&o==="start"?v:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:m("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:m("text-sm",s?"text-white/60":"text-gray-500"),children:x(S)})]})}let C=r&&o==="start"?v:f;return jsxs("div",{ref:y,className:"relative",children:[jsxs("button",{onClick:S=>{S.stopPropagation(),c(!i);let N=o==="start"?v:f;N&&h(new Date(N.getFullYear(),N.getMonth(),1));},className:m("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:m("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:m("text-sm",s?"text-white/60":"text-gray-500"),children:x(C)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxs("div",{className:m("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:S=>S.stopPropagation(),children:[jsxs("div",{className:m("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[T().map((S,N)=>jsxs("button",{className:m("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:()=>w(S.date),children:[jsx("span",{children:S.label}),jsx("span",{className:m("text-xs",s?"text-white/30":"text-gray-400"),children:S.display})]},N)),jsx("div",{className:m("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(v||void 0,void 0):a(void 0,void 0),c(false);},className:m("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:m("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:m("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:m("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:m("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:m("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>h(new Date(g.getFullYear(),g.getMonth()+1)),className:m("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:m("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(S=>jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:S},S))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:k().map((S,N)=>{let I=S.date.toDateString()===new Date().toDateString(),O=v?.toDateString()===S.date.toDateString(),A=f?.toDateString()===S.date.toDateString(),K=O||A,E=!r&&v&&f&&S.date>=v&&S.date<=f;return jsx("button",{onClick:()=>w(new Date(S.date)),className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),S.isCurrentMonth&&(s?"text-white":"text-gray-900"),I&&"ring-2 ring-[#007BFF]",O&&"bg-[#007BFF] text-white",A&&!O&&"bg-[#7C3AED] text-white",E&&!K&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!K&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:S.date.getDate()},N)})})]})]})]})]})}function Ni({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let u=e?e instanceof Date?e:new Date(e):null;return jsx(Mm,{startDate:s==="start"?u:n||null,endDate:s==="end"?u:l||null,onChange:(p,g)=>{t&&t(s==="start"?p: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),[l,u]=useState(false),i=useRef(e),c=useRef([]);return useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,p=e,g=p-d,h=r/o;u(true);for(let y=1;y<=o;y++){let v=setTimeout(()=>{let f=y/o,x=1-Math.pow(1-f,3),k=Math.round(d+g*x);n(k),y===o&&(u(false),n(p));},h*y);c.current.push(v);}return i.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Pm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,l]=useState(0),u=useRef(null),i=useRef(null),c=useCallback(g=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(g),l(0);let h=Date.now();i.current=setInterval(()=>{let y=Date.now()-h,v=Math.min(y/a*100,100);l(v);},16),u.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=useCallback(()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:d}}function Im({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:l}=wn(),{displayValue:u,isAnimating:i}=Di(e,{enabled:o,duration:300,steps:6}),c=p=>{if(r||!t)return;p.stopPropagation();let g=p.currentTarget.getBoundingClientRect(),h=p.clientX-g.left,y=Math.round(h/g.width*100),v=Math.max(0,Math.min(100,y));v!==e&&(t(v),s&&l());},d=u??e;return jsxs("div",{className:m("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:m("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:m("h-full rounded-full transition-[width]",d===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",i&&"transition-none"),style:{width:`${d}%`}})}),jsxs("span",{className:m("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[d,"%"]})]})}function Om({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[l,u]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{u(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?c():p.key==="Escape"&&(u(e),n(false));};return o||!t?jsx("span",{className:m("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:p=>u(p.target.value),onBlur:c,onKeyDown:d,onClick:p=>p.stopPropagation(),className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:m("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:l=true,enableSaveFlash:u=true}){let[i,c]=useState(false),[d,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:h,triggerFlash:y}=wn(),{displayValue:v,isAnimating:f}=Di(e,{enabled:l&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let x=()=>{let w=parseFloat(d);if(!isNaN(w)){let T=w;o!==void 0&&(T=Math.max(o,T)),s!==void 0&&(T=Math.min(s,T)),T!==e&&(t?.(T),u&&y());}c(false);},k=w=>{w.key==="Enter"?x():w.key==="Escape"&&(p(e?.toString()||""),c(false));};return n||!t?jsx("span",{className:m("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsx("input",{ref:g,type:"number",value:d,onChange:w=>p(w.target.value),onBlur:x,onKeyDown:k,onClick:w=>w.stopPropagation(),min:o,max:s,className:m("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:w=>{w.stopPropagation(),c(true);},className:m("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",v===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:v!==void 0?v:r})}function Um({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),u=useRef(null);return useEffect(()=>{let i=c=>{u.current&&!u.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:m("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:m("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:m("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:m("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:m("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:m("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:m("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===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function Gm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:u,startChange:i,cancelChange:c}=Pm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?c():i(!e):t(!e));},p=l?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:m("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${u/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:g=>{g.stopPropagation(),c();},className:m("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:m("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:m("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 S2(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 E2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),u=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+u}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:l=false,lens:u="hours",hourlyRate:i=0}){let[c,d]=useState(false),[p,g]=useState(""),h=useRef(null),{isFlashing:y,triggerFlash:v}=wn(),f=u==="financial"&&i>0,x=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:S2(e,r);useEffect(()=>{c&&h.current&&(h.current.focus(),h.current.select());},[c]),useEffect(()=>{if(e){let C=Math.floor(e/60),S=e%60;C>0&&S>0?g(`${C}h ${S}m`):C>0?g(`${C}h`):g(`${S}m`);}else g("");},[e,c]);let k=()=>{let C=E2(p);C!==e&&(t?.(C),n&&v()),d(false);},w=C=>{C.key==="Enter"?k():C.key==="Escape"&&d(false);};if(l)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:m("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 T=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(T,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:m("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:p,onChange:C=>g(C.target.value),onBlur:k,onKeyDown:w,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:m("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:C=>{C.stopPropagation(),d(true);},className:m("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",y&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(T,{className:m("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:m("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=l=>l.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let l=o==="es";return a===0?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:l?"En Tiempo":"On Track"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",l?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",l?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:m("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:l,lens:u="hours",hourlyRate:i=0}){let c=a==="es",d=u==="financial"&&i>0,p=M=>d?`$${Math.round(M*i).toLocaleString("en-US")}`:`${M}h`,[g,h]=useState(false),[y,v]=useState(false),[f,x]=useState(null),k=useRef(null),w=e.timeLoggedMinutes||0,T=e.effortMinutes||0,C=e.soldEffortMinutes||0,S=Math.round(w/60*10)/10,N=Math.round(T/60*10)/10,I=Math.round(C/60*10)/10,O=T>0?w/T*100:0,A=O>100?Math.round((w-T)/60*10)/10:0,K=O>100?"#FF2D20":O>=80?"#FFD60A":"#3BF06E";useEffect(()=>{if(!y&&!f)return;let M=V=>{k.current&&!k.current.contains(V.target)&&(v(false),x(null));};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[y,f]);let E=M=>{if(M.stopPropagation(),r&&!o&&!s){x("log");return}if(r||o||s){v(V=>!V),x(null);return}l&&l(e);},ce=M=>{v(false),x(M);},L=async(M,V)=>{f==="log"&&r&&M?r(e,M,V):f==="estimate"&&o?o(e,M):f==="quoted"&&s&&s(e,M),x(null);},q=r||o||s||l,Ce=[{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(M=>M.show),je=f==="estimate"?T:f==="quoted"?C:void 0;return T===0&&w===0&&C===0?jsxs("div",{ref:k,className:"relative flex items-center gap-2",onClick:M=>M.stopPropagation(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),children:[jsx("span",{className:m("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&q&&jsx("button",{onClick:E,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",M.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",M.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:Ce.map(M=>jsxs("button",{onClick:V=>{V.stopPropagation(),ce(M.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(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.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($r,{mode:f,locale:a,isDark:t,currentValue:je||void 0,onSave:L,onClose:()=>x(null)})})})})]}):jsxs("div",{ref:k,className:"relative flex items-center gap-2 w-full",onClick:M=>M.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:p(S)}),T>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(N)]}),A>0&&jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF2D20"},children:["+",p(A)," ",c?"Exceso":"Over"]})]}),T>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:K,borderRadius:2,transition:"width 0.3s"}})}),C>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:p(I)})]})]}),q&&jsx("button",{onClick:E,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:g?1:0,pointerEvents:g?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",M.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:M=>{M.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",M.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:Ce.map(M=>jsxs("button",{onClick:V=>{V.stopPropagation(),ce(M.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(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.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($r,{mode:f,locale:a,isDark:t,currentValue:je||void 0,onSave:L,onClose:()=>x(null)})})})})]})}function Zm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsx("span",{className:m("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:m("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsx("div",{className:m("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:m("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxs("span",{className:m("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var I2={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:m("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:m("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",I2[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 Z2(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:l,onColumnHide:u,onColumnSort:i,availableUsers:c=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g}){let h=useRef(null),y=r==="es"?rg.es:rg.en;if(useEffect(()=>{let w=C=>{h.current&&!h.current.contains(C.target)&&t();},T=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",w),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",T);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let w=[];return o&&w.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),w.push({id:"sep1",label:"",icon:null,separator:true}),l&&(w.push({id:"status",label:y.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),w.push({id:"priority",label:y.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&w.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(T=>({id:`assign-${T.id}`,label:T.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:T.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],N=C.some(I=>I.name===T.name)?C.filter(I=>I.name!==T.name):[...C,{name:T.name,initials:Q2(T.name),color:T.color||Z2(T.name),avatar:T.avatarUrl}];l({...e.task,assignees:N}),t();}}))})),d&&w.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&w.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&w.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),w.push({id:"sep2",label:"",icon:null,separator:true}),s&&w.push({id:"duplicate",label:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&w.push({id:"delete",label:y.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),w},f=()=>{if(!e.columnId)return [];let w=[];return i&&(w.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),w.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(w.push({id:"sep-hide",label:"",icon:null,separator:true}),w.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),w},x=e.type==="task"?v():f(),k={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:h,style:k,className:m("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:x.map(w=>w.separator?jsx("div",{className:m("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},w.id):w.submenu?jsx(e1,{item:w,isDark:a},w.id):jsxs("button",{onClick:w.onClick,className:m("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",w.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:m(w.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:w.icon}),w.label]},w.id))})}function e1({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:m("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:m("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:m("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var 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"})},h1=["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:l}){let[u,i]=useState(""),[c,d]=useState(null),p=useRef(null),g=l==="es"?gg.es:gg.en;if(useLayoutEffect(()=>{if(!e||!p.current)return;let w=()=>{if(!p.current)return;let T=p.current.getBoundingClientRect(),S=window.innerHeight-T.top-20;d(Math.max(300,S));};return requestAnimationFrame(w),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[e]),useEffect(()=>{if(!e)return;let w=setTimeout(()=>{let T=S=>{p.current&&!p.current.contains(S.target)&&t();},C=S=>{S.key==="Escape"&&t();};document.addEventListener("mousedown",T),document.addEventListener("keydown",C),p._cleanup=()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(w),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let h=w=>g.columns[w]||w,y=w=>{if(w==="name")return;let T=a.map(C=>C.id===w?{...C,visible:!C.visible}:C);o(T);},v=(w,T)=>{let C=a.find(N=>N.type===w&&(!T||N.customFieldId===T));if(C){y(C.id);return}let S={id:T||w,type:w,label:T?r.find(N=>N.id===T)?.name||w:h(w),width:120,visible:true,sortable:true,resizable:true,customFieldId:T};o([...a,S]);},f=h1.filter(w=>h(w).toLowerCase().includes(u.toLowerCase())),x=r.filter(w=>w.name.toLowerCase().includes(u.toLowerCase())),k=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:p,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:w=>{w.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",w.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:w=>{w.currentTarget.style.backgroundColor="transparent",w.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:u,onChange:w=>i(w.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:w=>{w&&w.style.setProperty("--focus-border",k);},onFocus:w=>{w.currentTarget.style.borderColor=k,w.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:w=>{w.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",w.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:w=>w.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(w=>{let T=a.find(N=>N.type===w&&!N.customFieldId),C=T?.visible??false,S=w==="name";return jsxs("button",{onClick:()=>{S||(T?y(T.id):v(w));},disabled:S,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:S?.4:1,cursor:S?"not-allowed":"pointer"},onMouseEnter:N=>{S||(N.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:N=>{N.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:C?k:"transparent",border:C?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${k}40`:"none"},children:C&&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:C?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:mg[w]}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?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(w)})]},w)})})]}),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(w=>{let C=a.find(S=>S.customFieldId===w.id)?.visible??false;return jsxs("button",{onClick:()=>v(w.type,w.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:S=>{S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:S=>{S.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:C?k:"transparent",border:C?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${k}40`:"none"},children:C&&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:C?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:mg[w.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?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:w.name})]},w.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 D1=[{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(""),[l,u]=useState("text"),[i,c]=useState([""]),d=o==="es"?hg.es:hg.en;useEffect(()=>{e&&(n(""),u("text"),c([""]));},[e]),useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let p=()=>{if(!s.trim())return;let v={name:s.trim(),type:l};l==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{c([...i,""]);},h=(v,f)=>{let x=[...i];x[v]=f,c(x);},y=v=>{i.length>1&&c(i.filter((f,x)=>x!==v));};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:m("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:m("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:m("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:m("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:m("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:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:d.fieldNamePlaceholder,className:m("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:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:D1.map(v=>jsxs("button",{onClick:()=>u(v.type),className:m("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsx("span",{className:m("text-xs",l===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[v.type]})]},v.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:v,onChange:x=>h(f,x.target.value),placeholder:`${d.option} ${f+1}`,className:m("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")}),i.length>1&&jsx("button",{onClick:()=>y(f),className:m("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:m("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:m("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:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var 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,l]=useState(false),u=useRef(null),i=useRef(0),c=s==="es"?wg.es:wg.en;useEffect(()=>{if(!n)return;let g=y=>{Date.now()-i.current<100||u.current&&!u.current.contains(y.target)&&l(false);},h=y=>{y.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",h);}},[n]);let d=[{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"}],p=e!=="all"||t;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(h=>!h);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),c.filters,p&&jsx("span",{className:m("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:m("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:m("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:m("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let h=e===g.value&&!t,y=()=>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),l(false);},className:m("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:m(h?g.color:"text-gray-400","flex-shrink-0"),children:y()}),jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),h&&jsx(Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:m("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"),l(false);},className:m("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:m("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:m("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:m("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:m("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:m("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:m("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,l=n>0?Math.min(Math.round(s/n*100),100):0,u=s>n&&n>0,i=u?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:m("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:m("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:m("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:m("text-[11px] font-mono font-bold",u?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Cg(s)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:m("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:m("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Cg(n)})]}),n>0&&jsx("div",{className:m("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:m("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:m("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:m("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:m("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:m("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:m("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:m("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:m("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,l=s<0,u=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:m("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:u})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:m("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 l=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:m("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxs("span",{className:m("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsx("div",{className:m("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:l}})})]},`${s.name}-${n}`)})})]})]})}var W1=[{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 Mg(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(...Mg(r.subtasks,t+1));return a}function G1(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(),u=s.endDate.getTime()-n;if(u<=0)continue;let c=Math.max(0,Math.min(a.getTime()-n,u))/u*100;if(c<=0)continue;let d=(s.progress||0)/c;r+=d,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 Pg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:u=[],toolbarRightContent:i}){let{theme:c="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:h=true,tableColumns:y,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:x=true,showCreateTaskButton:k=false,onCreateTask:w,persistFilter:T=false,financialBlur:C,healthSidebar:S,lens:N="hours",hourlyRate:I=0,aggregateParentHours:O=false,showProjectTotals:A=false}=t,K=ki(d,p),E=c==="dark",ce=useCallback(()=>{if(!T||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let b=localStorage.getItem(T);if(b){let B=JSON.parse(b);return {statusFilter:B.statusFilter||"all",hideCompleted:B.hideCompleted||!1}}}catch(b){console.error("Error loading persisted filter:",b);}return {statusFilter:"all",hideCompleted:false}},[T]),L=useMemo(()=>{function b(B){let H=0,_=0,ne=0;for(let he of B)if(he.subtasks&&he.subtasks.length>0){let J=b(he.subtasks);H+=J.spent,_+=J.allocated,ne+=J.quoted;}else H+=he.timeLoggedMinutes??0,_+=he.effortMinutes??0,ne+=he.soldEffortMinutes??0;return {spent:H,allocated:_,quoted:ne}}return b(e)},[e]),q=useMemo(()=>!S?.enabled||!S.data?S:{...S,data:{...S.data,totalHoursSpentMinutes:L.spent,totalHoursAllocatedMinutes:L.allocated}},[S,L]),[Ce,je]=useState(true),[M,V]=useState("position"),[fe,We]=useState("asc"),[z,te]=useState(""),[X,Me]=useState(()=>ce().statusFilter),[be,$e]=useState(()=>ce().hideCompleted),[De,Xe]=useState(y||W1),[Z,Je]=useState(false),[ue,Qe]=useState(false),[ct,wt]=useState({isOpen:false,x:0,y:0,type:"task"}),[ye,ut]=useState(null),[tt,qe]=useState(0),[$,se]=useState(0),D=useRef(null),[Y,ie]=useState(null),[we,W]=useState(null);useEffect(()=>{y&&Xe(y);},[y]),useEffect(()=>{if(!(!T||typeof window>"u"))try{localStorage.setItem(T,JSON.stringify({statusFilter:X,hideCompleted:be}));}catch(b){console.error("Error persisting filter state:",b);}},[T,X,be]);let ee=useMemo(()=>{let b=new Set;function B(H){for(let _ of H)_.subtasks?.length&&(_.isExpanded!==false&&b.add(_.id),B(_.subtasks));}return B(e),b},[e]),Le=useMemo(()=>De.filter(b=>b.visible),[De]),Te=useCallback(b=>{a.onTaskToggleExpand?.(b);},[a]),Be=useCallback(b=>{M===b?We(B=>B==="asc"?"desc":"asc"):(V(b),We("asc")),a.onSortChange?.({column:b,direction:fe==="asc"?"desc":"asc"});},[M,fe,a]),Ne=useCallback(b=>{Xe(b),a.onColumnsChange?.(b);},[a]),Ge=useCallback(b=>{let B=De.map(H=>H.id===b?{...H,visible:false}:H);Ne(B);},[De,Ne]),pt=useCallback((b,B)=>{V(b),We(B);},[]),it=useCallback((b,B,H)=>{x&&(b.preventDefault(),wt({isOpen:true,x:b.clientX,y:b.clientY,type:B?"task":"header",task:B,columnId:H}));},[x]),at=useCallback(()=>{wt(b=>({...b,isOpen:false}));},[]),Ze=useCallback((b,B)=>{if(!f)return;b.preventDefault(),b.stopPropagation();let H=De.find(_=>_.id===B);H&&(ut(B),qe(b.clientX),se(H.width));},[De,f]);useEffect(()=>{if(!ye)return;let b=H=>{let _=H.clientX-tt,ne=Math.max(50,$+_),he=De.map(J=>J.id===ye?{...J,width:ne}:J);Xe(he);},B=()=>{ye&&a.onColumnsChange?.(De),ut(null);};return document.addEventListener("mousemove",b),document.addEventListener("mouseup",B),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",B);}},[ye,tt,$,De,a]);let At=useCallback((b,B)=>{if(B==="name"){b.preventDefault();return}ie(B),b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("text/plain",B),b.currentTarget instanceof HTMLElement&&(b.currentTarget.style.opacity="0.5");},[]),Dt=useCallback(b=>{b.currentTarget instanceof HTMLElement&&(b.currentTarget.style.opacity="1"),ie(null),W(null);},[]),mt=useCallback((b,B)=>{b.preventDefault(),B!=="name"&&(b.dataTransfer.dropEffect="move",W(B));},[]),bt=useCallback(()=>{W(null);},[]),lt=useCallback((b,B)=>{if(b.preventDefault(),!Y||Y===B||B==="name")return;let H=[...De],_=H.findIndex(J=>J.id===Y),ne=H.findIndex(J=>J.id===B);if(_===-1||ne===-1)return;let he=H.splice(_,1);he[0]&&(H.splice(ne,0,he[0]),Ne(H),ie(null),W(null));},[Y,De,Ne]),St=useCallback(async b=>{if(a.onCreateCustomField){let B={...b,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(B);}Qe(false);},[a]),Re=useCallback(b=>b.progress===100||b.status==="completed"?"completed":b.progress&&b.progress>0||b.status==="in-progress"?"in-progress":"todo",[]),Ae=useMemo(()=>{let b=Mg(e);if(z.trim()){let B=z.toLowerCase();b=b.filter(H=>H.name.toLowerCase().includes(B));}return X!=="all"&&(b=b.filter(B=>Re(B)===X)),be&&(b=b.filter(B=>Re(B)!=="completed")),b.sort((B,H)=>{let _,ne;switch(M){case "name":_=B.name.toLowerCase(),ne=H.name.toLowerCase();break;case "startDate":_=B.startDate?.getTime()||0,ne=H.startDate?.getTime()||0;break;case "endDate":_=B.endDate?.getTime()||0,ne=H.endDate?.getTime()||0;break;case "progress":_=B.progress||0,ne=H.progress||0;break;case "status":_=B.status||"todo",ne=H.status||"todo";break;case "priority":let he={urgent:0,high:1,medium:2,low:3,none:4};_=he[B.priority]??4,ne=he[H.priority]??4;break;case "position":return 0;default:return 0}return _<ne?fe==="asc"?-1:1:_>ne?fe==="asc"?1:-1:0}),b},[e,z,X,be,M,fe,Re]),ot=useCallback((b,B)=>{let H=he=>{a.onTaskUpdate?.({...b,...he});},_=he=>he?b.customFields?.find(de=>de.fieldId===he)?.value:void 0,ne=(he,J)=>{if(!he)return;let _e=[...b.customFields||[]],Ke=_e.findIndex(gt=>gt.fieldId===he);Ke>=0?_e[Ke]={fieldId:he,value:J}:_e.push({fieldId:he,value:J}),H({customFields:_e});};switch(B.type){case "name":return null;case "status":return jsx(wm,{value:b.status||(b.progress===100?"completed":b.progress&&b.progress>0?"in-progress":"todo"),onChange:J=>{H({status:J,progress:J==="completed"?100:J==="in-progress"?50:0});},isDark:E,locale:d,translations:K.status});case "priority":return jsx(Cm,{value:b.priority,onChange:J=>H({priority:J}),isDark:E,locale:d});case "assignees":return jsx(Sm,{value:b.assignees||[],availableUsers:l,onChange:J=>H({assignees:J}),isDark:E,locale:d});case "startDate":return jsx(Ni,{value:b.startDate,onChange:J=>H({startDate:J}),isDark:E,locale:d,dateField:"start",startDate:b.startDate,endDate:b.endDate});case "endDate":return jsx(Ni,{value:b.endDate,onChange:J=>H({endDate:J}),isDark:E,locale:d,dateField:"end",startDate:b.startDate,endDate:b.endDate});case "progress":return jsx(Im,{value:b.progress||0,onChange:J=>{let de=J===100?"completed":J>0?"in-progress":"todo";H({progress:J,status:de});},isDark:E});case "tags":return jsx(jm,{value:b.tags||[],isDark:E});case "text":return jsx(Om,{value:_(B.customFieldId)||"",onChange:J=>ne(B.customFieldId,J),isDark:E});case "number":return jsx(zm,{value:_(B.customFieldId)||0,onChange:J=>ne(B.customFieldId,J),isDark:E});case "date":let he=_(B.customFieldId);return jsx(Ni,{value:he?new Date(he):void 0,onChange:J=>ne(B.customFieldId,J),isDark:E,locale:d});case "dropdown":return jsx(Um,{value:_(B.customFieldId)||"",options:B.options||[],onChange:J=>ne(B.customFieldId,J),isDark:E});case "checkbox":return jsx(Gm,{value:_(B.customFieldId)||false,onChange:J=>ne(B.customFieldId,J),isDark:E});case "estimatedTime":{let J=b.status==="completed"||b.progress===100;return jsx(mr,{value:b.estimatedTime,onChange:de=>H({estimatedTime:de}),isDark:E,locale:d,disabled:J,lens:N,hourlyRate:I})}case "quotedTime":{let J=b.status==="completed"||b.progress===100,de=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsx(mr,{value:b.quotedTime,onChange:_e=>H({quotedTime:_e}),isDark:E,locale:d,disabled:J,isBlurred:de,lens:N,hourlyRate:I})}case "elapsedTime":{let J=b.status==="completed"||b.progress===100;return jsx(mr,{value:b.elapsedTime,onChange:de=>H({elapsedTime:de}),isDark:E,locale:d,disabled:J,lens:N,hourlyRate:I})}case "effortMinutes":{if(O&&b.subtasks&&b.subtasks.length>0){let{allocated:de}=Nn(b);return jsx(mr,{value:de>0?de:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I})}let J=b.status==="completed"||b.progress===100;return jsx(mr,{value:b.effortMinutes,onChange:de=>H({effortMinutes:de}),isDark:E,locale:d,disabled:J,lens:N,hourlyRate:I})}case "timeLoggedMinutes":{if(O&&b.subtasks&&b.subtasks.length>0){let{spent:de}=Nn(b);return jsx(mr,{value:de>0?de:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I})}let J=b.status==="completed"||b.progress===100;return jsx(mr,{value:b.timeLoggedMinutes,onChange:a.onLogTime?de=>{a.onLogTime?.(b,de);}:void 0,isDark:E,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:J,lens:N,hourlyRate:I})}case "soldEffortMinutes":{if(O&&b.subtasks&&b.subtasks.length>0){let{quoted:_e}=Nn(b),Ke=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsx(mr,{value:_e>0?_e:void 0,isDark:E,locale:d,disabled:true,isBlurred:Ke,lens:N,hourlyRate:I})}let J=b.status==="completed"||b.progress===100,de=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsx(mr,{value:b.soldEffortMinutes,onChange:_e=>H({soldEffortMinutes:_e}),isDark:E,locale:d,disabled:J,isBlurred:de,lens:N,hourlyRate:I})}case "scheduleVariance":return jsx(Xm,{startDate:b.startDate,endDate:b.endDate,scheduleVariance:b.scheduleVariance,isDark:E,locale:d});case "hoursBar":{if(O&&b.hasChildren){let{spent:J,allocated:de,quoted:_e}=Nn(b),Ke=J>de&&de>0;return jsxs("span",{className:m("text-[11px] font-mono flex items-center gap-1.5",E?"text-white/50":"text-gray-500"),children:[jsx("span",{className:m("font-bold",Ke?"text-[#FF453A]":E?"text-white/80":"text-gray-800"),children:Tn(J)}),de>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:E?"text-white/60":"text-gray-600",children:Tn(de)})]}),_e>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:E?"text-amber-400/70":"text-amber-600",children:Tn(_e)})]})]})}return jsx(Qm,{task:b,isDark:E,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:N,hourlyRate:I})}case "teamLoad":return jsx(Zm,{task:b,isDark:E});case "blockers":return jsx(tg,{blockers:b.blockers,isDark:E,locale:d});default:return jsx("span",{className:m("text-sm",E?"text-white/60":"text-gray-500"),children:"-"})}},[a,E,d,l,K,O]),ae=useCallback(b=>{let H={name:K.columns.name,status:K.columns.status,priority:K.columns.priority,assignees:K.columns.assignees,startDate:K.columns.startDate,endDate:K.columns.endDate,progress:K.columns.progress,tags:K.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:K.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:K.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:K.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:K.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:K.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:K.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:K.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:K.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:K.columns.teamLoad||(d==="es"?"Carga Equipo":"Team Load"),blockers:K.columns.blockers||(d==="es"?"Bloqueantes":"Blockers")}[b.type]||b.label;return typeof H=="string"?H:String(H||b.type)},[K,d]),me=useMemo(()=>{let H=Le.reduce((ne,he)=>ne+he.width,0)+(v?48:0),_={};for(let ne of Le)_[ne.id]=`${ne.width/H*100}%`;return _},[Le,v]);return r?jsx("div",{className:m("flex-1 flex items-center justify-center",E?"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:m("text-sm",E?"text-white/60":"text-gray-600"),children:[K.empty.noTasks,"..."]})]})}):o?jsx("div",{className:m("flex-1 flex items-center justify-center",E?"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:m("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:m("text-sm",E?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:m("flex-1 flex items-center justify-center",E?"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:m("text-lg font-semibold mb-2",E?"text-white":"text-gray-900"),children:K.empty.noTasks}),jsx("p",{className:m("text-sm",E?"text-white/60":"text-gray-600"),children:K.empty.addFirstTask})]})}):jsxs("div",{ref:D,className:m(E?"bg-[#0D0D0D]":"bg-white",ye&&"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:m("flex-shrink-0 px-6 py-4 border-b",E?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:m("text-sm",E?"text-white/60":"text-gray-600"),children:[Ae.length," ",K.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",E?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:z,onChange:b=>te(b.target.value),placeholder:K.toolbar.searchPlaceholder,className:m("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",E?"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"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),jsx(kg,{value:X,hideCompleted:be,onChange:Me,onHideCompletedChange:$e,isDark:E,locale:d}),q?.enabled&&q.data&&!Ce&&jsx("button",{onClick:()=>je(true),className:m("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",E?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),k&&w&&jsxs(motion.button,{onClick:w,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:K.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:m("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",E?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Le.map(b=>{let B=b.id!=="name",H=we===b.id&&Y!==b.id;return jsxs("div",{className:m("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",E?"text-white/60":"text-gray-500",B&&"cursor-grab",Y===b.id&&"opacity-50",H&&(E?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:me[b.id],minWidth:b.minWidth},draggable:B,onDragStart:B?_=>At(_,b.id):void 0,onDragEnd:B?Dt:void 0,onDragOver:B?_=>mt(_,b.id):void 0,onDragLeave:B?bt:void 0,onDrop:B?_=>lt(_,b.id):void 0,onContextMenu:_=>it(_,void 0,b.id),children:[B&&jsx(GripVertical,{className:m("w-3 h-3 flex-shrink-0 transition-opacity",E?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),b.sortable?jsxs("button",{draggable:false,onClick:()=>Be(b.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[ae(b),jsx(ArrowUpDown,{className:m("w-3 h-3",M===b.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:ae(b)}),f&&b.resizable&&jsx("div",{className:m("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",ye===b.id&&"bg-[#007BFF]"),onMouseDown:_=>Ze(_,b.id)})]},b.id)}),v&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:b=>{b.stopPropagation(),Je(B=>!B);},className:m("p-0.5 rounded transition-colors",E?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Z&&(E?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(fg,{isOpen:Z,onClose:()=>Je(false),columns:De,customFields:u,onColumnsChange:Ne,onCreateCustomField:()=>{Je(false),Qe(true);},isDark:E,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ae.map((b,B)=>{let H=ee.has(b.id),_=Math.min(B*.01,.2),ne=b.hasChildren&&b.level===0,he=b.subtasks?.length||0;if(ne){let{spent:J,allocated:de,quoted:_e}=Nn(b),Ke=G1(b),gt=V1(b);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:_},className:m("flex items-center border-y cursor-pointer",E?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>Te(b.id),children:Le.map(Ot=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:me[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Ht=>{Ht.stopPropagation(),Te(b.id);},className:m("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:H?jsx(ChevronDown,{className:m("w-4 h-4",E?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:m("w-4 h-4",E?"text-white/40":"text-gray-500")})}),H?jsx(FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"}}),b.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:E?"#FFD60A":"#B45309"},children:b.wbsCode}),jsx("span",{title:b.name,className:m("text-[11px] font-semibold uppercase tracking-wide truncate",E?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:b.name}),jsxs("span",{className:m("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",E?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",he," ",d==="es"?he===1?"Tarea":"Tareas":he===1?"Item":"Items",")"]}),Ke!==null&&jsxs("span",{className:m("text-[10px] font-mono flex-shrink-0",Ke>=1?"text-[#32D74B]":Ke>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",Ke.toFixed(2)]}),gt>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",gt]})]}):Ot.type==="timeLoggedMinutes"?jsx(mr,{value:J>0?J:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I}):Ot.type==="soldEffortMinutes"?jsx(mr,{value:_e>0?_e:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I}):Ot.type==="effortMinutes"?jsx(mr,{value:de>0?de:void 0,isDark:E,locale:d,disabled:true,lens:N,hourlyRate:I}):ot(b,Ot)},Ot.id))},b.id)}return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:_},className:m("flex items-center border-b transition-colors",E?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(b),onDoubleClick:()=>a.onTaskDoubleClick?.(b),onContextMenu:J=>it(J,b),children:[Le.map(J=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:me[J.id],minWidth:J.minWidth},children:J.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[h&&b.level>0&&jsx("div",{style:{width:`${b.level*24}px`},className:"flex-shrink-0"}),h&&b.hasChildren&&jsx("button",{onClick:de=>{de.stopPropagation(),Te(b.id);},className:m("p-0.5 rounded flex-shrink-0",E?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:H?jsx(ChevronDown,{className:m("w-4 h-4",E?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:m("w-4 h-4",E?"text-white/60":"text-gray-400")})}),h&&!b.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(b.wbsCode||b.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[b.wbsCode&&jsx("span",{className:m("text-[10px] font-mono",E?"text-[#007BFF]":"text-blue-600"),children:b.wbsCode}),b.taskCode&&jsx("span",{className:m("text-[10px] font-mono",E?"text-white/40":"text-gray-400"),children:b.taskCode})]}),jsx("span",{className:m("truncate font-bold text-[13px]",E?"text-white":"text-gray-900",b.progress===100&&(E?"line-through text-white/30":"line-through text-gray-400")),children:b.name}),b.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${b.tags[0].color}20`,color:b.tags[0].color},children:b.tags[0].name})]})]}):ot(b,J)},J.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},b.id)})}),A&&Ae.length>0&&(()=>{let{spent:b,allocated:B,quoted:H}=L,_=B-b,ne=_<0,he=ne?`+${Tn(Math.abs(_))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Tn(_)} ${d==="es"?"AHORRADO":"SAVED"}`,J=N==="financial"&&I>0,de=gt=>J?`$${(gt/60*I).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Tn(gt),_e=J?Math.abs(_/60*I):0,Ke=J?`${ne?"+":"-"}$${_e.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ne?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:he;return jsxs("div",{className:m("flex items-center sticky bottom-0 z-10",E?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:E?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Le.map(gt=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:me[gt.id],minWidth:gt.minWidth},children:gt.type==="name"?jsx("span",{className:m("text-[11px] font-black uppercase tracking-widest",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):gt.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:m("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:de(b)}),jsx("span",{className:m("text-[11px]",E?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:m("text-[11px]",E?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:de(B)}),B>0&&jsx("span",{className:m("text-[10px] font-semibold ml-1",ne?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:J?Ke:he})]}):gt.type==="soldEffortMinutes"?jsx("span",{className:m("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:H>0?de(H):"\u2013"}):gt.type==="effortMinutes"?jsx("span",{className:m("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:B>0?de(B):"\u2013"}):gt.type==="timeLoggedMinutes"?jsx("span",{className:m("text-[12px] font-bold",E?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:b>0?de(b):"\u2013"}):jsx("span",{className:m("text-[11px]",E?"text-white/30":"text-gray-300"),children:"\u2013"})},gt.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ae.length===0&&z&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:m("w-12 h-12 mx-auto mb-4",E?"text-white/30":"text-gray-400")}),jsx("p",{className:m(E?"text-white/60":"text-gray-600"),children:K.empty.noResults})]})})]})}),q?.enabled&&q.data&&Ce&&jsx(Tg,{data:q.data,isDark:E,locale:d,onClose:()=>je(false)})]}),jsx(ng,{state:ct,onClose:at,isDark:E,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ge,onColumnSort:pt,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(yg,{isOpen:ue,onClose:()=>Qe(false),onSave:St,isDark:E,locale:d})]})}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 Gd={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"}},Li={en:Gd,es:Vd};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:m("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Gg=26,Q1=22,Z1=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 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 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 e5({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:u,spanCols:i,lane:c,isStart:d,isEnd:p}=e,g=u.progress===100||u.status==="completed",h=u.isCriticalPath,y=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",v=p?Kd(u.effortMinutes,n,l):null,f=p?Vg(u,n,l):null,x=p?u.blockers?.find(k=>k.severity==="critical"):null;return jsxs(motion.button,{onClick:k=>{k.stopPropagation(),a();},whileHover:{scale:1.005},className:m("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",y,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*Gg}px`,left:"1px",width:`calc(${i*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:d?"3px":void 0,borderLeftColor:d?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&&d&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:u.name}),p&&(v||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:m(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]}),u.progress>0&&u.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${u.progress}%`}})]})}function _g({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:u=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:p,currentUser:g,mentionableUsers:h,onUploadCommentAttachments:y,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,timerState:w,onLogTime:T,onUpdateEstimate:C,onUpdateSoldEffort:S,onStartTimer:N,onStopTimer:I,onDiscardTimer:O,blurFinancials:A=false,suppressDetailModal:K=false,lens:E="hours",hourlyRate:ce=0}){let{theme:L="dark",locale:q="en",customTranslations:Ce,showBacklog:je=true}=t,M=Ii(q,Ce),V=L==="dark"||L==="neutral",[fe,We]=useState(r||new Date),[z,te]=useState(null),[X$1,Me]=useState(null),[be,$e]=useState(null),[De,Xe]=useState({}),Z=3,Je=3,ue=useCallback(W=>{Me(W.id),K||te(W),v?.(W.id);},[K,v]),[Qe,ct]=useState(null),wt=useCallback(()=>{We(new Date(fe.getFullYear(),fe.getMonth()-1,1));},[fe]),ye=useCallback(()=>{We(new Date(fe.getFullYear(),fe.getMonth()+1,1));},[fe]),ut=useCallback(()=>{We(new Date);},[]),tt=useMemo(()=>{let W=fe.getFullYear(),ee=fe.getMonth(),Le=new Date(W,ee,1),Te=new Date(W,ee+1,0),Be=Le.getDay(),Ne=Te.getDate(),Ge=ns(e),pt=new Date;pt.setHours(0,0,0,0);let it=[],at=Be,Ze=new Date(W,ee,0).getDate();for(let Dt=at-1;Dt>=0;Dt--){let mt=new Date(W,ee-1,Ze-Dt);it.push({date:mt,isCurrentMonth:false,isToday:false,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ge.filter(bt=>jd(mt,bt)).map(bt=>({id:bt.id,title:bt.name,start:bt.startDate,end:bt.endDate,task:bt}))});}for(let Dt=1;Dt<=Ne;Dt++){let mt=new Date(W,ee,Dt),bt=mt.getTime()===pt.getTime();it.push({date:mt,isCurrentMonth:true,isToday:bt,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ge.filter(lt=>jd(mt,lt)).map(lt=>({id:lt.id,title:lt.name,start:lt.startDate,end:lt.endDate,task:lt}))});}let At=42-it.length;for(let Dt=1;Dt<=At;Dt++){let mt=new Date(W,ee+1,Dt);it.push({date:mt,isCurrentMonth:false,isToday:false,isWeekend:mt.getDay()===0||mt.getDay()===6,events:Ge.filter(bt=>jd(mt,bt)).map(bt=>({id:bt.id,title:bt.name,start:bt.startDate,end:bt.endDate,task:bt}))});}return it},[fe,e]),qe=useMemo(()=>ns(e).filter(W=>!W.startDate||!W.endDate),[e]),$=useMemo(()=>{let W=ns(e),ee=0,Le=0,Te=0,Be=0,Ne=0;W.forEach(Ze=>{Ze.effortMinutes&&(ee+=Ze.effortMinutes),Ze.soldEffortMinutes&&(Le+=Ze.soldEffortMinutes),Ze.scheduleVariance!=null&&(Te+=Ze.scheduleVariance,Be++),Ze.soldEffortMinutes&&Ze.effortMinutes&&(Ne+=Ze.soldEffortMinutes-Ze.effortMinutes);});let Ge=Le>0?Math.min(100,Math.round(ee/Le*100)):0,pt=Be>0?Math.round(Te/Be):0,at=`${Ne<0?"-":"+"}${Wg(Ne,E,ce)}`;return {budgetUtil:Ge,avgVariance:pt,costDisplay:at,hasCostData:Le>0}},[e,E,ce]),se=useMemo(()=>{let W=[0,0,0,0,0,0];return tt.forEach((ee,Le)=>{let Te=Math.floor(Le/7);ee.events.forEach(Be=>{if(Be.task.startDate&&Be.task.soldEffortMinutes){let Ne=new Date(Be.task.startDate),Ge=ee.date;Ne.getFullYear()===Ge.getFullYear()&&Ne.getMonth()===Ge.getMonth()&&Ne.getDate()===Ge.getDate()&&Te<W.length&&(W[Te]-=Be.task.soldEffortMinutes);}});}),W},[tt]),D=useMemo(()=>{let W=ns(e),ee=new Map,Le=new Set,Te=[0,0,0,0,0,0];if(tt.length===0)return {segmentsByCell:ee,multiDayTaskIds:Le,maxLanesPerRow:Te};let Be=at=>new Date(at.getFullYear(),at.getMonth(),at.getDate()),Ne=Be(tt[0].date),Ge=Be(tt[tt.length-1].date),pt=[];for(let at of W){if(!at.startDate||!at.endDate)continue;let Ze=Be(at.startDate),At=Be(at.endDate);if(Ze.getTime()===At.getTime()||At<Ne||Ze>Ge)continue;let Dt=Ze<Ne?Ne:Ze,mt=At>Ge?Ge:At,bt=Ug(Dt,Ne),lt=Ug(mt,Ne);bt<0||bt>41||lt<0||lt>41||bt!==lt&&(Le.add(at.id),pt.push({task:at,startIdx:bt,endIdx:lt}));}pt.sort((at,Ze)=>at.startIdx!==Ze.startIdx?at.startIdx-Ze.startIdx:Ze.endIdx-Ze.startIdx-(at.endIdx-at.startIdx));let it=[[],[],[],[],[],[]];for(let{task:at,startIdx:Ze,endIdx:At}of pt){let Dt=Math.floor(Ze/7),mt=Math.floor(At/7),bt=Be(at.startDate),lt=Be(at.endDate),St=false;for(let Re=Dt;Re<=mt;Re++){let Ae=Re===Dt?Ze%7:0,ot=Re===mt?At%7:6,ae=ot-Ae+1,me=0,b=it[Re]??[];for(it[Re]||(it[Re]=b);me<b.length&&(b[me]??-1)>=Ae;)me++;if(me>=Z1){St=true;break}me>=b.length?b.push(ot):b[me]=ot,Te[Re]=Math.max(Te[Re]??0,me+1);let B=Re===Dt&&bt>=Ne,H=Re===mt&&lt<=Ge,_=Re*7+Ae,ne={taskId:at.id,task:at,rowIndex:Re,startCol:Ae,endCol:ot,spanCols:ae,lane:me,isStart:B,isEnd:H};ee.has(_)||ee.set(_,[]),ee.get(_).push(ne);}St&&(Le.delete(at.id),ee.forEach((Re,Ae)=>{let ot=Re.filter(ae=>ae.taskId!==at.id);ot.length===0?ee.delete(Ae):ee.set(Ae,ot);}));}return {segmentsByCell:ee,multiDayTaskIds:Le,maxLanesPerRow:Te}},[tt,e]),Y=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=fe.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),we=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsx("div",{className:m("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:l,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:m("text-sm font-mono",V?"text-white/30":"text-gray-600"),children:[M.labels.noEvents,"..."]})]})}):s?jsx("div",{className:m("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:m("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:m("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:m("text-sm",V?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:m("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:m("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:m("w-8 h-8",V?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:m("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:M.labels.noEvents}),jsx("p",{className:m("text-sm",V?"text-white/30":"text-gray-600"),children:M.labels.newTask})]})}):jsxs("div",{className:m("flex-1 flex flex-col w-full h-full overflow-hidden",V?"bg-[#050505]":"bg-white",n),style:l,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:m("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:m("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:m("w-3.5 h-3.5",V?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:m("font-medium",V?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:m("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:wt,className:m("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:m("text-sm font-semibold tracking-tight min-w-[150px] text-center",V?"text-white":"text-gray-900"),children:we}),jsx("button",{onClick:ye,className:m("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:m("h-4 w-px",V?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:ut,className:m("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:M.navigation.today})]})]}),jsx("div",{className:m("grid grid-cols-7 sticky top-0 z-10",V?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(W=>jsx("div",{className:m("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:m("grid grid-cols-7 min-h-[800px]",V?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Me(null),children:tt.map((W,ee)=>{let Le=ee%7===6,Te=ee>=35;return jsxs("div",{className:m("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Le&&(V?"border-r border-[#222]":"border-r border-gray-200"),!Te&&(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:m("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 Be=Math.floor(ee/7),Ne=(D.maxLanesPerRow[Be]??0)*Gg,Ge=D.segmentsByCell.get(ee);return Ne===0&&!Ge?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:Ge?.map(pt=>jsx(e5,{segment:pt,isDark:V,blurFinancials:A,isSelected:X$1===pt.taskId,t:M,lens:E,hourlyRate:ce,onClick:()=>{ue(pt.task),a.onEventClick?.({id:pt.task.id,title:pt.task.name,start:pt.task.startDate,end:pt.task.endDate,task:pt.task});}},pt.taskId))})})(),(()=>{let Be=W.events.filter(Ne=>Ne.task.isMilestone&&!D.multiDayTaskIds.has(Ne.id));return Be.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Be.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:Ge=>{Ge.stopPropagation(),ue(Ne.task);}},Ne.id)),Be.length>4&&jsxs("span",{className:m("text-[8px] font-mono",V?"text-white/30":"text-gray-400"),children:["+",Be.length-4]})]})})(),(()=>{let Be=[];W.events.forEach(Ge=>{Ge.task.blockers?.forEach(pt=>{(pt.severity==="warning"||pt.severity==="critical")&&Be.push({taskId:Ge.id,type:pt.type,severity:pt.severity,variance:Ge.task.scheduleVariance});});});let Ne=Be[0];return Ne?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:m("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:[M.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${M.labels.delay})`:""]})]})}):null})(),(()=>{let Be=W.events.filter(it=>!D.multiDayTaskIds.has(it.id)),Ne=De[ee]||Z,Ge=Be.slice(0,Ne),pt=Be.length-Ne;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ge.map(it=>jsxs(motion.button,{onClick:()=>{ue(it.task),a.onEventClick?.(it);},whileHover:{scale:1.01},className:m("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",it.task.progress===100||it.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?it.task.progress===100||it.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)"}:it.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:m("flex-shrink-0 text-[9px]",it.task.isMilestone?V?"text-amber-400":"text-amber-600":it.task.isCriticalPath?"text-red-400":V?"text-[#1264FF]":"text-gray-400"),children:it.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:it.title})]},it.id)),pt>0&&jsxs("button",{onClick:it=>{it.stopPropagation(),Xe(at=>({...at,[ee]:Ne+Je}));},className:m("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:["+",pt," ",q==="es"?"m\xE1s":"more"]}),Ne>Z&&Be.length>Z&&jsx("button",{onClick:it=>{it.stopPropagation(),Xe(at=>({...at,[ee]:Z}));},className:m("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 Be=ee>=28,Ne=ee%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Ge=>{Ge.stopPropagation(),ct(Qe===ee?null:ee);},className:m("w-5 h-5 rounded flex items-center justify-center transition-all",Qe===ee?"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:m("w-3.5 h-3.5 transition-transform",Qe===ee&&"rotate-45")})}),jsx(AnimatePresence,{children:Qe===ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ct(null)}),jsx(motion.div,{initial:{opacity:0,y:Be?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Be?-5:5,scale:.95},transition:{duration:.12},className:m("absolute w-[320px] rounded-lg shadow-2xl z-50",Be?"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:Ge=>{a.onTaskCreate?.({name:Ge.name,startDate:Ge.startDate||W.date,endDate:Ge.endDate||W.date,priority:Ge.priority,assignees:Ge.assignee?[Ge.assignee]:void 0}),ct(null);},onCancel:()=>ct(null),availableUsers:t.availableUsers,isDark:V,locale:q==="es"?"es":"en",defaultDate:W.date,dropdownDirection:Be?"up":"down"})})]})})]})})()}),ee%7===6&&(()=>{let Be=Math.floor(ee/7),Ne=se[Be];if(!Ne||Ne===0)return null;let Ge=Wg(Ne,E,ce);return jsxs("div",{className:m("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:[M.labels.cashOut,": ",Ne<0?"-":"+",Ge]})})()]},ee)})})})]}),je&&jsxs("aside",{className:m("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:m("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:m("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:M.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:m("text-[10px] font-mono tabular-nums",V?"text-white/20":"text-gray-400"),children:qe.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:qe.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:m("w-10 h-10 rounded-xl flex items-center justify-center mb-3",V?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:m("w-5 h-5",V?"text-white/20":"text-gray-400")})}),jsx("p",{className:m("text-xs font-mono",V?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):qe.map(W=>jsxs("button",{onClick:()=>{ue(W);},className:m("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:m("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",V?"bg-white/20":"bg-gray-300")}),jsx("span",{className:m("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(ee=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ee.color}15`,color:ee.color,border:`1px solid ${ee.color}30`},children:ee.name},ee.id)),W.tags.length>3&&jsxs("span",{className:m("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:m("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",V?"text-white/25":"text-gray-400",A&&"blur-sm select-none"),children:[Kd(W.effortMinutes,E,ce)&&jsxs("span",{children:[M.labels.estimate,": ",Kd(W.effortMinutes,E,ce)]}),(()=>{let ee=Vg(W,E,ce);return ee?jsx("span",{className:ee.isNegative?"text-red-400":"text-emerald-400",children:ee.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:m("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((ee,Le)=>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:ee.color||"#007FFF"},title:ee.name,children:ee.initials||ee.name?.slice(0,2).toUpperCase()},Le))})]})]},W.id))}),a.onTaskCreate&&jsx("div",{className:m("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:M.labels.typeToAdd,className:m("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="");}})}),$.hasCostData&&jsxs("div",{className:m("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:m("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:["\u25C8 ",M.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:m("text-[10px] font-mono",V?"text-white/40":"text-gray-500"),children:M.labels.budgetUtil}),jsxs("span",{className:m("text-[10px] font-mono font-bold tabular-nums",V?"text-white/60":"text-gray-700",A&&"blur-sm select-none"),children:[$.budgetUtil,"%"]})]}),jsx("div",{className:m("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:`${$.budgetUtil}%`,background:$.budgetUtil>90?"#EF4444":$.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:m("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:m("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:M.labels.variance}),jsxs("div",{className:m("text-[11px] font-mono font-bold tabular-nums",$.avgVariance>0?"text-emerald-400":$.avgVariance<0?"text-red-400":V?"text-white/50":"text-gray-600"),children:[$.avgVariance>0?"+":"",$.avgVariance," ",M.labels.days]})]}),jsxs("div",{className:m("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:m("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:M.labels.cost}),jsx("div",{className:m("text-[11px] font-mono font-bold tabular-nums",$.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",A&&"blur-sm select-none"),children:$.costDisplay})]})]})]})]})]}),!K&&jsx(Xr,{task:z,isOpen:!!z,onClose:()=>te(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),te(W);},theme:L==="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:u,onCreateTag:i,attachments:z?c?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ns(e).filter(W=>W.id!==z?.id),comments:d?.filter(W=>W.taskId===z?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:h,onUploadCommentAttachments:y,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,isTimerRunning:w?.isRunning,timerElapsedSeconds:w?.elapsedSeconds,onTimeLog:T,onEstimateUpdate:C,onSoldEffortUpdate:S,onTimerStart:N,onTimerStop:I,onTimerDiscard:O,blurFinancials:A}),jsx(AnimatePresence,{children:be&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>$e(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:m("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:m("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:m("font-medium text-sm",V?"text-white/90":"text-gray-900"),children:be.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>$e(null),className:m("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:be.events.map(W=>jsxs("button",{onClick:()=>{$e(null),ue(W.task);},className:m("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:m("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 a5({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[u,i]=useState(false),c=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=c.length,h=new Set(c.flatMap(f=>f.assignedUserIds||[])).size,y=c.map(f=>f.priority).filter(Boolean),v=new Set(c.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:h,priorities:y,labels:v}},[c]),p=()=>{o?.(e.id);};return jsxs("div",{className:m("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:m("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),u&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children: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:l}){let u=useMemo(()=>({...Yg,...n}),[n]),[i,c]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let x=new Map;return e.forEach(k=>{let w=k.timestamp.toISOString().split("T")[0],T=x.get(w);T?T.push(k):x.set(w,[k]);}),Array.from(x.entries()).sort((k,w)=>w[0].localeCompare(k[0])).map(([k,w])=>({date:new Date(k),events:w.sort((T,C)=>C.timestamp.getTime()-T.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:g,uniqueTypes:h}=useMemo(()=>{let x=new Set,k=new Set;return e.forEach(w=>{x.add(w.userId),k.add(w.type);}),{uniqueUsers:Array.from(x),uniqueTypes:Array.from(k)}},[e]),y=x=>{c(k=>{let w=new Set(k);return w.has(x)?w.delete(x):w.add(x),w});},v=x=>{let w=new Date().getTime()-x.getTime(),T=Math.floor(w/6e4),C=Math.floor(w/36e5),S=Math.floor(w/864e5);return T<1?"just now":T<60?`${T}m ago`:C<24?`${C}h ago`:S<7?`${S}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&&d.current){let x=d.current.querySelector(`[data-event-id="${s}"]`);x&&x.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:m("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:m("history-timeline",u.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange: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:d,children:p.map(x=>jsxs("div",{className:"history-timeline-group",children:[u.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,w)=>{let T=i.has(k.id),C=s===k.id,S=qg(k.type);return jsxs("div",{"data-event-id":k.id,className:m("history-timeline-event",T&&"expanded",C&&"selected"),onClick:()=>o?.(k),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:S},children:u.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:ls(k.type)})}),w<x.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:S}})]}),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:[u.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:u.useRelativeTime?v(k.timestamp):k.timestamp.toLocaleString()})]}),Object.keys(k.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:N=>{N.stopPropagation(),y(k.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(k.changes).map(([N,I])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[N,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(I.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(I.to)})]})]},N)),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(([N,I])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[N,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(I)})]},N))]})]})]})]},k.id)})})]},x.date?.toISOString()||"all"))})]})}function Qg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:u,className:i}){let c=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:m("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:m("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&ls(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&is(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,h)=>jsx("div",{className:m("history-replay-progress-marker",h===e.currentIndex&&"active"),style:{left:`${h/(e.totalEvents-1)*100}%`},onClick:()=>l(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:m("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>u(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:m("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function 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 l5(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(c=>{let d=a/2,p=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(g=>{if(c.id===g.id)return;let h=c.x-g.x,y=c.y-g.y,v=Math.sqrt(h*h+y*y)||1,f=o.chargeStrength*i/(v*v);c.vx+=h/v*f,c.vy+=y/v*f;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),p=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!p)return;let g=p.x-d.x,h=p.y-d.y,y=Math.sqrt(g*g+h*h)||1,v=(y-o.linkDistance)/y*o.forceStrength*i;d.vx+=g*v,d.vy+=h*v,p.vx-=g*v,p.vy-=h*v;}),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:l,className:u}){let i=useRef(null),[c,d]=useState([]),[p,g]=useState(null),[h,y]=useState(null),[v,f]=useState(null),[x,k]=useState(1),[w,T]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let E=l5(e,t,a.width,a.height,a,150);d(E);},[e,t,a]);let C=useCallback((E,ce)=>{a.enableDragging&&(ce.stopPropagation(),g(E));},[a.enableDragging]),S=useCallback(E=>{if(!p||!i.current)return;let L=i.current.getBoundingClientRect(),q=(E.clientX-L.left-w.x)/x,Ce=(E.clientY-L.top-w.y)/x;d(je=>je.map(M=>M.id===p?{...M,x:q,y:Ce,fx:q,fy:Ce}:M));},[p,x,w]),N=useCallback(()=>{g(null);},[]),I=useCallback((E,ce)=>{ce.stopPropagation(),l?.({type:"node-click",node:E,position:{x:ce.clientX,y:ce.clientY}});},[l]),O=useCallback((E,ce)=>{ce.stopPropagation(),l?.({type:"edge-click",edge:E,position:{x:ce.clientX,y:ce.clientY}});},[l]),A=useCallback(E=>{let ce=c.find(L=>L.id===E);return ce?{x:ce.x,y:ce.y}:{x:0,y:0}},[c]),K=useCallback(E=>{if(E.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return E.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ce=E.card.priority;return ce==="URGENT"?"#ef4444":ce==="HIGH"?"#f59e0b":ce==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return E.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:m("relationships-graph-empty",u),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:m("relationships-graph",u),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(E=>Math.min(E+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(x*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k(E=>Math.max(E-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{k(1),T({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(E=>E.type))).map(E=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Jd(E)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Zg(E)," ",Qd(E)]})]},E))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:S,onMouseUp:N,onMouseLeave:N,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${x})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(E=>{let ce=A(typeof E.source=="string"?E.source:E.source.id),L=A(typeof E.target=="string"?E.target:E.target.id),q=e0(E.type),Ce=v===E.id,je=E.onCriticalPath;return jsxs("g",{className:m("relationships-graph-edge",Ce&&"hovered",je&&"critical"),onMouseEnter:()=>f(E.id),onMouseLeave:()=>f(null),onClick:M=>O(E,M),children:[jsx("line",{x1:ce.x,y1:ce.y,x2:L.x,y2:L.y,stroke:Jd(E.type),strokeWidth:je?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Ce?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Ce&&jsx("text",{x:(ce.x+L.x)/2,y:(ce.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Qd(E.type)})]},E.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(E=>{let ce=h===E.id,L=E.onCriticalPath;return jsxs("g",{className:m("relationships-graph-node",ce&&"hovered",L&&"critical"),transform:`translate(${E.x}, ${E.y})`,onMouseDown:q=>C(E.id,q),onMouseEnter:()=>y(E.id),onMouseLeave:()=>y(null),onClick:q=>I(E,q),children:[jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:K(E),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:ce?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:E.card.title.length>20?E.card.title.substring(0,20)+"...":E.card.title})]},E.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(""),[l,u]=useState(false),[i,c]=useState(null),[d,p]=useState(null),g=useRef(null),h=l||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let x=k=>{k.key==="Escape"&&!h&&y();};if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,h]);let y=()=>{h||(n(""),c(null),p(null),t());},v=async()=>{if(!(!s.trim()||h)){u(true),c(null),p(null);try{let x=await r(s.trim());p(x);}catch(x){c(x instanceof Error?x.message:"Failed to generate plan");}finally{u(false);}}},f=()=>{d&&(a(d),y());};return e?jsxs(Bt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:y}),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:y,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:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((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 (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.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)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange: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."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((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:y,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"}),d?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:v,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 c5={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},u5={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 p5(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=p5(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),l=a.filter(d=>d.success),u=a.reduce((d,p)=>d+p.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?u/r:0,successRate:r>0?l.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 l=this.operations.filter(c=>c.timestamp>=n).length,u=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:u,percentUsed:i,isExceeded:l>=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 u=setInterval(()=>{o(Uo.getStats()),n(Uo.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let l=Uo.getRecentOperations(5);return jsxs(Bt,{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:u=>u.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(([u,i])=>{let c=r.costsByFeature[u]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:u.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children: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:`${d}%`}})})]},u)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ds(u.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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,l]=useState(""),[u,i]=useState(""),[c,d]=useState(""),[p,g]=useState(false),[h,y]=useState(null),[v,f]=useState(null),[x,k]=useState(null),w=useRef(null),T=p||o;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let O=A=>{A.key==="Escape"&&!T&&C();};if(e)return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[e,T]);let C=()=>{T||(l(""),i(""),d(""),y(null),f(null),k(null),t());},S=async()=>{if(!(!n.trim()||T)){g(true),y(null),f(null),k(null);try{let O=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||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){y(O instanceof Error?O.message:"Failed to generate tasks");}finally{g(false);}}},N=()=>{v&&(a(v),C());};if(!e)return null;let I=x?.similarity?((x.similarity||0)*100).toFixed(0):"0";return jsxs(Bt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),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:C,disabled:T,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:v?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 (",I,"% 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:[v.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((O,A)=>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:["#",A+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:w,value:n,onChange:O=>l(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:T}),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:u,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:T})]}),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=>d(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:T})]})]}),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,A)=>jsx("button",{onClick:()=>l(O),disabled:T,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},A))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:T&&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:C,disabled:T,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"}),v?jsx("button",{onClick:N,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:S,disabled:!n.trim()||T,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:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function zi({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(v=>{t&&Cs(()=>Promise.resolve(t(v)),{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(v,f,x)=>{r(k=>{let w=k.cards.find(O=>O.id===v);if(!w)return k;let T=w.columnId,C={...w,columnId:f,position:x},S=k.cards.map(O=>O.id===v?C:O),N=k.columns.map(O=>{if(O.id===T)return {...O,cardIds:O.cardIds.filter(A=>A!==v)};if(O.id===f){let A=S.filter(K=>K.columnId===f).sort((K,E)=>K.position-E.position);return {...O,cardIds:A.map(K=>K.id)}}return O}),I={...k,cards:S,columns:N};return o(I),I});},[o]),n=useCallback(async(v,f)=>{r(x=>{let k=x.cards.map(T=>T.id===v?{...T,...f}:T),w={...x,cards:k};return o(w),w});},[o]),l=useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...v,id:f},w=x.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),T={...x,cards:[...x.cards,k],columns:w};return o(T),T});},[o]),u=useCallback(async v=>{r(f=>{let x=f.cards.find(C=>C.id===v);if(!x)return f;let k=f.cards.filter(C=>C.id!==v),w=f.columns.map(C=>C.id===x.columnId?{...C,cardIds:C.cardIds.filter(S=>S!==v)}:C),T={...f,cards:k,columns:w};return o(T),T});},[o]),i=useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...v,id:f,cardIds:[]},w={...x,columns:[...x.columns,k]};return o(w),w});},[o]),c=useCallback(async(v,f)=>{r(x=>{let k=x.columns.map(T=>T.id===v?{...T,...f}:T),w={...x,columns:k};return o(w),w});},[o]),d=useCallback(async v=>{r(f=>{let x=f.cards.filter(T=>T.columnId!==v),k=f.columns.filter(T=>T.id!==v),w={...f,cards:x,columns:k};return o(w),w});},[o]),p=useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(v),f},[l]),g=useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),h=useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:u,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:u,deleteColumn:d,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:(u,i,c={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(d=>d.columnId===u).length,...c});},addColumn:(u,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:u,position:i??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}),l=useCallback(y=>{o(v=>({...v,...y}));},[]),u=useCallback(y=>{n(v=>({...v,...y}));},[]),i=useCallback(()=>{o(cs),n(g0);},[]),c=useCallback(()=>{a&&o({...cs,assignees:[a]});},[a]),d=useCallback(()=>{o({...cs,dateFilter:"overdue"});},[]),p=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(y=>{let v=[...y];if(r.search){let f=r.search.toLowerCase();v=v.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"),w=String(f.getDate()).padStart(2,"0"),T=`${x}-${k}-${w}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let S=C.endDate||C.dueDate;if(!S)return false;let N;if(typeof S=="string")N=S.split("T")[0]||S;else {let I=S.getUTCFullYear(),O=String(S.getUTCMonth()+1).padStart(2,"0"),A=String(S.getUTCDate()).padStart(2,"0");N=`${I}-${O}-${A}`;}switch(r.dateFilter){case "overdue":return N<T;case "today":return N===T;case "this-week":let I=new Date(T+"T00:00:00"),O=new Date(N+"T00:00:00"),A=new Date(I);return A.setDate(A.getDate()+7),O>=I&&O<=A;case "custom":if(r.dateRange){let K=typeof S=="string"?new Date(S):S;return K>=r.dateRange.start&&K<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(k=>r.assignees.includes(k)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(x=>r.labels.includes(x)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,x)=>{let k=0;switch(s.by){case "created":let w=f.createdAt?new Date(f.createdAt).getTime():0,T=x.createdAt?new Date(x.createdAt).getTime():0;k=w-T;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},S=C[f.priority||"LOW"],N=C[x.priority||"LOW"];k=S-N;break;case "dueDate":let I=f.endDate||f.dueDate,O=x.endDate||x.dueDate;if(!I)return 1;if(!O)return -1;let A=typeof I=="string"?new Date(I).getTime():I.getTime(),K=typeof O=="string"?new Date(O).getTime():O.getTime();k=A-K;break;case "title":k=f.title.localeCompare(x.title);break;case "estimate":let E=f.estimatedTime||0,ce=x.estimatedTime||0;k=E-ce;break;default:k=0;}return s.order==="asc"?k:-k}),v},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:u,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:p,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 d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),u=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:u,onGenerateSubtasks:i,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(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,h=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(y=>y!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(h&&a.lastSelectedCardId){let y=t.find(f=>f.id===d),v=t.find(f=>f.id===a.lastSelectedCardId);if(y&&v&&y.columnId===v.columnId){let f=t.filter(N=>N.columnId===y.columnId).sort((N,I)=>N.position-I.position),x=f.findIndex(N=>N.id===a.lastSelectedCardId),k=f.findIndex(N=>N.id===d),[w,T]=x<k?[x,k]:[k,x],C=f.slice(w,T+1).map(N=>N.id),S=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:S,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:u,toggleCard:i,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([]),l=useCallback((y,v,f,x,k)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:y,cardIds:v,columnId:f,strategy:x,color:k,isExpanded:true,position:s.filter(T=>T.columnId===f).length,createdAt:new Date};n(T=>[...T,w]);},[o.minCardsPerStack,s]),u=useCallback(y=>{n(v=>v.filter(f=>f.id!==y));},[]),i=useCallback(y=>{n(v=>v.map(f=>f.id===y?{...f,isExpanded:!f.isExpanded}:f));},[]),c=useCallback((y,v)=>{n(f=>f.map(x=>x.id===y&&!x.cardIds.includes(v)?{...x,cardIds:[...x.cardIds,v]}:x));},[]),d=useCallback((y,v)=>{n(f=>f.map(x=>{if(x.id===y){let k=x.cardIds.filter(w=>w!==v);return k.length<o.minCardsPerStack?null:{...x,cardIds:k}}return x}).filter(x=>x!==null));},[o.minCardsPerStack]),p=useCallback(y=>s.filter(v=>v.columnId===y).sort((v,f)=>v.position-f.position),[s]),g=useCallback(async y=>{let v=t.filter(T=>T.columnId===y);if(v.length<o.minCardsPerStack*2)return [];let f=[],x=new Map;v.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(C=>{x.has(C)||x.set(C,[]),x.get(C).push(T);});}),x.forEach((T,C)=>{T.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:T.map(S=>S.id),columnId:y,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${C}"`,confidence:.85});});let k=new Map;v.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(C=>{k.has(C)||k.set(C,[]),k.get(C).push(T);});}),k.forEach((T,C)=>{T.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:T.map(S=>S.id),columnId:y,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(v.forEach(T=>{T.priority&&(w.has(T.priority)||w.set(T.priority,[]),w.get(T.priority).push(T));}),w.forEach((T,C)=>{if(T.length>=o.minCardsPerStack){let S={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${S} ${C} Priority`,cardIds:T.map(N=>N.id),columnId:y,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of v){let S=(await r.findSimilar(T,v)).filter(N=>N.similarity>=o.autoStackConfidenceThreshold);if(S.length>=o.minCardsPerStack-1){let N=[T.id,...S.map(O=>O.card.id)],I=S.reduce((O,A)=>O+A.similarity,0)/S.length;f.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:N,columnId:y,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${S.length+1} similar tasks`,confidence:I});}}return f.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,C)=>C.confidence-T.confidence).slice(0,5)},[t,o,r]),h=useCallback(y=>{l(y.stack.title,y.stack.cardIds,y.stack.columnId,y.stack.strategy,y.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),x=f[0];f.length>0&&x&&x.confidence>=.9&&h(x);});},[]),{stacks:s,createStack:l,deleteStack:u,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:p,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(u=>{let{Column:i}=vs("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=vs("@libxai/core");n.set(u.id,new i(u));});let l=null;if(t?.board){let{Board:u}=vs("@libxai/core");l=new u(t.board);}r.current=new BoardStore({board:l,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 l=useCallback(x=>{e.updateBoard(x);},[e]),u=useCallback(x=>{e.addColumn(x);},[e]),i=useCallback((x,k)=>{e.updateColumn(x,k);},[e]),c=useCallback(x=>{e.deleteColumn(x);},[e]),d=useCallback(x=>e.getColumn(x),[e]),p=useCallback(x=>{e.addCard(x);},[e]),g=useCallback((x,k)=>{e.updateCard(x,k);},[e]),h=useCallback(x=>{e.deleteCard(x);},[e]),y=useCallback((x,k,w)=>{e.moveCard(x,k,w);},[e]),v=useCallback(x=>e.getCard(x),[e]),f=useCallback(x=>e.getCardsByColumn(x),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:u,updateColumn:i,deleteColumn:c,getColumn:d,addCard:p,updateCard:g,deleteCard:h,moveCard:y,getCard:v,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 l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=u-i;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=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 l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{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);}},F5=new Wi;function F0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:u}){let i=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),p={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:i,style:p,className:o,children:jsx("div",{style:g,children:d.map(h=>{let y=e[h.index];if(!y)return null;let v=u?u(y,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(y,h.index)},v)})})})}function M0(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:l=16,getItemKey:u,horizontal:i=true}){let c=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},h={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:c,style:g,className:s,children:jsx("div",{style:h,children:p.map(y=>{let v=e[y.index];if(!v)return null;let f=u?u(v,y.index):y.index,x={position:"absolute",top:0,left:y.start,width:y.size,height:"100%"};return jsx("div",{style:x,"data-index":y.index,children:o(v,y.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}},Gi={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 A5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function xc(e="asakaa"){let t=yc(Gi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=A5(o);a.push(` ${s}: ${n};`);}return `:root {
414
414
  ${a.join(`
415
415
  `)}
416
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 {