@libxai/board 1.5.66 → 1.5.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +20 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6756 -0
- package/dist/index.d.ts +6756 -0
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import Rf 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,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,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,FileJson,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import ay from'react-markdown';import ry from'remark-gfm';import oy 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
|
|
2
|
-
`)}async function Hf(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 Rf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),i=n.toDataURL("image/png"),c=297,l=210,m=n.width/n.height,d=c-20,p=d/m;p>l-20&&(p=l-20,d=p*m);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,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let y=(c-d)/2;return g.addImage(i,"PNG",y,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 i=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,i.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):i.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(c.description,160);o.text(m,25,s),s+=m.length*5;}let l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let m=[];c.startDate&&m.push(`Start: ${c.startDate}`),c.endDate&&m.push(`End: ${c.endDate}`),l.push(m.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function
|
|
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 Rf 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,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,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,FileJson,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import ay from'react-markdown';import ry from'remark-gfm';import oy 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 Hs=(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 zs=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 [zs.Translate.toString(e),zs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return twMerge(clsx(e))}function Us(e,t){return e===null&&t===null?1e3:e===null&&t!==null?t/2:e!==null&&t===null?e+1e3:e!==null&&t!==null?(e+t)/2:1e3}function Pf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function hl(e,t){return e.length===0?1e3:t===0?Us(null,e[0].position):t>=e.length?Us(e[e.length-1].position,null):Us(e[t-1].position,e[t].position)}function ru(e,t=100){return e>t}var Af=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 Lf(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 Ws(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Af,onRetry:i}=t,c,l=0;for(let m=1;m<=a;m++){l=m;try{return {data:await e(),attempts:l,success:!0}}catch(d){if(c=d,m===a||!n(c,m))return {error:c,attempts:l,success:false};let g=Lf(m,r,o,s);if(i)try{i(c,m,g);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,g));}}return {error:c||new Error("Unknown error"),attempts:l,success:false}}function If(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Bf(e,t={}){return async(...a)=>Ws(()=>e(...a),t)}var yl=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 ou=(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))(ou||{}),_o=class _o{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,i=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(i,o,c?n:"");break;case "INFO":console.info(i,o,c?n:"");break;case "WARN":console.warn(i,o,c?n:"");break;case "ERROR":console.error(i,o,c?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",..._o.globalOptions};}static configure(t){_o.globalOptions={..._o.globalOptions,...t};}child(t){return new _o({...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 Gs((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Gs(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:ou[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};_o.globalOptions={};var xl=_o,Gs=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}},nu=new xl;function Of(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 $f(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(i=>i.id===s.columnId);return [s.id,vl(s.title),vl(s.description||""),vl(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function Hf(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 Rf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),i=n.toDataURL("image/png"),c=297,l=210,m=n.width/n.height,d=c-20,p=d/m;p>l-20&&(p=l-20,d=p*m);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,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let y=(c-d)/2;return g.addImage(i,"PNG",y,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 i=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,i.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):i.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(c.description,160);o.text(m,25,s),s+=m.length*5;}let l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let m=[];c.startDate&&m.push(`Start: ${c.startDate}`),c.endDate&&m.push(`End: ${c.endDate}`),l.push(m.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function vl(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
3
|
`)?`"${e.replace(/"/g,'""')}"`:e}async function iu(e,t,a,r){switch(t){case "json":return Of(e,r);case "csv":return $f(e);case "pdf":return await Hf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function lu(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${r}.pdf`;e.save(m);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"},i=new Blob([e],{type:n[t]}),c=URL.createObjectURL(i),l=document.createElement("a");l.href=c,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c);}function zf(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 Uf(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=du(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let i=du(t[n]||"");if(i.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((g,y)=>{l[g]=i[y]||"";});let m=l.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),p={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(i){s.push(`Line ${n+1}: ${i instanceof Error?i.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 du(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 cu(e,t){switch(t){case "json":return zf(e);case "csv":return Uf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function uu(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 vl=createContext(null);function pu(){return useContext(vl)}var mu=createContext(null);function gu({children:e,themeName:t}){return jsx(mu.Provider,{value:{themeName:t},children:e})}function fn(){return useContext(mu)}function Xt({children:e,container:t}){let[a,r]=useState(false),o=pu(),s=fn();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:i,themeName:c}=o,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var xu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},qf="#BDC3C7",Xf=({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 Vo({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),i=useRef(null),c=useRef(null),l=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,f=220,b=4,v=g.right-h;v<10&&(v=g.left),v+h>x-10&&(v=x-h-10);let C=y-g.bottom,N=g.top,T;C>=f+b?T=g.bottom+b:N>=f+b?T=g.top-f-b:T=C>=N?g.bottom+b:Math.max(10,g.top-f-b),n({top:T,left:v}),o(true);};useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let m=g=>{t(g),o(false);},d=e?xu[e]:null,p=d?.color||qf;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${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(Xt,{children:jsxs("div",{ref:i,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(xu).map(([g,y])=>jsxs("button",{onClick:()=>m(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:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(Xf,{color:y.color}),jsx("span",{className:"font-semibold text-sm",children:y.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:()=>m(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 Jf=[{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 jn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),p=(fn()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let v=l.current.getBoundingClientRect(),C=window.innerHeight,N=window.innerWidth,T=320,k=380,w=4,E=v.left;E+T>N-10&&(E=N-T-10),E<10&&(E=10);let I=C-v.bottom,D=v.top,X;I>=k+w?X=v.bottom+w:D>=k+w?X=v.top-k-w:X=I>=D?v.bottom+w:Math.max(10,v.top-k-w),i({top:X,left:E}),s(true);};useEffect(()=>{let v=C=>{c.current&&!c.current.contains(C.target)&&!l.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{let v=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let y=v=>{let C=new Date,N=E=>{let I=E.getFullYear(),D=String(E.getMonth()+1).padStart(2,"0"),X=String(E.getDate()).padStart(2,"0");return `${I}-${D}-${X}`},T=N(C),k=new Date(C);k.setDate(k.getDate()+v);let w=N(k);a(T,w),s(false);},x=()=>{if(!e||!t)return "Set date";let v=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=k.split("-").map(Number);if(w.length!==3||w.some(X=>isNaN(X)))return null;let E=w[0],I=w[1],D=w[2];return E===void 0||I===void 0||D===void 0?null:new Date(E,I-1,D)},C=v(e),N=v(t);if(!C||!N||isNaN(C.getTime())||isNaN(N.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[C.getMonth()]} ${C.getDate()} \u2013 ${T[N.getMonth()]} ${N.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,C=new Date;return C.setHours(0,0,0,0),v<C})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"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:x()})]}),o&&jsx(Xt,{children:jsxs("div",{ref:c,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:Jf.map(v=>jsx("button",{onClick:()=>y(v.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:C=>{C.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.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:v=>a(v.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:v=>a(e,v.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:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function jo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[i,c]=useState(""),[l,m]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let b=p.current.getBoundingClientRect(),v=window.innerHeight,C=window.innerWidth,N=300,T=380,k=4,w=b.right-N;w<10&&(w=b.left),w+N>C-10&&(w=C-N-10);let E=v-b.bottom,I=b.top,D;E>=T+k?D=b.bottom+k:I>=T+k?D=b.top-T-k:D=E>=I?b.bottom+k:Math.max(10,b.top-T-k),m({top:D,left:w}),n(true);};useEffect(()=>{let b=v=>{d.current&&!d.current.contains(v.target)&&!p.current?.contains(v.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=v=>{v.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let v=e.some(C=>C.id===b.id);a(v?e.filter(C=>C.id!==b.id):[...e,b]);},x=t.filter(b=>b.name.toLowerCase().includes(i.toLowerCase())),h=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:[h.map(b=>jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.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(Xt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:i,onChange:b=>c(b.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:x.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"}):x.map(b=>{let v=e.some(C=>C.id===b.id);return jsxs("button",{onClick:()=>y(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:C=>{C.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:b.color,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.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:b.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:v?"#3b82f6":"transparent"},children:v?"\u2713":""})]},b.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 Gs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,i=c=>{if(!s.has(c)){s.add(c),n.add(c);let l=r.get(c)||[];for(let m of l){if(!s.has(m)&&i(m))return true;if(n.has(m))return true}}return n.delete(c),false};return i(a)}function Yn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[i,c]=useState(false),[l,m]=useState(""),[d,p]=useState(t.length>0),[g,y]=useState({top:0,left:0}),[x,h]=useState(null),f=useRef(null),b=useRef(null),v=()=>{if(!b.current)return;let w=b.current.getBoundingClientRect(),E=window.innerHeight,I=window.innerWidth,D=300,X=d?380:120,O=4,H=w.right-D;H<10&&(H=w.left),H+D>I-10&&(H=I-D-10);let F=E-w.bottom,q=w.top,ee;F>=X+O?ee=w.bottom+O:q>=X+O?ee=w.top-X-O:ee=F>=q?w.bottom+O:Math.max(10,w.top-X-O),y({top:ee,left:H}),c(true);};useEffect(()=>{if(!i||!b.current)return;let w=b.current.getBoundingClientRect(),E=window.innerHeight,I=window.innerWidth,D=300,X=d?380:120,O=4,H=w.right-D;H<10&&(H=w.left),H+D>I-10&&(H=I-D-10);let F=E-w.bottom,q=w.top,ee;F>=X+O?ee=w.bottom+O:q>=X+O?ee=w.top-X-O:ee=F>=q?w.bottom+O:Math.max(10,w.top-X-O),y({top:ee,left:H});},[d,i]),useEffect(()=>{let w=E=>{f.current&&!f.current.contains(E.target)&&!b.current?.contains(E.target)&&(c(false),m(""));};if(i)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[i]),useEffect(()=>{let w=E=>{E.key==="Escape"&&(c(false),m(""));};if(i)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]);let C=w=>{let E=t.includes(w),I=a.find(D=>D.id===w);if(h(null),E){let D=t.filter(X=>X!==w);r(D),D.length===0&&p(false);}else {if(s&&Gs(a,w,e)){let X=`Cannot add "${I?.title||w}" as dependency - would create circular reference`;h(X),n?.(w,I?.title||w),setTimeout(()=>h(null),3e3);return}r([...t,w]),p(true);}},N=()=>{let w=!d;p(w),w||r([]);},T=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(l.toLowerCase())||w.id.toLowerCase().includes(l.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:b,onClick:()=>i?c(false):v(),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:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),i&&jsx(Xt,{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:[x&&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:x})]}),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:N,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:l,onChange:w=>m(w.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:T.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"}):T.map(w=>{let E=t.includes(w.id);return jsxs("button",{onClick:()=>C(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.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:E?"#3b82f6":"transparent",borderColor:E?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:E&&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:w.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var po=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:m,setNodeRef:d,transform:p,transition:g,isDragging:y}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:Hs.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:d,style:x,...l,...m,onClick:()=>a?.(e),children:t(e)});let h=i.filter(C=>e.assignedUserIds?.includes(C.id)),f=e.progress===100,b=(e.attachments||[]).filter(C=>C.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:v,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...m,onClick:C=>{C.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:C=>{C.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsx("img",{src:b[0].url,alt:b[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:C=>{C.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((C,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:C.url,alt:C.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}),N===3&&b.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:["+",b.length-4]})})]},C.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:C=>C.stopPropagation(),className:"priority-selector",children:jsx(Vo,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsx(jn,{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:(C,N)=>n?.(e.id,{startDate:C,endDate:N})})}),i.length>0&&jsx("div",{onClick:C=>C.stopPropagation(),className:"user-selector",children:jsx(jo,{assignedUsers:h,availableUsers:i,onChange:C=>n?.(e.id,{assignedUserIds:C.map(N=>N.id)})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"dependencies-selector",children:jsx(Yn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(C=>typeof C=="string"?C:C.taskId):[],availableTasks:c,onChange:C=>n?.(e.id,{dependencies:C})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(C=>jsx("span",{className:"asakaa-label",children:C},C))}),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)));po.displayName="Card";var Vs={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Mu=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Fu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),m=[...Object.entries(Vs).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(Vs).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=Vs[e];if(h)return {...h,id:e};let f=r.find(b=>b.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Vs.todo,id:"todo"}},p=()=>{if(!l.current)return;let h=l.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,v=180,C=280,N=4,T=h.right-v;T<10&&(T=h.left),T+v>b-10&&(T=b-v-10);let k=f-h.bottom,w=h.top,E;k>=C+N?E=h.bottom+N:w>=C+N?E=h.top-C-N:E=k>=w?h.bottom+N:Math.max(10,h.top-C-N),i({top:E,left:T}),s(true);};useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,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:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsx(Mu,{icon:y.icon,color:x})}),o&&jsx(Xt,{children:jsxs("div",{ref:c,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:m.map(h=>jsxs("button",{onClick:()=>g(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(Mu,{icon:h.icon,color:h.color}),jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Pu={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 Au({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Pu[s]||Pu.en,[i,c]=useState(false),[l,m]=useState(false),[d,p]=useState(e),[g,y]=useState({top:0,left:0}),x=useRef(null),h=useRef(null),f=useRef(null);useEffect(()=>{if(i&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[i]),useEffect(()=>{let N=T=>{x.current&&!x.current.contains(T.target)&&!h.current?.contains(T.target)&&(c(false),m(false));};if(i)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),useEffect(()=>{let N=T=>{T.key==="Escape"&&(c(false),m(false),p(e));};if(i)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i,e]),useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let b=()=>{m(true),p(e);},v=()=>{let N=d.trim();N&&N!==e&&t(N),m(false),c(false),p(e);},C=N=>{N.key==="Enter"?v():N.key==="Escape"&&(m(false),p(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:h,onClick:()=>c(!i),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"})]})}),i&&jsx(Xt,{children:jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:d,onChange:N=>p(N.target.value),onKeyDown:C,onBlur:v,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:b,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(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var yn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:m,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:f,renderMetrics:b,locale:v})=>{let{setNodeRef:C,isOver:N}=useDroppable({id:e.id,data:{type:"column",column:e}}),T=useRef(null),k=m??ru(t.length),w=useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>d,enabled:k});if(a)return jsx("div",{ref:C,className:f,children:a(e,t)});let I=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),D=I.state==="exceeded",X=()=>"asakaa-column-count";return jsxs("div",{ref:C,className:u("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",D&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u(X()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&I.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${I.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[I.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"})]}),I.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"})]}),I.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"})}),I.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"})]})]}),(y||x)&&jsx(Au,{columnTitle:e.title,onRename:O=>y?.(e.id,O),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:v}),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"})]})]}),b&&b(e,t),!p&&jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:k?"600px":void 0},children:jsx(SortableContext,{items:t.map(O=>O.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"})}):k?jsx("div",{style:{height:`${w.getTotalSize()}px`,position:"relative"},children:w.getVirtualItems().map(O=>{let H=t[O.index];return H?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsx(po,{card:H,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l})},H.id):null})}):t.map(O=>jsx(po,{card:O,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l},O.id))})})]})});yn.displayName="Column";function Nl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),i=useRef(null);useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let m=s.trim();m&&m!==e?t(m):n(e),o(false);},l=m=>{m.key==="Enter"?c():m.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:i,type:"text",value:s,onChange:m=>n(m.target.value),onBlur:c,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function hb(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 $u(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(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),m=c.split(/\s+/);return !!(l===s||c===s||m.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function yb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function xb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var vb=["\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 Hu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:m=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=i==="dark",[f,b]=useState(false),[v,C]=useState([]),[N,T]=useState(0),[k,w]=useState(null),[E,I]=useState(false),D=useRef(null),X$1=useRef(null),O=useRef(null),H=useRef(null),F=useCallback((z,re)=>{let J=hb(z,re);if(w(J),J){let Fe=r.filter(he=>he.name.toLowerCase().includes(J.query)||he.email&&he.email.toLowerCase().includes(J.query)).slice(0,5);C(Fe),b(Fe.length>0),T(0);}else b(false),C([]);},[r]),q=z=>{let re=z.target.value;if(t(re),F(re,z.target.selectionStart||0),D.current){D.current.style.height="24px";let J=D.current.scrollHeight,Fe=280,he=Math.min(J,Fe);D.current.style.height=`${he}px`,D.current.style.overflowY=J>Fe?"auto":"hidden";}},ee=()=>{D.current&&F(e,D.current.selectionStart||0);},Se=useCallback(z=>{if(!k||!D.current)return;let re=e.slice(0,k.start),J=e.slice(k.end),Fe=`@${z.name.replace(/\s+/g,"")} `,he=re+Fe+J;t(he),b(false),w(null),setTimeout(()=>{if(D.current){let Ue=k.start+Fe.length;D.current.selectionStart=Ue,D.current.selectionEnd=Ue,D.current.focus();}},0);},[k,e,t]),R=z=>{if(f&&v.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),T(re=>re<v.length-1?re+1:0);break;case "ArrowUp":z.preventDefault(),T(re=>re>0?re-1:v.length-1);break;case "Enter":{z.preventDefault();let re=v[N];re&&Se(re);break}case "Tab":{z.preventDefault();let re=v[N];re&&Se(re);break}case "Escape":z.preventDefault(),b(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};useEffect(()=>{let z=re=>{X$1.current&&!X$1.current.contains(re.target)&&D.current&&!D.current.contains(re.target)&&b(false),H.current&&!H.current.contains(re.target)&&I(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let j=useCallback(z=>{if(!D.current)return;let re=D.current.selectionStart||e.length,J=e.slice(0,re)+z+e.slice(re);t(J),I(false),setTimeout(()=>{if(D.current){let Fe=re+z.length;D.current.selectionStart=Fe,D.current.selectionEnd=Fe,D.current.focus();}},0);},[e,t]),be=useCallback(z=>{if(!g||!z.target.files)return;let re=Array.from(z.target.files),J=x*1024*1024,Fe=re.filter(he=>he.size>J?(console.warn(`File ${he.name} exceeds max size of ${x}MB`),false):true);Fe.length>0&&g(Fe),z.target.value="";},[g,x]),Je=useCallback(z=>z.type.startsWith("image/")?Image:z.type.includes("pdf")||z.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&X$1.current){let z=X$1.current.children[N];z&&z.scrollIntoView({block:"nearest"});}},[N,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 re=Je(z.file),J=z.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[J&&z.preview?jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(re,{className:u("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",h?"text-white":"text-gray-900"),children:z.file.name}),jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:xb(z.file.size)})]}),y&&jsx("button",{onClick:()=>y(z.id),className:u("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},z.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[m&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!E),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:vb.map(z=>jsx("button",{type:"button",onClick:()=>j(z),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:z},z))})})})]}),d&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:O,type:"file",multiple:true,onChange:be,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:D,value:e,onChange:q,onSelect:ee,onKeyDown:R,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"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:u("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"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&&v.length>0&&jsx(motion.div,{ref:X$1,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((z,re)=>jsxs("button",{type:"button",onClick:()=>Se(z),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",re===N?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:z.color||"#8B5CF6"},children:yb(z.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:z.name}),z.email&&jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.id))})})]})]})]})}function zu({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((i,c)=>i.type==="mention"?jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:i.value},c):jsx("span",{children:i.value},c))})}var qs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function No({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[i,c]=useState(false),[l,m]=useState(""),[d,p]=useState(false),[g,y]=useState(qs[10]||"#2E94FF"),[x,h]=useState({top:0,left:0}),f=useRef(null),b=useRef(null),v=useRef(null),C=useRef(null),N=t.filter(D=>D.name.toLowerCase().includes(l.toLowerCase())),T=t.some(D=>D.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(i&&b.current){let D=b.current.getBoundingClientRect();h({top:D.bottom+6,left:D.left});}},[i]),useEffect(()=>{let D=X=>{let O=X.target,H=f.current?.contains(O),F=v.current?.contains(O);!H&&!F&&(c(false),m(""),p(false));};if(i)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),useEffect(()=>{i&&C.current&&C.current.focus();},[i]);let k=D=>{let X=e.some(O=>O.id===D.id);a(X?e.filter(O=>O.id!==D.id):[...e,D]);},w=async()=>{if(!(!r||!l.trim())){p(true);try{let D=await r(l.trim(),g);D&&(a([...e,D]),m(""),y(qs[Math.floor(Math.random()*qs.length)]||"#2E94FF"));}finally{p(false);}}},E=(D,X)=>{X.stopPropagation(),a(e.filter(O=>O.id!==D));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:b,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,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(D=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${D.color}20`,color:D.color},children:D.name},D.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:i&&jsxs(motion.div,{ref:v,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:x.top,left:x.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:C,type:"text",value:l,onChange:D=>m(D.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:D=>{D.key==="Enter"&&l.trim()&&!T&&r&&w();}})}),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(D=>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:`${D.color}20`,color:D.color},onClick:X=>E(D.id,X),children:[D.name,jsx(X,{className:"w-3 h-3"})]},D.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(D=>{let X=e.some(O=>O.id===D.id);return jsxs("button",{type:"button",onClick:()=>k(D),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:X?`${D.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{X||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{X||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:D.color}}),jsx("span",{className:"flex-1 text-left",children:D.name}),X&&jsx(Check,{className:"w-4 h-4",style:{color:D.color}})]},D.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!T&&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:qs.map(D=>jsx("button",{type:"button",onClick:()=>y(D),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:D,outline:g===D?`2px solid ${D}`:"none",outlineOffset:"2px"}},D))}),jsxs("button",{type:"button",onClick:w,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 "',l.trim(),'"']})]})]})}),document.body)]})}function Sl({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 Wu({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(Sl,{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 Yo=[{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 Gu(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 Mb(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 Fb({className:e}){return jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function El({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Mb(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"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Gu(e.loggedMinutes),l=e.estimateMinutes?Gu(e.estimateMinutes):null,m=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(Fb,{className:i[t]}),jsx("span",{children:m})]})}function Pb(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 Js(e){let t=Pb(e);return t!==null?String(t):e}function _u(e){let a=Js(e).trim().toLowerCase();if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||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,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Qs(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 Ib(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 Bb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Rb({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 ju({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 Ob({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:i,onStopTimer:c,onDiscardTimer:l,onClose:m,className:d}){let[p,g]=useState(""),[y,x]=useState(t.estimateMinutes?Qs(t.estimateMinutes):""),[h,f]=useState(""),[b,v]=useState(false),[C,N]=useState(false),T=useRef(null);useEffect(()=>{T.current?.focus();},[]);let k=async()=>{let I=_u(p);if(!(I<=0||!s)){v(true);try{await s({durationMinutes:I,note:h.trim()||void 0,source:"manual"}),g(""),f("");}finally{v(false);}}},w=async()=>{if(!n)return;let I=y.trim()?_u(y):null;await n(I),N(false);},E=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),k()),I.key==="Escape"&&m?.();};return jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",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:m,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(ju,{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:Ib(o)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Rb,{className:"w-4 h-4"})}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(ju,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:i,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Bb,{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(Ob,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:T,type:"text",value:p,onChange:I=>g(I.target.value),onKeyDown:E,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:k,disabled:b||!p.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:h,onChange:I=>f(I.target.value),onKeyDown:E,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Qs(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"}),C?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:y,onChange:I=>x(I.target.value),onKeyDown:I=>{I.key==="Enter"&&w(),I.key==="Escape"&&N(false);},onBlur:w,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:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Qs(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(I=>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:I.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Qs(I.durationMinutes)})]},I.id))})]})]})}function Wb(e){let a=Js(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||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,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Gb(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 ao({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[i,c]=useState(Gb(r)),[l,m]=useState(""),[d,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let y=async()=>{p(true);let v=Wb(i);await o(v&&v>0?v:null,l||void 0),p(false);},x=async()=>{p(true),await o(null),p(false);},h=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),y()),v.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},b=t==="es";return jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.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:i,onChange:v=>c(v.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:l,onChange:v=>m(v.target.value),onKeyDown:h,placeholder:b?"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:y,disabled:d||!i.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?b?"Guardando...":"Saving...":b?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:x,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:b?"Quitar":"Clear"})]})]})}function Vb(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 _b(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 Pl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Vb(e.health),s=_b(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxs("div",{className:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),l&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function xn(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 Kb(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 Yb(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 qb(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 Xb({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",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",xn(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),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:i,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",c),children:xn(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",c),children:xn(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Jb({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",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",i),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?xn(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:xn(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[o,xn(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Yb(e.status,a),Kb(e.status,a)),children:qb(e.status,t)})})]})}function Al({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",i=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",m=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((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",i,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",m),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("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(Xb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",c,l),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:p,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",l),children:g.map(y=>jsx(Jb,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsx("div",{className:u("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 vn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function uh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.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 ap(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 ph(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 go({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:m=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:f=[],onUploadCommentAttachments:b,enableTimeTracking:v=false,timeTrackingSummary:C,timeEntries:N=[],isTimerRunning:T=false,timerElapsedSeconds:k=0,onTimeLog:w,onEstimateUpdate:E,onSoldEffortUpdate:I,onTimerStart:D,onTimerStop:X$1,onTimerDiscard:O,blurFinancials:H=false}){let F=s==="dark",q={textTertiary:F?"#6B7280":"#9CA3AF",textSecondary:F?"#9CA3AF":"#6B7280",textPrimary:F?"#FFFFFF":"#111827",borderLight:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:F?"#1A1D25":"#FFFFFF",bgSecondary:F?"#0A0A0A":"#F9FAFB",hoverBg:F?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ee=e&&"title"in e&&!("name"in e),Se=e,[R,j]=useState(e?ap(e,i):null),[be,Je]=useState(false),[z,re]=useState(false),[J,Fe]=useState(false),[he,Ue]=useState(null),[Be,nt]=useState(new Date),[Z,st]=useState(false),[oe,rt]=useState(false),[ht,Mt]=useState(""),[ke,yt]=useState(false),[dt,at]=useState(false),[$,de]=useState(false),[S,Y]=useState(false),[le,we]=useState(""),W=useRef(null),te=useRef(null),[We,Ce]=useState(""),He=useRef(null),[Ne,_e]=useState(""),[wt,mt]=useState(false),[ot,et]=useState([]),[Yt,Ft]=useState(""),[xt,Tt]=useState(false),gt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let A=ap(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:A?.id,taskName:A?.name,soldEffortMinutes:A?.soldEffortMinutes,quotedMinutes:A?.quotedMinutes,effortMinutes:A?.effortMinutes,timeLoggedMinutes:A?.timeLoggedMinutes}),j(A),we(A.description||""),Ce(A.name||"");}},[e?.id,e?.quotedMinutes,i,t]),useEffect(()=>{if(!t||!le)return;let A=setTimeout(()=>{let ge=te.current;ge&&(ge.style.height="auto",ge.style.height=`${Math.max(100,ge.scrollHeight)}px`);},50);return ()=>clearTimeout(A)},[t,le]),useEffect(()=>()=>{W.current&&clearTimeout(W.current),He.current&&clearTimeout(He.current);},[]),useEffect(()=>{t&>.current&&y.length>0&&setTimeout(()=>{gt.current&&(gt.current.scrollTop=gt.current.scrollHeight);},100);},[t,y.length]);let zt=useCallback(A=>{j(A),ee&&o&&Se?o(ph(A,Se)):r&&r(A);},[ee,Se,o,r]),Re=useCallback(()=>{Je(false),re(false),Fe(false),Ue(null),rt(false),Mt(""),yt(false);},[]),Ae=useCallback((A,ge)=>{if(!R)return;let Ve={...R,[A]:ge};zt(Ve);},[R,zt]),ct=useCallback(()=>{let A=te.current;A&&(A.style.height="auto",A.style.height=`${Math.max(100,A.scrollHeight)}px`);},[]),se=useCallback(A=>{we(A),setTimeout(ct,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(R){let ge={...R,description:A};zt(ge);}},800);},[R,zt,ct]),fe=useCallback(A=>{Ce(A),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(R&&A.trim()){let ge={...R,name:A.trim()};zt(ge);}},800);},[R,zt]),L=useCallback(A=>{let ge=A.map(Ve=>{let tt={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Ve};return Ve.type.startsWith("image/")&&(tt.preview=URL.createObjectURL(Ve)),tt});et(Ve=>[...Ve,...ge]);},[]),_=useCallback(A=>{et(ge=>{let Ve=ge.find(tt=>tt.id===A);return Ve?.preview&&URL.revokeObjectURL(Ve.preview),ge.filter(tt=>tt.id!==A)});},[]),K=useCallback(async()=>{if(!(!R||!Ne.trim()&&ot.length===0||!x)){mt(true);try{let A=$u(Ne,f),ge=[];if(ot.length>0&&b){let Ve=ot.map(tt=>tt.file);ge=await b(Ve);}await x(R.id,Ne.trim(),A.length>0?A:void 0,ge.length>0?ge:void 0),_e(""),ot.forEach(Ve=>{Ve.preview&&URL.revokeObjectURL(Ve.preview);}),et([]);}finally{mt(false);}}},[R,Ne,ot,x,f,b]),ue=useCallback(()=>{if(!R||!Yt.trim())return;let A=R.subtasks||[],ge={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Yt.trim(),progress:0,startDate:new Date,endDate:new Date,position:A.length},Ve=[...A,ge],tt={...R,subtasks:Ve};zt(tt),Ft(""),Tt(false);},[R,Yt,zt]),Me=useCallback(A=>{if(!R?.subtasks)return;let ge=R.subtasks.map(tt=>tt.id===A?{...tt,progress:tt.progress===100?0:100}:tt),Ve={...R,subtasks:ge};zt(Ve);},[R,zt]),Ke=useCallback(A=>{if(!R?.subtasks)return;let ge=R.subtasks.filter(tt=>tt.id!==A),Ve={...R,subtasks:ge};zt(Ve);},[R,zt]),je=useCallback(A=>{let ge=typeof A=="string"?new Date(A):A,tt=new Date().getTime()-ge.getTime(),oa=Math.floor(tt/6e4),Wt=Math.floor(tt/36e5),ka=Math.floor(tt/864e5);return oa<1?n==="es"?"Ahora":"Just now":oa<60?n==="es"?`Hace ${oa} min`:`${oa}m ago`:Wt<24?n==="es"?`Hace ${Wt}h`:`${Wt}h ago`:ka<7?n==="es"?`Hace ${ka}d`:`${ka}d ago`:ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Le=useCallback(A=>{if(!R)return;let ge=R.progress||0;A==="completed"?ge=100:A==="in-progress"&&ge===0?ge=10:A==="todo"&&(ge=0);let Ve={...R,status:A,progress:ge};zt(Ve),Je(false);},[R,zt]),ft=useCallback((A,ge)=>{if(!R)return;let Ve={...R,startDate:A,endDate:ge};zt(Ve);},[R,zt]),kt=useCallback(()=>{let A=Be.getFullYear(),ge=Be.getMonth(),Ve=new Date(A,ge,1),oa=new Date(A,ge+1,0).getDate(),Wt=Ve.getDay(),ka=[],Ca=new Date(A,ge,0).getDate();for(let fa=Wt-1;fa>=0;fa--)ka.push({date:new Date(A,ge-1,Ca-fa),isCurrentMonth:false});for(let fa=1;fa<=oa;fa++)ka.push({date:new Date(A,ge,fa),isCurrentMonth:true});let Wa=42-ka.length;for(let fa=1;fa<=Wa;fa++)ka.push({date:new Date(A,ge+1,fa),isCurrentMonth:false});return ka},[Be]),Ht=useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),de(false),!R||!d)return;let ge=Array.from(A.dataTransfer.files);if(ge.length!==0){Y(true);try{await d(R.id,ge);}finally{Y(false);}}},[R,d]),wa=useCallback(async A=>{if(!R||!d||!A.target.files)return;let ge=Array.from(A.target.files);if(ge.length!==0){Y(true);try{await d(R.id,ge);}finally{Y(false);}A.target.value="";}},[R,d]),ta=useCallback(A=>{A.preventDefault(),A.stopPropagation(),de(true);},[]),U=useCallback(A=>{A.preventDefault(),A.stopPropagation(),de(false);},[]),ne=useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),Oe=useCallback(A=>A.startsWith("image/")?Image:A.includes("pdf")||A.includes("document")?FileText:File,[]);return !t||!R?null:jsx(AnimatePresence,{children:t&&R&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",F?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",F?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",F?"text-[#6B7280]":"text-gray-400"),children:R.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let A=R.progress===100?0:100,Ve={...R,progress:A,status:A===100?"completed":"todo"};zt(Ve);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",R.progress===100?"bg-green-500 border-green-500":F?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:We,onChange:A=>fe(A.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",R.progress===100?"line-through text-[#6B7280]":F?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Re(),Je(!be);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",R.progress===100||R.status==="completed"?"bg-green-500/20 text-green-400":R.progress&&R.progress>0||R.status==="in-progress"?"bg-blue-500/20 text-blue-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?n==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Je(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(A=>jsxs("button",{onClick:()=>Le(A.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",R.status===A.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:A.label})]},A.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Re(),Fe(!J);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((A,ge)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},title:A.name,children:A.initials||A.name.slice(0,2).toUpperCase()},ge)),R.assignees.length>3&&jsxs("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:J&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(A=>{let ge=R.assignees?.some(Ve=>Ve.name===A.name);return jsxs("button",{onClick:()=>{let Ve=R.assignees||[],tt;ge?tt=Ve.filter(oa=>oa.name!==A.name):tt=[...Ve,A],Ae("assignees",tt);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",ge&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:A.color||"#8B5CF6"},children:A.initials||A.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",F?"text-white":"text-gray-900"),children:A.name}),ge&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},A.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Ue(he?null:"start"),nt(R.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",F?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ue(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let A=new Date,ge=new Date(A);ge.setDate(A.getDate()+1);let Ve=new Date(A);Ve.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let tt=new Date(A);tt.setDate(A.getDate()+((1-A.getDay()+7)%7||7));let oa=new Date(A);oa.setDate(A.getDate()+(6-A.getDay()+7)%7+7);let Wt=new Date(A);Wt.setDate(A.getDate()+14);let ka=new Date(A);return ka.setDate(A.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date: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:Ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:tt,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:oa,display:oa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Wt,display:Wt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ka,display:ka.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Wa,fa)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(he==="start"){let nr=R.endDate&&Wa.date>R.endDate?Wa.date:R.endDate;ft(Wa.date,nr),Ue("end");}else {let nr=R.startDate&&Wa.date<R.startDate?Wa.date:R.startDate;ft(nr,Wa.date),Ue(null);}},children:[jsx("span",{children:Wa.label}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Wa.display})]},fa))})(),jsx("div",{className:u("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{ft(void 0,void 0),Ue(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:he==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",F?"text-white":"text-gray-900"),children:Be.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>nt(new Date),className:u("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>nt(new Date(Be.getFullYear(),Be.getMonth()-1)),className:u("p-1 rounded",F?"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:()=>nt(new Date(Be.getFullYear(),Be.getMonth()+1)),className:u("p-1 rounded",F?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(A=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:A},A))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:kt().map((A,ge)=>{let Ve=A.date.toDateString()===new Date().toDateString(),tt=R.startDate?.toDateString()===A.date.toDateString(),oa=R.endDate?.toDateString()===A.date.toDateString(),Wt=tt||oa,ka=R.startDate&&R.endDate&&A.date>=R.startDate&&A.date<=R.endDate;return jsx("button",{onClick:()=>{let Ca=new Date(A.date);if(he==="start"){let Wa=R.endDate&&Ca>R.endDate?Ca:R.endDate;ft(Ca,Wa),Ue("end");}else {let Wa=R.startDate&&Ca<R.startDate?Ca:R.startDate;ft(Wa,Ca),Ue(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!A.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),A.isCurrentMonth&&(F?"text-white":"text-gray-900"),Ve&&"ring-2 ring-[#2E94FF]",tt&&"bg-[#2E94FF] text-white",oa&&!tt&&"bg-[#7C3AED] text-white",ka&&!Wt&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!Wt&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:A.date.getDate()},ge)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Re(),re(!z);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",R.priority==="high"||R.priority==="urgent"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":R.priority==="low"?"bg-green-500/20 text-green-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?n==="es"?"Alta":"High":R.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:()=>re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(A=>jsxs("button",{onClick:()=>{Ae("priority",A.id),re(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",R.priority===A.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:A.label})]},A.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",F?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"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:R.progress||0,onChange:A=>{let ge=parseInt(A.target.value),Ve=R.status;ge===100?Ve="completed":ge>0?Ve="in-progress":Ve="todo";let tt={...R,progress:ge,status:Ve};zt(tt);},onBlur:()=>st(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",F?"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:()=>st(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",F?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${R.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),v&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:R.status==="completed"||R.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?vn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsx("button",{type:"button",onClick:()=>at("estimate"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:vn(C.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>at("estimate"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:dt==="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(ao,{mode:"estimate",locale:n,isDark:F,currentValue:C?.estimateMinutes||null,onSave:async A=>{await E?.(R.id,A),at(false);},onClose:()=>at(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:H?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",F?"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"}):R.status==="completed"||R.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?vn(R.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>at("quoted"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:vn(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>at("quoted"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:dt==="quoted"&&!H&&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(ao,{mode:"quoted",locale:n,isDark:F,currentValue:R.quotedMinutes||null,onSave:async A=>{I?(await I(R.id,A),j(ge=>ge?{...ge,quotedMinutes:A}:null)):Ae("quotedMinutes",A),at(false);},onClose:()=>at(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",F?"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"})}):T?jsxs("button",{type:"button",onClick:()=>X$1?.(R.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),uh(k||0)]}):jsx("button",{type:"button",onClick:()=>D?.(R.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",F?"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"})}),R.status==="completed"||R.progress===100?jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",F?"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:()=>at("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",F?"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"]}),C&&C.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",C.health==="over-budget"?"text-red-500":C.health==="at-risk"?"text-yellow-500":F?"text-white":"text-gray-900"),children:[vn(C.loggedMinutes),C.estimateMinutes&&jsxs("span",{className:u("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",vn(C.estimateMinutes)]})]}),C.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:u("h-full rounded-full transition-all",C.health==="over-budget"?"bg-red-500":C.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,C.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:dt==="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(ao,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(A,ge)=>{A&&await w?.(R.id,{durationMinutes:A,note:ge,source:"manual"}),at(false);},onClose:()=>at(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(No,{selectedTags:R.tags||[],availableTags:c,onChange:A=>{Ae("tags",A);},onCreateTag:l,theme:q})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(A=>{let ge=g.find(Ve=>Ve.id===A);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ge?.name||A.slice(0,8),jsx("button",{onClick:()=>{let Ve=(R.dependencies||[]).filter(tt=>tt!==A);Ae("dependencies",Ve);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{onClick:()=>{Re(),rt(!oe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:oe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{rt(false),Mt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ht,onChange:A=>Mt(A.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",F?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(A=>A.id!==R.id).filter(A=>ht===""||A.name.toLowerCase().includes(ht.toLowerCase())).map(A=>{let ge=R.dependencies?.includes(A.id);return jsxs("button",{onClick:()=>{let Ve=R.dependencies||[],tt;ge?tt=Ve.filter(oa=>oa!==A.id):tt=[...Ve,A.id],Ae("dependencies",tt);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",ge&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ge?"bg-blue-500 border-blue-500":F?"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:u("block truncate",F?"text-white":"text-gray-900"),children:A.name}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:A.id.slice(0,8)})]})]},A.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Re(),yt(!ke);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"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:R.color||"#6366F1"}}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:Yo.find(A=>A.value===R.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ke&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>yt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Yo.map(A=>{let ge=R.color===A.value;return jsx("button",{onClick:()=>{Ae("color",A.value),yt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",ge&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:A.value,outlineColor:ge?A.value:void 0},title:A.name,children:ge&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},A.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"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:R.isMilestone||false,onChange:A=>Ae("isMilestone",A.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.isMilestone?"bg-purple-500 border-purple-500":F?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:te,value:le,onChange:A=>se(A.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",F?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(A=>A.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((A,ge)=>(A.position??0)-(ge.position??0)).map(A=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",F?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Me(A.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",A.progress===100?"bg-green-500 border-green-500":F?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:A.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",A.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:A.name}),jsx("button",{onClick:()=>Ke(A.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",F?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},A.id))}),xt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Yt,onChange:A=>Ft(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Yt.trim()?ue():A.key==="Escape"&&(Tt(false),Ft(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",F?"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:ue,disabled:!Yt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Yt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":F?"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:()=>{Tt(false),Ft("");},className:u("p-2 rounded-lg transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Tt(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",m.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",m.length,")"]})]}),m.length>0&&jsx("div",{className:"space-y-2 mb-4",children:m.map(A=>{let ge=Oe(A.type),Ve=A.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Ve&&A.thumbnailUrl?jsx("img",{src:A.thumbnailUrl,alt:A.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsx(ge,{className:u("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:A.name}),jsx("p",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:ne(A.size)})]}),p&&jsx("button",{onClick:()=>p(A.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",F?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},A.id)})}),jsxs("div",{onDragOver:ta,onDragLeave:U,onDrop:Ht,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",$?F?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":F?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",S&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:wa,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||S}),S?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",$?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",F?"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:u("text-xs mt-1",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",F?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",F?"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=du(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let i=du(t[n]||"");if(i.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((g,y)=>{l[g]=i[y]||"";});let m=l.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),p={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(i){s.push(`Line ${n+1}: ${i instanceof Error?i.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 du(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 cu(e,t){switch(t){case "json":return zf(e);case "csv":return Uf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function uu(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 wl=createContext(null);function pu(){return useContext(wl)}var mu=createContext(null);function gu({children:e,themeName:t}){return jsx(mu.Provider,{value:{themeName:t},children:e})}function hn(){return useContext(mu)}function Xt({children:e,container:t}){let[a,r]=useState(false),o=pu(),s=hn();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:i,themeName:c}=o,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var xu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},qf="#BDC3C7",Xf=({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 jo({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),i=useRef(null),c=useRef(null),l=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,f=220,b=4,w=g.right-h;w<10&&(w=g.left),w+h>x-10&&(w=x-h-10);let C=y-g.bottom,N=g.top,T;C>=f+b?T=g.bottom+b:N>=f+b?T=g.top-f-b:T=C>=N?g.bottom+b:Math.max(10,g.top-f-b),n({top:T,left:w}),o(true);};useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let m=g=>{t(g),o(false);},d=e?xu[e]:null,p=d?.color||qf;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${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(Xt,{children:jsxs("div",{ref:i,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(xu).map(([g,y])=>jsxs("button",{onClick:()=>m(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:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(Xf,{color:y.color}),jsx("span",{className:"font-semibold text-sm",children:y.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:()=>m(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 Jf=[{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 Yn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),p=(hn()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),C=window.innerHeight,N=window.innerWidth,T=320,k=380,v=4,E=w.left;E+T>N-10&&(E=N-T-10),E<10&&(E=10);let I=C-w.bottom,D=w.top,X;I>=k+v?X=w.bottom+v:D>=k+v?X=w.top-k-v:X=I>=D?w.bottom+v:Math.max(10,w.top-k-v),i({top:X,left:E}),s(true);};useEffect(()=>{let w=C=>{c.current&&!c.current.contains(C.target)&&!l.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),useEffect(()=>{let w=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let y=w=>{let C=new Date,N=E=>{let I=E.getFullYear(),D=String(E.getMonth()+1).padStart(2,"0"),X=String(E.getDate()).padStart(2,"0");return `${I}-${D}-${X}`},T=N(C),k=new Date(C);k.setDate(k.getDate()+w);let v=N(k);a(T,v),s(false);},x=()=>{if(!e||!t)return "Set date";let w=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=k.split("-").map(Number);if(v.length!==3||v.some(X=>isNaN(X)))return null;let E=v[0],I=v[1],D=v[2];return E===void 0||I===void 0||D===void 0?null:new Date(E,I-1,D)},C=w(e),N=w(t);if(!C||!N||isNaN(C.getTime())||isNaN(N.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[C.getMonth()]} ${C.getDate()} \u2013 ${T[N.getMonth()]} ${N.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,C=new Date;return C.setHours(0,0,0,0),w<C})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"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:x()})]}),o&&jsx(Xt,{children:jsxs("div",{ref:c,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:Jf.map(w=>jsx("button",{onClick:()=>y(w.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:C=>{C.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.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:w=>a(w.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:w=>a(e,w.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:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Yo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[i,c]=useState(""),[l,m]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let b=p.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,N=300,T=380,k=4,v=b.right-N;v<10&&(v=b.left),v+N>C-10&&(v=C-N-10);let E=w-b.bottom,I=b.top,D;E>=T+k?D=b.bottom+k:I>=T+k?D=b.top-T-k:D=E>=I?b.bottom+k:Math.max(10,b.top-T-k),m({top:D,left:v}),n(true);};useEffect(()=>{let b=w=>{d.current&&!d.current.contains(w.target)&&!p.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let w=e.some(C=>C.id===b.id);a(w?e.filter(C=>C.id!==b.id):[...e,b]);},x=t.filter(b=>b.name.toLowerCase().includes(i.toLowerCase())),h=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:[h.map(b=>jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.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(Xt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:i,onChange:b=>c(b.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:x.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"}):x.map(b=>{let w=e.some(C=>C.id===b.id);return jsxs("button",{onClick:()=>y(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:C=>{C.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:b.color,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.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:b.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},b.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 Vs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,i=c=>{if(!s.has(c)){s.add(c),n.add(c);let l=r.get(c)||[];for(let m of l){if(!s.has(m)&&i(m))return true;if(n.has(m))return true}}return n.delete(c),false};return i(a)}function Xn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[i,c]=useState(false),[l,m]=useState(""),[d,p]=useState(t.length>0),[g,y]=useState({top:0,left:0}),[x,h]=useState(null),f=useRef(null),b=useRef(null),w=()=>{if(!b.current)return;let v=b.current.getBoundingClientRect(),E=window.innerHeight,I=window.innerWidth,D=300,X=d?380:120,O=4,H=v.right-D;H<10&&(H=v.left),H+D>I-10&&(H=I-D-10);let F=E-v.bottom,q=v.top,ee;F>=X+O?ee=v.bottom+O:q>=X+O?ee=v.top-X-O:ee=F>=q?v.bottom+O:Math.max(10,v.top-X-O),y({top:ee,left:H}),c(true);};useEffect(()=>{if(!i||!b.current)return;let v=b.current.getBoundingClientRect(),E=window.innerHeight,I=window.innerWidth,D=300,X=d?380:120,O=4,H=v.right-D;H<10&&(H=v.left),H+D>I-10&&(H=I-D-10);let F=E-v.bottom,q=v.top,ee;F>=X+O?ee=v.bottom+O:q>=X+O?ee=v.top-X-O:ee=F>=q?v.bottom+O:Math.max(10,v.top-X-O),y({top:ee,left:H});},[d,i]),useEffect(()=>{let v=E=>{f.current&&!f.current.contains(E.target)&&!b.current?.contains(E.target)&&(c(false),m(""));};if(i)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]),useEffect(()=>{let v=E=>{E.key==="Escape"&&(c(false),m(""));};if(i)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]);let C=v=>{let E=t.includes(v),I=a.find(D=>D.id===v);if(h(null),E){let D=t.filter(X=>X!==v);r(D),D.length===0&&p(false);}else {if(s&&Vs(a,v,e)){let X=`Cannot add "${I?.title||v}" as dependency - would create circular reference`;h(X),n?.(v,I?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),p(true);}},N=()=>{let v=!d;p(v),v||r([]);},T=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(l.toLowerCase())||v.id.toLowerCase().includes(l.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:b,onClick:()=>i?c(false):w(),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:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),i&&jsx(Xt,{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:[x&&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:x})]}),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:N,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:l,onChange:v=>m(v.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:T.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"}):T.map(v=>{let E=t.includes(v.id);return jsxs("button",{onClick:()=>C(v.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.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:E?"#3b82f6":"transparent",borderColor:E?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:E&&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:v.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var mo=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:m,setNodeRef:d,transform:p,transition:g,isDragging:y}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:zs.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:d,style:x,...l,...m,onClick:()=>a?.(e),children:t(e)});let h=i.filter(C=>e.assignedUserIds?.includes(C.id)),f=e.progress===100,b=(e.attachments||[]).filter(C=>C.type.startsWith("image/")),w={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:w,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...m,onClick:C=>{C.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:C=>{C.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsx("img",{src:b[0].url,alt:b[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:C=>{C.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((C,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:C.url,alt:C.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}),N===3&&b.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:["+",b.length-4]})})]},C.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:C=>C.stopPropagation(),className:"priority-selector",children:jsx(jo,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsx(Yn,{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:(C,N)=>n?.(e.id,{startDate:C,endDate:N})})}),i.length>0&&jsx("div",{onClick:C=>C.stopPropagation(),className:"user-selector",children:jsx(Yo,{assignedUsers:h,availableUsers:i,onChange:C=>n?.(e.id,{assignedUserIds:C.map(N=>N.id)})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"dependencies-selector",children:jsx(Xn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(C=>typeof C=="string"?C:C.taskId):[],availableTasks:c,onChange:C=>n?.(e.id,{dependencies:C})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(C=>jsx("span",{className:"asakaa-label",children:C},C))}),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)));mo.displayName="Card";var _s={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Mu=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Fu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),m=[...Object.entries(_s).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(_s).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=_s[e];if(h)return {...h,id:e};let f=r.find(b=>b.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{..._s.todo,id:"todo"}},p=()=>{if(!l.current)return;let h=l.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,w=180,C=280,N=4,T=h.right-w;T<10&&(T=h.left),T+w>b-10&&(T=b-w-10);let k=f-h.bottom,v=h.top,E;k>=C+N?E=h.bottom+N:v>=C+N?E=h.top-C-N:E=k>=v?h.bottom+N:Math.max(10,h.top-C-N),i({top:E,left:T}),s(true);};useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,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:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsx(Mu,{icon:y.icon,color:x})}),o&&jsx(Xt,{children:jsxs("div",{ref:c,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:m.map(h=>jsxs("button",{onClick:()=>g(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(Mu,{icon:h.icon,color:h.color}),jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Pu={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 Au({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Pu[s]||Pu.en,[i,c]=useState(false),[l,m]=useState(false),[d,p]=useState(e),[g,y]=useState({top:0,left:0}),x=useRef(null),h=useRef(null),f=useRef(null);useEffect(()=>{if(i&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[i]),useEffect(()=>{let N=T=>{x.current&&!x.current.contains(T.target)&&!h.current?.contains(T.target)&&(c(false),m(false));};if(i)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),useEffect(()=>{let N=T=>{T.key==="Escape"&&(c(false),m(false),p(e));};if(i)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i,e]),useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let b=()=>{m(true),p(e);},w=()=>{let N=d.trim();N&&N!==e&&t(N),m(false),c(false),p(e);},C=N=>{N.key==="Enter"?w():N.key==="Escape"&&(m(false),p(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:h,onClick:()=>c(!i),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"})]})}),i&&jsx(Xt,{children:jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:d,onChange:N=>p(N.target.value),onKeyDown:C,onBlur:w,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:b,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(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:n.delete})]})]})]})})})]})}var vn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:m,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:f,renderMetrics:b,locale:w})=>{let{setNodeRef:C,isOver:N}=useDroppable({id:e.id,data:{type:"column",column:e}}),T=useRef(null),k=m??ru(t.length),v=useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>d,enabled:k});if(a)return jsx("div",{ref:C,className:f,children:a(e,t)});let I=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),D=I.state==="exceeded",X=()=>"asakaa-column-count";return jsxs("div",{ref:C,className:u("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",D&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u(X()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&I.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${I.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[I.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"})]}),I.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"})]}),I.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"})}),I.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"})]})]}),(y||x)&&jsx(Au,{columnTitle:e.title,onRename:O=>y?.(e.id,O),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:w}),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"})]})]}),b&&b(e,t),!p&&jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:k?"600px":void 0},children:jsx(SortableContext,{items:t.map(O=>O.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"})}):k?jsx("div",{style:{height:`${v.getTotalSize()}px`,position:"relative"},children:v.getVirtualItems().map(O=>{let H=t[O.index];return H?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsx(mo,{card:H,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l})},H.id):null})}):t.map(O=>jsx(mo,{card:O,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l},O.id))})})]})});vn.displayName="Column";function Dl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),i=useRef(null);useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let m=s.trim();m&&m!==e?t(m):n(e),o(false);},l=m=>{m.key==="Enter"?c():m.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:i,type:"text",value:s,onChange:m=>n(m.target.value),onBlur:c,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function hb(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 $u(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(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),m=c.split(/\s+/);return !!(l===s||c===s||m.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function yb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function xb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var vb=["\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 Hu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:m=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=i==="dark",[f,b]=useState(false),[w,C]=useState([]),[N,T]=useState(0),[k,v]=useState(null),[E,I]=useState(false),D=useRef(null),X$1=useRef(null),O=useRef(null),H=useRef(null),F=useCallback((z,re)=>{let J=hb(z,re);if(v(J),J){let Fe=r.filter(he=>he.name.toLowerCase().includes(J.query)||he.email&&he.email.toLowerCase().includes(J.query)).slice(0,5);C(Fe),b(Fe.length>0),T(0);}else b(false),C([]);},[r]),q=z=>{let re=z.target.value;if(t(re),F(re,z.target.selectionStart||0),D.current){D.current.style.height="24px";let J=D.current.scrollHeight,Fe=280,he=Math.min(J,Fe);D.current.style.height=`${he}px`,D.current.style.overflowY=J>Fe?"auto":"hidden";}},ee=()=>{D.current&&F(e,D.current.selectionStart||0);},Se=useCallback(z=>{if(!k||!D.current)return;let re=e.slice(0,k.start),J=e.slice(k.end),Fe=`@${z.name.replace(/\s+/g,"")} `,he=re+Fe+J;t(he),b(false),v(null),setTimeout(()=>{if(D.current){let Ue=k.start+Fe.length;D.current.selectionStart=Ue,D.current.selectionEnd=Ue,D.current.focus();}},0);},[k,e,t]),R=z=>{if(f&&w.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),T(re=>re<w.length-1?re+1:0);break;case "ArrowUp":z.preventDefault(),T(re=>re>0?re-1:w.length-1);break;case "Enter":{z.preventDefault();let re=w[N];re&&Se(re);break}case "Tab":{z.preventDefault();let re=w[N];re&&Se(re);break}case "Escape":z.preventDefault(),b(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};useEffect(()=>{let z=re=>{X$1.current&&!X$1.current.contains(re.target)&&D.current&&!D.current.contains(re.target)&&b(false),H.current&&!H.current.contains(re.target)&&I(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let j=useCallback(z=>{if(!D.current)return;let re=D.current.selectionStart||e.length,J=e.slice(0,re)+z+e.slice(re);t(J),I(false),setTimeout(()=>{if(D.current){let Fe=re+z.length;D.current.selectionStart=Fe,D.current.selectionEnd=Fe,D.current.focus();}},0);},[e,t]),be=useCallback(z=>{if(!g||!z.target.files)return;let re=Array.from(z.target.files),J=x*1024*1024,Fe=re.filter(he=>he.size>J?(console.warn(`File ${he.name} exceeds max size of ${x}MB`),false):true);Fe.length>0&&g(Fe),z.target.value="";},[g,x]),Xe=useCallback(z=>z.type.startsWith("image/")?Image:z.type.includes("pdf")||z.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&X$1.current){let z=X$1.current.children[N];z&&z.scrollIntoView({block:"nearest"});}},[N,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 re=Xe(z.file),J=z.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[J&&z.preview?jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(re,{className:u("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",h?"text-white":"text-gray-900"),children:z.file.name}),jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:xb(z.file.size)})]}),y&&jsx("button",{onClick:()=>y(z.id),className:u("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},z.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[m&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!E),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:vb.map(z=>jsx("button",{type:"button",onClick:()=>j(z),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:z},z))})})})]}),d&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:O,type:"file",multiple:true,onChange:be,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:D,value:e,onChange:q,onSelect:ee,onKeyDown:R,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"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:u("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"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&&w.length>0&&jsx(motion.div,{ref:X$1,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((z,re)=>jsxs("button",{type:"button",onClick:()=>Se(z),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",re===N?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:z.color||"#8B5CF6"},children:yb(z.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:z.name}),z.email&&jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.id))})})]})]})]})}function zu({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((i,c)=>i.type==="mention"?jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:i.value},c):jsx("span",{children:i.value},c))})}var Xs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Do({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[i,c]=useState(false),[l,m]=useState(""),[d,p]=useState(false),[g,y]=useState(Xs[10]||"#2E94FF"),[x,h]=useState({top:0,left:0}),f=useRef(null),b=useRef(null),w=useRef(null),C=useRef(null),N=t.filter(D=>D.name.toLowerCase().includes(l.toLowerCase())),T=t.some(D=>D.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(i&&b.current){let D=b.current.getBoundingClientRect();h({top:D.bottom+6,left:D.left});}},[i]),useEffect(()=>{let D=X=>{let O=X.target,H=f.current?.contains(O),F=w.current?.contains(O);!H&&!F&&(c(false),m(""),p(false));};if(i)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),useEffect(()=>{i&&C.current&&C.current.focus();},[i]);let k=D=>{let X=e.some(O=>O.id===D.id);a(X?e.filter(O=>O.id!==D.id):[...e,D]);},v=async()=>{if(!(!r||!l.trim())){p(true);try{let D=await r(l.trim(),g);D&&(a([...e,D]),m(""),y(Xs[Math.floor(Math.random()*Xs.length)]||"#2E94FF"));}finally{p(false);}}},E=(D,X)=>{X.stopPropagation(),a(e.filter(O=>O.id!==D));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:b,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,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(D=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${D.color}20`,color:D.color},children:D.name},D.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:i&&jsxs(motion.div,{ref:w,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:x.top,left:x.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:C,type:"text",value:l,onChange:D=>m(D.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:D=>{D.key==="Enter"&&l.trim()&&!T&&r&&v();}})}),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(D=>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:`${D.color}20`,color:D.color},onClick:X=>E(D.id,X),children:[D.name,jsx(X,{className:"w-3 h-3"})]},D.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(D=>{let X=e.some(O=>O.id===D.id);return jsxs("button",{type:"button",onClick:()=>k(D),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:X?`${D.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{X||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{X||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:D.color}}),jsx("span",{className:"flex-1 text-left",children:D.name}),X&&jsx(Check,{className:"w-4 h-4",style:{color:D.color}})]},D.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!T&&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:Xs.map(D=>jsx("button",{type:"button",onClick:()=>y(D),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:D,outline:g===D?`2px solid ${D}`:"none",outlineOffset:"2px"}},D))}),jsxs("button",{type:"button",onClick:v,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 "',l.trim(),'"']})]})]})}),document.body)]})}function El({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 Wu({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(El,{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 Xo=[{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 Gu(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 Mb(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 Fb({className:e}){return jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Ml({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Mb(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"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Gu(e.loggedMinutes),l=e.estimateMinutes?Gu(e.estimateMinutes):null,m=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(Fb,{className:i[t]}),jsx("span",{children:m})]})}function Pb(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 Qs(e){let t=Pb(e);return t!==null?String(t):e}function _u(e){let a=Qs(e).trim().toLowerCase();if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||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,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Zs(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 Ib(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 Bb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Rb({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 ju({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 Ob({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 Fl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:m,className:d}){let[p,g]=useState(""),[y,x]=useState(t.estimateMinutes?Zs(t.estimateMinutes):""),[h,f]=useState(""),[b,w]=useState(false),[C,N]=useState(false),T=useRef(null);useEffect(()=>{T.current?.focus();},[]);let k=async()=>{let I=_u(p);if(!(I<=0||!s)){w(true);try{await s({durationMinutes:I,note:h.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},v=async()=>{if(!n)return;let I=y.trim()?_u(y):null;await n(I),N(false);},E=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),k()),I.key==="Escape"&&m?.();};return jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",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:m,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(ju,{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:Ib(o)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Rb,{className:"w-4 h-4"})}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(ju,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:i,className:u("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Bb,{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(Ob,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:T,type:"text",value:p,onChange:I=>g(I.target.value),onKeyDown:E,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:k,disabled:b||!p.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:h,onChange:I=>f(I.target.value),onKeyDown:E,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Zs(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"}),C?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:y,onChange:I=>x(I.target.value),onKeyDown:I=>{I.key==="Enter"&&v(),I.key==="Escape"&&N(false);},onBlur:v,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:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Zs(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:u("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:u("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(I=>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:I.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Zs(I.durationMinutes)})]},I.id))})]})]})}function Wb(e){let a=Qs(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||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,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Gb(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 ao({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[i,c]=useState(Gb(r)),[l,m]=useState(""),[d,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let y=async()=>{p(true);let w=Wb(i);await o(w&&w>0?w:null,l||void 0),p(false);},x=async()=>{p(true),await o(null),p(false);},h=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),y()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},b=t==="es";return jsxs("div",{className:u("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.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:i,onChange:w=>c(w.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:l,onChange:w=>m(w.target.value),onKeyDown:h,placeholder:b?"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:y,disabled:d||!i.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?b?"Guardando...":"Saving...":b?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:x,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:b?"Quitar":"Clear"})]})]})}function Vb(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 _b(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 Al({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Vb(e.health),s=_b(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxs("div",{className:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),l&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function wn(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 Kb(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 Yb(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 qb(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 Xb({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",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",wn(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),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:i,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",c),children:wn(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",c),children:wn(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Jb({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",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",i),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?wn(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:wn(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[o,wn(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Yb(e.status,a),Kb(e.status,a)),children:qb(e.status,t)})})]})}function Ll({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",i=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",m=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((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",i,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",m),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("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(Xb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",c,l),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:p,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",l),children:g.map(y=>jsx(Jb,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsx("div",{className:u("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 kn(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function uh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.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 ap(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 ph(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function fo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:m=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:f=[],onUploadCommentAttachments:b,enableTimeTracking:w=false,timeTrackingSummary:C,timeEntries:N=[],isTimerRunning:T=false,timerElapsedSeconds:k=0,onTimeLog:v,onEstimateUpdate:E,onSoldEffortUpdate:I,onTimerStart:D,onTimerStop:X$1,onTimerDiscard:O,blurFinancials:H=false}){let F=s==="dark",q={textTertiary:F?"#6B7280":"#9CA3AF",textSecondary:F?"#9CA3AF":"#6B7280",textPrimary:F?"#FFFFFF":"#111827",borderLight:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:F?"#1A1D25":"#FFFFFF",bgSecondary:F?"#0A0A0A":"#F9FAFB",hoverBg:F?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ee=e&&"title"in e&&!("name"in e),Se=e,[R,j]=useState(e?ap(e,i):null),[be,Xe]=useState(false),[z,re]=useState(false),[J,Fe]=useState(false),[he,Ue]=useState(null),[Be,nt]=useState(new Date),[Z,st]=useState(false),[oe,rt]=useState(false),[ht,Ft]=useState(""),[ke,yt]=useState(false),[dt,at]=useState(false),[$,de]=useState(false),[S,Y]=useState(false),[le,we]=useState(""),W=useRef(null),te=useRef(null),[We,Ce]=useState(""),He=useRef(null),[Ne,_e]=useState(""),[kt,mt]=useState(false),[ot,et]=useState([]),[Yt,Pt]=useState(""),[vt,Nt]=useState(false),gt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let A=ap(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:A?.id,taskName:A?.name,soldEffortMinutes:A?.soldEffortMinutes,quotedMinutes:A?.quotedMinutes,effortMinutes:A?.effortMinutes,timeLoggedMinutes:A?.timeLoggedMinutes}),j(A),we(A.description||""),Ce(A.name||"");}},[e?.id,e?.quotedMinutes,i,t]),useEffect(()=>{if(!t||!le)return;let A=setTimeout(()=>{let ge=te.current;ge&&(ge.style.height="auto",ge.style.height=`${Math.max(100,ge.scrollHeight)}px`);},50);return ()=>clearTimeout(A)},[t,le]),useEffect(()=>()=>{W.current&&clearTimeout(W.current),He.current&&clearTimeout(He.current);},[]),useEffect(()=>{t&>.current&&y.length>0&&setTimeout(()=>{gt.current&&(gt.current.scrollTop=gt.current.scrollHeight);},100);},[t,y.length]);let Wt=useCallback(A=>{j(A),ee&&o&&Se?o(ph(A,Se)):r&&r(A);},[ee,Se,o,r]),Re=useCallback(()=>{Xe(false),re(false),Fe(false),Ue(null),rt(false),Ft(""),yt(false);},[]),Ae=useCallback((A,ge)=>{if(!R)return;let Ve={...R,[A]:ge};Wt(Ve);},[R,Wt]),ct=useCallback(()=>{let A=te.current;A&&(A.style.height="auto",A.style.height=`${Math.max(100,A.scrollHeight)}px`);},[]),se=useCallback(A=>{we(A),setTimeout(ct,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(R){let ge={...R,description:A};Wt(ge);}},800);},[R,Wt,ct]),fe=useCallback(A=>{Ce(A),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(R&&A.trim()){let ge={...R,name:A.trim()};Wt(ge);}},800);},[R,Wt]),L=useCallback(A=>{let ge=A.map(Ve=>{let tt={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Ve};return Ve.type.startsWith("image/")&&(tt.preview=URL.createObjectURL(Ve)),tt});et(Ve=>[...Ve,...ge]);},[]),_=useCallback(A=>{et(ge=>{let Ve=ge.find(tt=>tt.id===A);return Ve?.preview&&URL.revokeObjectURL(Ve.preview),ge.filter(tt=>tt.id!==A)});},[]),K=useCallback(async()=>{if(!(!R||!Ne.trim()&&ot.length===0||!x)){mt(true);try{let A=$u(Ne,f),ge=[];if(ot.length>0&&b){let Ve=ot.map(tt=>tt.file);ge=await b(Ve);}await x(R.id,Ne.trim(),A.length>0?A:void 0,ge.length>0?ge:void 0),_e(""),ot.forEach(Ve=>{Ve.preview&&URL.revokeObjectURL(Ve.preview);}),et([]);}finally{mt(false);}}},[R,Ne,ot,x,f,b]),ue=useCallback(()=>{if(!R||!Yt.trim())return;let A=R.subtasks||[],ge={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Yt.trim(),progress:0,startDate:new Date,endDate:new Date,position:A.length},Ve=[...A,ge],tt={...R,subtasks:Ve};Wt(tt),Pt(""),Nt(false);},[R,Yt,Wt]),Me=useCallback(A=>{if(!R?.subtasks)return;let ge=R.subtasks.map(tt=>tt.id===A?{...tt,progress:tt.progress===100?0:100}:tt),Ve={...R,subtasks:ge};Wt(Ve);},[R,Wt]),Ke=useCallback(A=>{if(!R?.subtasks)return;let ge=R.subtasks.filter(tt=>tt.id!==A),Ve={...R,subtasks:ge};Wt(Ve);},[R,Wt]),je=useCallback(A=>{let ge=typeof A=="string"?new Date(A):A,tt=new Date().getTime()-ge.getTime(),oa=Math.floor(tt/6e4),Gt=Math.floor(tt/36e5),Ta=Math.floor(tt/864e5);return oa<1?n==="es"?"Ahora":"Just now":oa<60?n==="es"?`Hace ${oa} min`:`${oa}m ago`:Gt<24?n==="es"?`Hace ${Gt}h`:`${Gt}h ago`:Ta<7?n==="es"?`Hace ${Ta}d`:`${Ta}d ago`:ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Le=useCallback(A=>{if(!R)return;let ge=R.progress||0;A==="completed"?ge=100:A==="in-progress"&&ge===0?ge=10:A==="todo"&&(ge=0);let Ve={...R,status:A,progress:ge};Wt(Ve),Xe(false);},[R,Wt]),ft=useCallback((A,ge)=>{if(!R)return;let Ve={...R,startDate:A,endDate:ge};Wt(Ve);},[R,Wt]),Ct=useCallback(()=>{let A=Be.getFullYear(),ge=Be.getMonth(),Ve=new Date(A,ge,1),oa=new Date(A,ge+1,0).getDate(),Gt=Ve.getDay(),Ta=[],Ea=new Date(A,ge,0).getDate();for(let ba=Gt-1;ba>=0;ba--)Ta.push({date:new Date(A,ge-1,Ea-ba),isCurrentMonth:false});for(let ba=1;ba<=oa;ba++)Ta.push({date:new Date(A,ge,ba),isCurrentMonth:true});let Ga=42-Ta.length;for(let ba=1;ba<=Ga;ba++)Ta.push({date:new Date(A,ge+1,ba),isCurrentMonth:false});return Ta},[Be]),zt=useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),de(false),!R||!d)return;let ge=Array.from(A.dataTransfer.files);if(ge.length!==0){Y(true);try{await d(R.id,ge);}finally{Y(false);}}},[R,d]),Ca=useCallback(async A=>{if(!R||!d||!A.target.files)return;let ge=Array.from(A.target.files);if(ge.length!==0){Y(true);try{await d(R.id,ge);}finally{Y(false);}A.target.value="";}},[R,d]),ta=useCallback(A=>{A.preventDefault(),A.stopPropagation(),de(true);},[]),U=useCallback(A=>{A.preventDefault(),A.stopPropagation(),de(false);},[]),ne=useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),Oe=useCallback(A=>A.startsWith("image/")?Image:A.includes("pdf")||A.includes("document")?FileText:File,[]);return !t||!R?null:jsx(AnimatePresence,{children:t&&R&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",F?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",F?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",F?"text-[#6B7280]":"text-gray-400"),children:R.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let A=R.progress===100?0:100,Ve={...R,progress:A,status:A===100?"completed":"todo"};Wt(Ve);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",R.progress===100?"bg-green-500 border-green-500":F?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:We,onChange:A=>fe(A.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",R.progress===100?"line-through text-[#6B7280]":F?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Re(),Xe(!be);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",R.progress===100||R.status==="completed"?"bg-green-500/20 text-green-400":R.progress&&R.progress>0||R.status==="in-progress"?"bg-blue-500/20 text-blue-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?n==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Xe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(A=>jsxs("button",{onClick:()=>Le(A.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",R.status===A.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:A.label})]},A.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Re(),Fe(!J);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((A,ge)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},title:A.name,children:A.initials||A.name.slice(0,2).toUpperCase()},ge)),R.assignees.length>3&&jsxs("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:J&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(A=>{let ge=R.assignees?.some(Ve=>Ve.name===A.name);return jsxs("button",{onClick:()=>{let Ve=R.assignees||[],tt;ge?tt=Ve.filter(oa=>oa.name!==A.name):tt=[...Ve,A],Ae("assignees",tt);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",ge&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:A.color||"#8B5CF6"},children:A.initials||A.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",F?"text-white":"text-gray-900"),children:A.name}),ge&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},A.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Ue(he?null:"start"),nt(R.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",F?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ue(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let A=new Date,ge=new Date(A);ge.setDate(A.getDate()+1);let Ve=new Date(A);Ve.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let tt=new Date(A);tt.setDate(A.getDate()+((1-A.getDay()+7)%7||7));let oa=new Date(A);oa.setDate(A.getDate()+(6-A.getDay()+7)%7+7);let Gt=new Date(A);Gt.setDate(A.getDate()+14);let Ta=new Date(A);return Ta.setDate(A.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date: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:Ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:tt,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:oa,display:oa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Gt,display:Gt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ta,display:Ta.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ga,ba)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(he==="start"){let or=R.endDate&&Ga.date>R.endDate?Ga.date:R.endDate;ft(Ga.date,or),Ue("end");}else {let or=R.startDate&&Ga.date<R.startDate?Ga.date:R.startDate;ft(or,Ga.date),Ue(null);}},children:[jsx("span",{children:Ga.label}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Ga.display})]},ba))})(),jsx("div",{className:u("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{ft(void 0,void 0),Ue(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:he==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",F?"text-white":"text-gray-900"),children:Be.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>nt(new Date),className:u("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>nt(new Date(Be.getFullYear(),Be.getMonth()-1)),className:u("p-1 rounded",F?"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:()=>nt(new Date(Be.getFullYear(),Be.getMonth()+1)),className:u("p-1 rounded",F?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(A=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:A},A))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ct().map((A,ge)=>{let Ve=A.date.toDateString()===new Date().toDateString(),tt=R.startDate?.toDateString()===A.date.toDateString(),oa=R.endDate?.toDateString()===A.date.toDateString(),Gt=tt||oa,Ta=R.startDate&&R.endDate&&A.date>=R.startDate&&A.date<=R.endDate;return jsx("button",{onClick:()=>{let Ea=new Date(A.date);if(he==="start"){let Ga=R.endDate&&Ea>R.endDate?Ea:R.endDate;ft(Ea,Ga),Ue("end");}else {let Ga=R.startDate&&Ea<R.startDate?Ea:R.startDate;ft(Ga,Ea),Ue(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!A.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),A.isCurrentMonth&&(F?"text-white":"text-gray-900"),Ve&&"ring-2 ring-[#2E94FF]",tt&&"bg-[#2E94FF] text-white",oa&&!tt&&"bg-[#7C3AED] text-white",Ta&&!Gt&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!Gt&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:A.date.getDate()},ge)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Re(),re(!z);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",R.priority==="high"||R.priority==="urgent"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":R.priority==="low"?"bg-green-500/20 text-green-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?n==="es"?"Alta":"High":R.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:()=>re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(A=>jsxs("button",{onClick:()=>{Ae("priority",A.id),re(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",R.priority===A.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:A.label})]},A.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",F?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"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:R.progress||0,onChange:A=>{let ge=parseInt(A.target.value),Ve=R.status;ge===100?Ve="completed":ge>0?Ve="in-progress":Ve="todo";let tt={...R,progress:ge,status:Ve};Wt(tt);},onBlur:()=>st(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",F?"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:()=>st(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",F?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${R.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),w&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:R.status==="completed"||R.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?kn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsx("button",{type:"button",onClick:()=>at("estimate"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:kn(C.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>at("estimate"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:dt==="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(ao,{mode:"estimate",locale:n,isDark:F,currentValue:C?.estimateMinutes||null,onSave:async A=>{await E?.(R.id,A),at(false);},onClose:()=>at(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:H?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",F?"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"}):R.status==="completed"||R.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?kn(R.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>at("quoted"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:kn(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>at("quoted"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:dt==="quoted"&&!H&&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(ao,{mode:"quoted",locale:n,isDark:F,currentValue:R.quotedMinutes||null,onSave:async A=>{I?(await I(R.id,A),j(ge=>ge?{...ge,quotedMinutes:A}:null)):Ae("quotedMinutes",A),at(false);},onClose:()=>at(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",F?"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"})}):T?jsxs("button",{type:"button",onClick:()=>X$1?.(R.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),uh(k||0)]}):jsx("button",{type:"button",onClick:()=>D?.(R.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",F?"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"})}),R.status==="completed"||R.progress===100?jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",F?"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:()=>at("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",F?"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"]}),C&&C.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",C.health==="over-budget"?"text-red-500":C.health==="at-risk"?"text-yellow-500":F?"text-white":"text-gray-900"),children:[kn(C.loggedMinutes),C.estimateMinutes&&jsxs("span",{className:u("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",kn(C.estimateMinutes)]})]}),C.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:u("h-full rounded-full transition-all",C.health==="over-budget"?"bg-red-500":C.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,C.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:dt==="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(ao,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(A,ge)=>{A&&await v?.(R.id,{durationMinutes:A,note:ge,source:"manual"}),at(false);},onClose:()=>at(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(Do,{selectedTags:R.tags||[],availableTags:c,onChange:A=>{Ae("tags",A);},onCreateTag:l,theme:q})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(A=>{let ge=g.find(Ve=>Ve.id===A);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ge?.name||A.slice(0,8),jsx("button",{onClick:()=>{let Ve=(R.dependencies||[]).filter(tt=>tt!==A);Ae("dependencies",Ve);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{onClick:()=>{Re(),rt(!oe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:oe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{rt(false),Ft("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ht,onChange:A=>Ft(A.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",F?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(A=>A.id!==R.id).filter(A=>ht===""||A.name.toLowerCase().includes(ht.toLowerCase())).map(A=>{let ge=R.dependencies?.includes(A.id);return jsxs("button",{onClick:()=>{let Ve=R.dependencies||[],tt;ge?tt=Ve.filter(oa=>oa!==A.id):tt=[...Ve,A.id],Ae("dependencies",tt);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",ge&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ge?"bg-blue-500 border-blue-500":F?"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:u("block truncate",F?"text-white":"text-gray-900"),children:A.name}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:A.id.slice(0,8)})]})]},A.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Re(),yt(!ke);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"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:R.color||"#6366F1"}}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:Xo.find(A=>A.value===R.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ke&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>yt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Xo.map(A=>{let ge=R.color===A.value;return jsx("button",{onClick:()=>{Ae("color",A.value),yt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",ge&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:A.value,outlineColor:ge?A.value:void 0},title:A.name,children:ge&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},A.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"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:R.isMilestone||false,onChange:A=>Ae("isMilestone",A.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.isMilestone?"bg-purple-500 border-purple-500":F?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:te,value:le,onChange:A=>se(A.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",F?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(A=>A.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((A,ge)=>(A.position??0)-(ge.position??0)).map(A=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",F?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Me(A.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",A.progress===100?"bg-green-500 border-green-500":F?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:A.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",A.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:A.name}),jsx("button",{onClick:()=>Ke(A.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",F?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},A.id))}),vt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Yt,onChange:A=>Pt(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Yt.trim()?ue():A.key==="Escape"&&(Nt(false),Pt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",F?"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:ue,disabled:!Yt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Yt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":F?"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:()=>{Nt(false),Pt("");},className:u("p-2 rounded-lg transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Nt(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",F?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",m.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",m.length,")"]})]}),m.length>0&&jsx("div",{className:"space-y-2 mb-4",children:m.map(A=>{let ge=Oe(A.type),Ve=A.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Ve&&A.thumbnailUrl?jsx("img",{src:A.thumbnailUrl,alt:A.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsx(ge,{className:u("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:A.name}),jsx("p",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:ne(A.size)})]}),p&&jsx("button",{onClick:()=>p(A.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",F?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},A.id)})}),jsxs("div",{onDragOver:ta,onDragLeave:U,onDrop:zt,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",$?F?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":F?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",S&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Ca,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||S}),S?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",$?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",F?"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:u("text-xs mt-1",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",F?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -15,8 +15,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
16
|
background: ${F?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:gt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsx("div",{className:"space-y-4",children:[...y].sort((A,ge)=>{let Ve=typeof A.createdAt=="string"?new Date(A.createdAt):A.createdAt,tt=typeof ge.createdAt=="string"?new Date(ge.createdAt):ge.createdAt;return Ve.getTime()-tt.getTime()}).map(A=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:A.user?.color||"#8B5CF6"},children:A.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",F?"text-white":"text-gray-900"),children:A.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:je(A.createdAt)})]}),jsx("div",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsx(zu,{content:A.content,theme:s})}),A.attachments&&A.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:A.attachments.map(ge=>{let Ve=ge.type.startsWith("image/");return jsxs("a",{href:ge.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Ve?jsx(Image,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:ge.name})]},ge.id)})})]})]},A.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",F?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",F?"border-white/10":"border-gray-200"),children:jsx(Hu,{value:Ne,onChange:_e,onSubmit:K,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:wt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:ot,onFilesSelect:L,onRemoveFile:_})})]})]})]})})}function Il(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Eo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:m,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:v,onTaskOpen:C,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:w,timerState:E,onLogTime:I,onUpdateEstimate:D,onUpdateSoldEffort:X,onStartTimer:O,onStopTimer:H,onDiscardTimer:F,blurFinancials:q=false,sidePanel:ee,renderColumnMetrics:Se,suppressDetailModal:R=false}){let[j,be]=Il(),[Je,z]=useState(null),[re,J]=useState(false),Fe=useRef(null),he=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ue=o?.theme||"dark",Be=Ue==="dark"||Ue==="neutral",nt=Be?"dark":"",Z=useCallback((S,Y)=>{t.onCardUpdate?.(S,Y);},[t]),st=useCallback((S,Y)=>{t.onColumnUpdate?.(S,{title:Y});},[t]),oe=useCallback(S=>{t.onColumnDelete?.(S);},[t]),rt=["todo","in-progress","completed"],ht=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Mt=useMemo(()=>{let S=new Map;return e.columns.forEach(Y=>{let le=Y.cardIds.map(we=>e.cards.find(W=>W.id===we)).filter(we=>we!==void 0).sort((we,W)=>we.position-W.position);S.set(Y.id,le);}),S},[e.cards,e.columns]);useEffect(()=>{let S=Fe.current;if(!S)return;let Y=te=>{let We=te.target,Ce=te.button===1,He=We===S||We.classList.contains("asakaa-column")&&!We.closest(".asakaa-card");(Ce||te.button===0&&He&&!j.isDragging)&&(te.preventDefault(),J(true),he.current={x:te.clientX,y:te.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},S.style.cursor="grabbing",S.style.userSelect="none");},le=te=>{if(!re)return;let We=te.clientX-he.current.x,Ce=te.clientY-he.current.y;S.scrollLeft=he.current.scrollLeft-We,S.scrollTop=he.current.scrollTop-Ce;},we=()=>{re&&(J(false),S.style.cursor="",S.style.userSelect="");},W=()=>{re&&(J(false),S.style.cursor="",S.style.userSelect="");};return S.addEventListener("mousedown",Y),document.addEventListener("mousemove",le),document.addEventListener("mouseup",we),S.addEventListener("mouseleave",W),()=>{S.removeEventListener("mousedown",Y),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",we),S.removeEventListener("mouseleave",W);}},[re,j.isDragging]);let ke=useMemo(()=>e.cards.map(S=>({id:S.id,name:S.title,startDate:S.startDate?new Date(S.startDate):void 0,endDate:S.endDate?new Date(S.endDate):void 0,progress:S.progress||0,status:S.columnId,priority:S.priority?.toLowerCase(),dependencies:Array.isArray(S.dependencies)?S.dependencies.map(Y=>typeof Y=="string"?Y:Y.taskId):[]})),[e.cards]),yt=useCallback(S=>{let{active:Y}=S,le=e.cards.find(we=>we.id===Y.id);le&&be({isDragging:true,draggedCardId:le.id,sourceColumnId:le.columnId,targetColumnId:le.columnId});},[e.cards,be]),dt=useCallback(S=>{let{active:Y,over:le}=S;if(!le||!e.cards.find(te=>te.id===Y.id))return;let W=null;le.data.current?.type==="column"?W=le.id:le.data.current?.type==="card"&&(W=e.cards.find(We=>We.id===le.id)?.columnId||null),W&&W!==j.targetColumnId&&be({...j,targetColumnId:W});},[e.cards,j,be]),at=useCallback(async S=>{let{active:Y,over:le}=S;if(be({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!le)return;let we=e.cards.find(Ce=>Ce.id===Y.id);if(!we)return;let W,te;if(le.data.current?.type==="column"){W=le.id;let Ce=Mt.get(W)||[];te=bl(Ce,0);}else {let Ce=e.cards.find(_e=>_e.id===le.id);if(!Ce)return;W=Ce.columnId;let He=Mt.get(W)||[],Ne=He.findIndex(_e=>_e.id===le.id);te=bl(He,Ne);}let We=e.columns.find(Ce=>Ce.id===W);if(We&&We.wipLimit&&We.wipLimitType==="hard"){let Ce=Mt.get(W)||[];if(we.columnId!==W&&Ce.length>=We.wipLimit){t.onWipLimitExceeded?.(We,we);return}}(we.columnId!==W||we.position!==te)&&await t.onCardMove?.(we.id,W,te);},[e.cards,e.columns,Mt,t,be]),$=useCallback(S=>{R||z(S),a?.(S),C?.(S.id);},[a,C,R]),de=useCallback(S=>{t.onCardUpdate?.(S.id,S),z(S);},[t]);return c?jsx("div",{className:u("asakaa-board",nt,n),style:i,children:jsx(Th,{columnCount:3})}):l?jsx("div",{className:u("asakaa-board",nt,n),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(gu,{themeName:Ue,children:[jsxs("div",{className:u("flex h-full overflow-hidden",ee?"flex-row":""),children:[jsxs(DndContext,{sensors:ht,collisionDetection:closestCorners,onDragStart:yt,onDragOver:dt,onDragEnd:at,children:[jsxs("div",{ref:Fe,className:u("asakaa-board",ee?"flex-1":"",nt,n),style:{...i,cursor:re?"grabbing":void 0},"data-theme":Ue,children:[e.columns.sort((S,Y)=>S.position-Y.position).map(S=>{let Y=Mt.get(S.id)||[],le=!rt.includes(S.id),we=r?.renderColumnFooter?.(S);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(yn,{column:S,cards:Y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Se?(W,te)=>Se(W,te):void 0,onCardClick:$,onCardUpdate:Z,onColumnRename:t.onColumnUpdate?st:void 0,onColumnDelete:t.onColumnDelete?oe:void 0,isDeletable:le,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),we]},S.id)}),m]}),jsx(DragOverlay,{children:j.draggedCardId?jsx(po,{card:e.cards.find(S=>S.id===j.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ee]}),!R&&jsx(go,{task:Je,isOpen:!!Je,onClose:()=>z(null),onCardUpdate:de,theme:Be?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:Je?g?.get(Je.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:ke,comments:h,onAddComment:f,currentUser:b,mentionableUsers:v,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:w,isTimerRunning:E?.isRunning,timerElapsedSeconds:E?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:D,onSoldEffortUpdate:X,onTimerStart:O,onTimerStop:H,onTimerDiscard:F,blurFinancials:q})]})}function Th({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 Mh={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)"},Fh={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)"},Ph={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ah={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Lh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let l=m=>{i.current&&!i.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),n(false);};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,m)=>l.position-m.position).map((l,m)=>jsxs(motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Ih({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,y)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Bh({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 Rl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:m,toolbarEndContent:d}){let p=r==="dark"?Mh:Fh,g={...o==="es"?Ph:Ah,...l},y=n||i||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[m&&jsxs(Fragment,{children:[m,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),y&&jsxs(Fragment,{children:[jsx(Ih,{theme:p,t:g,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),d,t&&(s?jsx(Lh,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsx(Bh,{onClick:()=>t(),label:a||g.newTask}))]})})}function $l({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let p=i.trim();p&&(e(p),c(""),n(false));},[i,e]),m=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),l()):p.key==="Escape"&&(c(""),n(false));},[l]),d=useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function qo({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=useState(""),[m,d]=useState(void 0),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(false),[b,v]=useState(false),[C,N]=useState(false),[T,k]=useState(s||new Date),w=useRef(null),E=o==="es",I=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{w.current?.focus();},[]);let D=useCallback(()=>{f(false),v(false),N(false);},[]),X=useCallback(()=>{l(""),d(void 0),g(null),x(null),D(),t();},[t,D]),O=useCallback(()=>{let q=c.trim();if(!q)return;let ee=a.find(R=>R.id===p),Se=y||s;e({name:q,priority:m,assignee:ee||void 0,assigneeId:p,startDate:Se,endDate:Se}),l(""),d(void 0),g(null),x(null),D(),w.current?.focus();},[c,m,p,y,s,a,e,D]),H=useCallback(q=>{q.key==="Enter"&&c.trim()&&(q.preventDefault(),O()),q.key==="Escape"&&X();},[O,X,c]),F=y||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>D(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:w,type:"text",value:c,onChange:q=>l(q.target.value),placeholder:E?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:H})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),f(!h),v(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",m?m==="urgent"||m==="high"?"text-red-400 bg-red-500/20":m==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:E?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:E?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:E?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:E?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:E?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxs("button",{onClick:()=>{d(q.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",q.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:q=>{q.stopPropagation(),N(!C),f(false),v(false),k(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),F.toLocaleDateString(E?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:C&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,ee=new Date(q);ee.setDate(q.getDate()+1);let Se=new Date(q);Se.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let R=new Date(q);R.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let j=new Date(q);j.setDate(q.getDate()+14);let be=new Date(q);be.setDate(q.getDate()+28);let Je=E?"es-ES":"en-US";return [{label:E?"Hoy":"Today",date:q,display:q.toLocaleDateString(Je,{weekday:"short"}).slice(0,3)+"."},{label:E?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(Je,{weekday:"short"}).slice(0,3)+"."},{label:E?"Este fin de semana":"This weekend",date:Se,display:E?"s\xE1b.":"sat."},{label:E?"Pr\xF3xima semana":"Next week",date:R,display:E?"lun.":"mon."},{label:E?"2 semanas":"2 weeks",date:j,display:j.toLocaleDateString(Je,{day:"numeric",month:"short"})},{label:E?"4 semanas":"4 weeks",date:be,display:be.toLocaleDateString(Je,{day:"numeric",month:"short"})}].map((re,J)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(re.date),N(false);},children:[jsx("span",{children:re.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:re.display})]},J))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:T.toLocaleDateString(E?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>k(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:E?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>k(new Date(T.getFullYear(),T.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>k(new Date(T.getFullYear(),T.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(E?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:q},q))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=T.getFullYear(),ee=T.getMonth(),Se=new Date(q,ee,1).getDay(),R=new Date(q,ee+1,0).getDate(),j=new Date(q,ee,0).getDate(),be=new Date().toDateString(),Je=[];for(let re=Se-1;re>=0;re--)Je.push({dayNum:j-re,isCurrent:false,date:new Date(q,ee-1,j-re)});for(let re=1;re<=R;re++)Je.push({dayNum:re,isCurrent:true,date:new Date(q,ee,re)});let z=42-Je.length;for(let re=1;re<=z;re++)Je.push({dayNum:re,isCurrent:false,date:new Date(q,ee+1,re)});return Je.map((re,J)=>{let Fe=re.date.toDateString()===be,he=(y||s)?.toDateString()===re.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!re.isCurrent&&(r?"text-white/20":"text-gray-300"),re.isCurrent&&(r?"text-white":"text-gray-900"),Fe&&"ring-1 ring-[#007FFF]",he&&"bg-[#007FFF] text-white",!he&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(re.date),N(false);},children:re.dayNum},J)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),v(!b),f(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(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:b&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",I,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),v(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:E?"Sin asignar":"Unassigned"})]}),a.map(q=>jsxs("button",{type:"button",onClick:()=>{g(q.id),v(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:q.color||"#007FFF"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.name})]},q.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:E?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:E?"Guardar":"Save"})]})]})}function Gl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=useState(false),m=useRef(null),d=useRef(null),[p,g]=useState({}),[y,x]=useState(false),h=n==="dark",b={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!m.current)return;let C=90,N=()=>{let T=m.current.getBoundingClientRect(),w=window.innerHeight-T.bottom<C+8;x(w),g({position:"fixed",...w?{bottom:window.innerHeight-T.top+4}:{top:T.bottom+4},left:T.left,width:T.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[c]),useEffect(()=>{if(!c)return;let C=N=>{let T=N.target;d.current&&!d.current.contains(T)&&m.current&&!m.current.contains(T)&&l(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]);let v=useCallback(C=>{t({name:C.name,columnId:e,assigneeIds:C.assigneeId?[C.assigneeId]:void 0,startDate:C.startDate,endDate:C.endDate,priority:C.priority});},[t,e]);return jsxs("div",{ref:m,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:p,className:u("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(qo,{onSubmit:v,onCancel:()=>l(false),availableUsers:a,isDark:h,locale:i,dropdownDirection:"up"})})}),document.body)]})}var rs=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(Eo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function yp(e={}){return new rs(e)}var wn=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 Vl(e,t){let a=r=>jsx(wn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function jl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:m=""}){let[d,p]=useState(false),[g,y]=useState(""),[x,h]=useState("home"),[f,b]=useState(""),[v,C]=useState("");useEffect(()=>{let w=E=>{(E.metaKey||E.ctrlKey)&&E.key===l&&(E.preventDefault(),p(I=>!I)),E.key==="Escape"&&(p(false),h("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]),useEffect(()=>{d||(h("home"),y(""),b(""),C(""));},[d]);let N=useCallback(()=>{p(false);},[]),T=useCallback(w=>{let[E,I]=w.split(":");switch(E){case "create-card":h("create-card");break;case "create-card-in":b(I||"");break;case "navigate":I?(a?.(I),N()):h("navigate");break;case "search":r?.(g),N();break;case "priority":h("priority");break;case "set-priority":v&&I&&(o?.(v,I),N());break;case "assign":h("assign");break;case "assign-user":v&&I&&(s?.(v,I),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":i?.(),N();break;case "ai-usage":c?.(),N();break;case "back":h("home");break;}},[g,v,t,a,r,o,s,n,i,c,N]),k=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),N());},[f,g,t,N]);return d?jsx(Xt,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${m}`,onClick:w=>w.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:x==="create-card"&&f?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&x==="create-card"&&f&&k();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:T,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:T,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:T,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(w=>jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:T,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(E=>jsx("span",{className:"command-palette-item-label",children:E},E))})]},w.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(w=>jsxs(Command.Item,{value:`create-card-in:${w.id}`,onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:w.title}),jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(w=>{let E=e.columns.find(I=>I.id===w.columnId);return jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:T,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:w.title}),jsx("div",{className:"command-palette-item-meta",children:E?.title})]}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},w.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function wp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
18
|
+
`}),jsx("div",{ref:gt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsx("div",{className:"space-y-4",children:[...y].sort((A,ge)=>{let Ve=typeof A.createdAt=="string"?new Date(A.createdAt):A.createdAt,tt=typeof ge.createdAt=="string"?new Date(ge.createdAt):ge.createdAt;return Ve.getTime()-tt.getTime()}).map(A=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:A.user?.color||"#8B5CF6"},children:A.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",F?"text-white":"text-gray-900"),children:A.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:je(A.createdAt)})]}),jsx("div",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsx(zu,{content:A.content,theme:s})}),A.attachments&&A.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:A.attachments.map(ge=>{let Ve=ge.type.startsWith("image/");return jsxs("a",{href:ge.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Ve?jsx(Image,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:ge.name})]},ge.id)})})]})]},A.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",F?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",F?"border-white/10":"border-gray-200"),children:jsx(Hu,{value:Ne,onChange:_e,onSubmit:K,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:kt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:ot,onFilesSelect:L,onRemoveFile:_})})]})]})]})})}function Bl(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Mo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:m,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onTaskOpen:C,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:v,timerState:E,onLogTime:I,onUpdateEstimate:D,onUpdateSoldEffort:X,onStartTimer:O,onStopTimer:H,onDiscardTimer:F,blurFinancials:q=false,sidePanel:ee,renderColumnMetrics:Se,suppressDetailModal:R=false}){let[j,be]=Bl(),[Xe,z]=useState(null),[re,J]=useState(false),Fe=useRef(null),he=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ue=o?.theme||"dark",Be=Ue==="dark"||Ue==="neutral",nt=Be?"dark":"",Z=useCallback((S,Y)=>{t.onCardUpdate?.(S,Y);},[t]),st=useCallback((S,Y)=>{t.onColumnUpdate?.(S,{title:Y});},[t]),oe=useCallback(S=>{t.onColumnDelete?.(S);},[t]),rt=["todo","in-progress","completed"],ht=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Ft=useMemo(()=>{let S=new Map;return e.columns.forEach(Y=>{let le=Y.cardIds.map(we=>e.cards.find(W=>W.id===we)).filter(we=>we!==void 0).sort((we,W)=>we.position-W.position);S.set(Y.id,le);}),S},[e.cards,e.columns]);useEffect(()=>{let S=Fe.current;if(!S)return;let Y=te=>{let We=te.target,Ce=te.button===1,He=We===S||We.classList.contains("asakaa-column")&&!We.closest(".asakaa-card");(Ce||te.button===0&&He&&!j.isDragging)&&(te.preventDefault(),J(true),he.current={x:te.clientX,y:te.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},S.style.cursor="grabbing",S.style.userSelect="none");},le=te=>{if(!re)return;let We=te.clientX-he.current.x,Ce=te.clientY-he.current.y;S.scrollLeft=he.current.scrollLeft-We,S.scrollTop=he.current.scrollTop-Ce;},we=()=>{re&&(J(false),S.style.cursor="",S.style.userSelect="");},W=()=>{re&&(J(false),S.style.cursor="",S.style.userSelect="");};return S.addEventListener("mousedown",Y),document.addEventListener("mousemove",le),document.addEventListener("mouseup",we),S.addEventListener("mouseleave",W),()=>{S.removeEventListener("mousedown",Y),document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",we),S.removeEventListener("mouseleave",W);}},[re,j.isDragging]);let ke=useMemo(()=>e.cards.map(S=>({id:S.id,name:S.title,startDate:S.startDate?new Date(S.startDate):void 0,endDate:S.endDate?new Date(S.endDate):void 0,progress:S.progress||0,status:S.columnId,priority:S.priority?.toLowerCase(),dependencies:Array.isArray(S.dependencies)?S.dependencies.map(Y=>typeof Y=="string"?Y:Y.taskId):[]})),[e.cards]),yt=useCallback(S=>{let{active:Y}=S,le=e.cards.find(we=>we.id===Y.id);le&&be({isDragging:true,draggedCardId:le.id,sourceColumnId:le.columnId,targetColumnId:le.columnId});},[e.cards,be]),dt=useCallback(S=>{let{active:Y,over:le}=S;if(!le||!e.cards.find(te=>te.id===Y.id))return;let W=null;le.data.current?.type==="column"?W=le.id:le.data.current?.type==="card"&&(W=e.cards.find(We=>We.id===le.id)?.columnId||null),W&&W!==j.targetColumnId&&be({...j,targetColumnId:W});},[e.cards,j,be]),at=useCallback(async S=>{let{active:Y,over:le}=S;if(be({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!le)return;let we=e.cards.find(Ce=>Ce.id===Y.id);if(!we)return;let W,te;if(le.data.current?.type==="column"){W=le.id;let Ce=Ft.get(W)||[];te=hl(Ce,0);}else {let Ce=e.cards.find(_e=>_e.id===le.id);if(!Ce)return;W=Ce.columnId;let He=Ft.get(W)||[],Ne=He.findIndex(_e=>_e.id===le.id);te=hl(He,Ne);}let We=e.columns.find(Ce=>Ce.id===W);if(We&&We.wipLimit&&We.wipLimitType==="hard"){let Ce=Ft.get(W)||[];if(we.columnId!==W&&Ce.length>=We.wipLimit){t.onWipLimitExceeded?.(We,we);return}}(we.columnId!==W||we.position!==te)&&await t.onCardMove?.(we.id,W,te);},[e.cards,e.columns,Ft,t,be]),$=useCallback(S=>{R||z(S),a?.(S),C?.(S.id);},[a,C,R]),de=useCallback(S=>{t.onCardUpdate?.(S.id,S),z(S);},[t]);return c?jsx("div",{className:u("asakaa-board",nt,n),style:i,children:jsx(Th,{columnCount:3})}):l?jsx("div",{className:u("asakaa-board",nt,n),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(gu,{themeName:Ue,children:[jsxs("div",{className:u("flex h-full overflow-hidden",ee?"flex-row":""),children:[jsxs(DndContext,{sensors:ht,collisionDetection:closestCorners,onDragStart:yt,onDragOver:dt,onDragEnd:at,children:[jsxs("div",{ref:Fe,className:u("asakaa-board",ee?"flex-1":"",nt,n),style:{...i,cursor:re?"grabbing":void 0},"data-theme":Ue,children:[e.columns.sort((S,Y)=>S.position-Y.position).map(S=>{let Y=Ft.get(S.id)||[],le=!rt.includes(S.id),we=r?.renderColumnFooter?.(S);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(vn,{column:S,cards:Y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Se?(W,te)=>Se(W,te):void 0,onCardClick:$,onCardUpdate:Z,onColumnRename:t.onColumnUpdate?st:void 0,onColumnDelete:t.onColumnDelete?oe:void 0,isDeletable:le,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),we]},S.id)}),m]}),jsx(DragOverlay,{children:j.draggedCardId?jsx(mo,{card:e.cards.find(S=>S.id===j.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ee]}),!R&&jsx(fo,{task:Xe,isOpen:!!Xe,onClose:()=>z(null),onCardUpdate:de,theme:Be?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:Xe?g?.get(Xe.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:ke,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:v,isTimerRunning:E?.isRunning,timerElapsedSeconds:E?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:D,onSoldEffortUpdate:X,onTimerStart:O,onTimerStop:H,onTimerDiscard:F,blurFinancials:q})]})}function Th({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 Mh={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)"},Fh={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)"},Ph={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ah={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Lh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let l=m=>{i.current&&!i.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),n(false);};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,m)=>l.position-m.position).map((l,m)=>jsxs(motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Ih({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,y)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Bh({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 Ol({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:m,toolbarEndContent:d}){let p=r==="dark"?Mh:Fh,g={...o==="es"?Ph:Ah,...l},y=n||i||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[m&&jsxs(Fragment,{children:[m,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),y&&jsxs(Fragment,{children:[jsx(Ih,{theme:p,t:g,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),d,t&&(s?jsx(Lh,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsx(Bh,{onClick:()=>t(),label:a||g.newTask}))]})})}function Hl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let p=i.trim();p&&(e(p),c(""),n(false));},[i,e]),m=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),l()):p.key==="Escape"&&(c(""),n(false));},[l]),d=useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Jo({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=useState(""),[m,d]=useState(void 0),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(false),[b,w]=useState(false),[C,N]=useState(false),[T,k]=useState(s||new Date),v=useRef(null),E=o==="es",I=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{v.current?.focus();},[]);let D=useCallback(()=>{f(false),w(false),N(false);},[]),X=useCallback(()=>{l(""),d(void 0),g(null),x(null),D(),t();},[t,D]),O=useCallback(()=>{let q=c.trim();if(!q)return;let ee=a.find(R=>R.id===p),Se=y||s;e({name:q,priority:m,assignee:ee||void 0,assigneeId:p,startDate:Se,endDate:Se}),l(""),d(void 0),g(null),x(null),D(),v.current?.focus();},[c,m,p,y,s,a,e,D]),H=useCallback(q=>{q.key==="Enter"&&c.trim()&&(q.preventDefault(),O()),q.key==="Escape"&&X();},[O,X,c]),F=y||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>D(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:v,type:"text",value:c,onChange:q=>l(q.target.value),placeholder:E?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:H})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),f(!h),w(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",m?m==="urgent"||m==="high"?"text-red-400 bg-red-500/20":m==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:E?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:E?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:E?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:E?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:E?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxs("button",{onClick:()=>{d(q.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",q.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:q=>{q.stopPropagation(),N(!C),f(false),w(false),k(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),F.toLocaleDateString(E?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:C&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,ee=new Date(q);ee.setDate(q.getDate()+1);let Se=new Date(q);Se.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let R=new Date(q);R.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let j=new Date(q);j.setDate(q.getDate()+14);let be=new Date(q);be.setDate(q.getDate()+28);let Xe=E?"es-ES":"en-US";return [{label:E?"Hoy":"Today",date:q,display:q.toLocaleDateString(Xe,{weekday:"short"}).slice(0,3)+"."},{label:E?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(Xe,{weekday:"short"}).slice(0,3)+"."},{label:E?"Este fin de semana":"This weekend",date:Se,display:E?"s\xE1b.":"sat."},{label:E?"Pr\xF3xima semana":"Next week",date:R,display:E?"lun.":"mon."},{label:E?"2 semanas":"2 weeks",date:j,display:j.toLocaleDateString(Xe,{day:"numeric",month:"short"})},{label:E?"4 semanas":"4 weeks",date:be,display:be.toLocaleDateString(Xe,{day:"numeric",month:"short"})}].map((re,J)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(re.date),N(false);},children:[jsx("span",{children:re.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:re.display})]},J))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:T.toLocaleDateString(E?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>k(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:E?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>k(new Date(T.getFullYear(),T.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>k(new Date(T.getFullYear(),T.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(E?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:q},q))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=T.getFullYear(),ee=T.getMonth(),Se=new Date(q,ee,1).getDay(),R=new Date(q,ee+1,0).getDate(),j=new Date(q,ee,0).getDate(),be=new Date().toDateString(),Xe=[];for(let re=Se-1;re>=0;re--)Xe.push({dayNum:j-re,isCurrent:false,date:new Date(q,ee-1,j-re)});for(let re=1;re<=R;re++)Xe.push({dayNum:re,isCurrent:true,date:new Date(q,ee,re)});let z=42-Xe.length;for(let re=1;re<=z;re++)Xe.push({dayNum:re,isCurrent:false,date:new Date(q,ee+1,re)});return Xe.map((re,J)=>{let Fe=re.date.toDateString()===be,he=(y||s)?.toDateString()===re.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!re.isCurrent&&(r?"text-white/20":"text-gray-300"),re.isCurrent&&(r?"text-white":"text-gray-900"),Fe&&"ring-1 ring-[#007FFF]",he&&"bg-[#007FFF] text-white",!he&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(re.date),N(false);},children:re.dayNum},J)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),w(!b),f(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(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:b&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",I,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),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:E?"Sin asignar":"Unassigned"})]}),a.map(q=>jsxs("button",{type:"button",onClick:()=>{g(q.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:q.color||"#007FFF"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.name})]},q.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:E?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:E?"Guardar":"Save"})]})]})}function Vl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=useState(false),m=useRef(null),d=useRef(null),[p,g]=useState({}),[y,x]=useState(false),h=n==="dark",b={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!m.current)return;let C=90,N=()=>{let T=m.current.getBoundingClientRect(),v=window.innerHeight-T.bottom<C+8;x(v),g({position:"fixed",...v?{bottom:window.innerHeight-T.top+4}:{top:T.bottom+4},left:T.left,width:T.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[c]),useEffect(()=>{if(!c)return;let C=N=>{let T=N.target;d.current&&!d.current.contains(T)&&m.current&&!m.current.contains(T)&&l(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]);let w=useCallback(C=>{t({name:C.name,columnId:e,assigneeIds:C.assigneeId?[C.assigneeId]:void 0,startDate:C.startDate,endDate:C.endDate,priority:C.priority});},[t,e]);return jsxs("div",{ref:m,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:p,className:u("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Jo,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:h,locale:i,dropdownDirection:"up"})})}),document.body)]})}var ns=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(Mo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function yp(e={}){return new ns(e)}var Cn=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 _l(e,t){let a=r=>jsx(Cn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Kl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:m=""}){let[d,p]=useState(false),[g,y]=useState(""),[x,h]=useState("home"),[f,b]=useState(""),[w,C]=useState("");useEffect(()=>{let v=E=>{(E.metaKey||E.ctrlKey)&&E.key===l&&(E.preventDefault(),p(I=>!I)),E.key==="Escape"&&(p(false),h("home"),y(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l]),useEffect(()=>{d||(h("home"),y(""),b(""),C(""));},[d]);let N=useCallback(()=>{p(false);},[]),T=useCallback(v=>{let[E,I]=v.split(":");switch(E){case "create-card":h("create-card");break;case "create-card-in":b(I||"");break;case "navigate":I?(a?.(I),N()):h("navigate");break;case "search":r?.(g),N();break;case "priority":h("priority");break;case "set-priority":w&&I&&(o?.(w,I),N());break;case "assign":h("assign");break;case "assign-user":w&&I&&(s?.(w,I),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":i?.(),N();break;case "ai-usage":c?.(),N();break;case "back":h("home");break;}},[g,w,t,a,r,o,s,n,i,c,N]),k=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),N());},[f,g,t,N]);return d?jsx(Xt,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${m}`,onClick:v=>v.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:x==="create-card"&&f?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&x==="create-card"&&f&&k();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:T,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:T,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:T,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(v=>jsxs(Command.Item,{value:`navigate:${v.id}`,onSelect:T,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(E=>jsx("span",{className:"command-palette-item-label",children:E},E))})]},v.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(v=>jsxs(Command.Item,{value:`create-card-in:${v.id}`,onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:v.title}),jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(v=>{let E=e.columns.find(I=>I.id===v.columnId);return jsxs(Command.Item,{value:`navigate:${v.id}`,onSelect:T,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:v.title}),jsx("div",{className:"command-palette-item-meta",children:E?.title})]}),v.labels&&v.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},v.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function wp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;l(),o(x);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(i),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Xh(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 Jh(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 Yl(e){return e.startsWith("image/")}function no({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,i]=useState(false),[c,l]=useState(false),[m,d]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let y=useCallback((w,E)=>{E.preventDefault(),E.stopPropagation();let I=g.current.filter(O=>Yl(O.type)),D=I.findIndex(O=>O.id===w.id),X=O=>{let H=g.current.filter(q=>Yl(q.type)),F=H[O];F&&wp(F.url,F.name,H,O,X);};wp(w.url,w.name,I,D,X);},[]),x=useCallback(w=>{let E=[],I=[];return e.length+w.length>s?(I.push(`Maximum ${s} files allowed`),{valid:E,errors:I}):(w.forEach(D=>{if(D.size/1048576>r){I.push(`${D.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>D.type.match(O))){I.push(`${D.name} has invalid file type`);return}E.push(D);}),{valid:E,errors:I})},[e.length,s,r,o]),h=useCallback(async w=>{let{valid:E,errors:I}=x(w);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(E.length!==0){l(true),d(null);try{await t?.(E);}catch(D){d(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[x,t]),f=useCallback(w=>{w.preventDefault(),w.stopPropagation(),i(true);},[]),b=useCallback(w=>{w.preventDefault(),w.stopPropagation(),i(false);},[]),v=useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),C=useCallback(w=>{w.preventDefault(),w.stopPropagation(),i(false);let E=Array.from(w.dataTransfer.files);h(E);},[h]),N=useCallback(w=>{let E=w.target.files?Array.from(w.target.files):[];h(E),p.current&&(p.current.value="");},[h]),T=useCallback(()=>{p.current?.click();},[]),k=useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:b,onDragOver:v,onDrop:C,onClick:T,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:c?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children: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"]})]})})]}),m&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(w=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Yl(w.type)&&w.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:E=>y(w,E),title:"Click to view full size",children:[jsx("img",{src:w.thumbnailUrl||w.url,alt:w.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:Jh(w.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Xh(w.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>k(w.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"})})})]},w.id))})]})}function ql({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],aiInsights:c=[],attachments:l=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:f="user-1"}){let[b,v]=useState("details"),[C,N]=useState(false),[T,k]=useState({}),[w,E]=useState(""),[I,D]=useState(false),[X,O]=useState({});if(!t||!e)return null;let H=useCallback(()=>{N(false),k({}),v("details"),E(""),O({}),a();},[a]),F=useCallback(()=>{r&&Object.keys(T).length>0&&(r(e.id,T),k({}),N(false));},[e.id,T,r]),q=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),ee=useCallback(()=>{m&&w.trim()&&(m(e.id,w.trim()),E(""));},[e.id,w,m]),Se=useCallback(async()=>{if(y){D(true);try{let z=await y(e);O(re=>({...re,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{D(false);}}},[e,y]),R=useCallback(async()=>{if(x){D(true);try{let z=await x(e);O(re=>({...re,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{D(false);}}},[e,x]),j=useCallback(async()=>{if(h){D(true);try{let z=await h(e);O(re=>({...re,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{D(false);}}},[e,h]),be={...e,...T},Je=s.filter(z=>be.assignedUserIds?.includes(z.id));return jsx(Xt,{children:jsx("div",{className:"card-detail-overlay",onClick:H,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:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsx("input",{type:"text",value:T.title??be.title,onChange:z=>k({...T,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:be.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[C?jsxs(Fragment,{children:[jsx("button",{onClick:F,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>N(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:H,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:()=>v("details"),className:`card-detail-tab ${b==="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:()=>v("comments"),className:`card-detail-tab ${b==="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:()=>v("activity"),className:`card-detail-tab ${b==="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",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>v("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>v("ai"),className:`card-detail-tab ${b==="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:[b==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),C?jsx("textarea",{value:T.description??be.description??"",onChange:z=>k({...T,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:be.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),C?jsx("select",{multiple:true,value:T.assignedUserIds??be.assignedUserIds??[],onChange:z=>{let re=Array.from(z.target.selectedOptions,J=>J.value);k({...T,assignedUserIds:re});},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:Je.length>0?Je.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"}),C?jsxs("select",{value:T.priority??be.priority??"",onChange:z=>k({...T,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:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:be.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:be.labels&&be.labels.length>0?be.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"}),C?jsx("input",{type:"date",value:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:be.startDate?new Date(be.startDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:be.startDate?new Date(be.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),C?jsx("input",{type:"date",value:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:be.endDate?new Date(be.endDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:be.endDate?new Date(be.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),C?jsx("input",{type:"number",min:"0",step:"0.5",value:T.estimatedTime??be.estimatedTime??"",onChange:z=>k({...T,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:be.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:be.dependencies&&be.dependencies.length>0?be.dependencies.map(z=>{let re=typeof z=="string"?z:z.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",re.slice(-4)]},re)}):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:be.createdAt?new Date(be.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:w,onChange:z=>E(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ee,disabled:!w.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 re=s.find(J=>J.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:[re&&jsx("div",{className:"card-detail-user-avatar",style:{background:re.color},children:re.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:re?.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"})]})})]}),b==="activity"&&jsx("div",{className:"card-detail-activity",children:i.length>0?jsx("div",{className:"card-detail-activity-list",children:i.map(z=>{let re=s.find(J=>J.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:re?.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"})]})}),b==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(no,{cardId:e.id,attachments:l,onUpload:p?z=>p(e.id,z):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),b==="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:Se,disabled:I||!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("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:R,disabled:I||!x,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:j,disabled:I||!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("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),X.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),X.assignees.map((z,re)=>{let J=s.find(Fe=>Fe.id===z.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.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),"%"]})]})]},re)})]}),X.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),X.subtasks.map((z,re)=>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"]})]},re))]}),X.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:[X.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(X.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.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))]}),!X.assignees&&!X.subtasks&&!X.effort&&c.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 ns({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[i,c]=useState({top:0,left:0}),l=useRef(null),m=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=p-d.bottom,f=d.top,b;return h>=s+y?b=d.bottom+y:f>=s+y?b=d.top-s-y:h>=f?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:x}},[e,o,s]);return useEffect(()=>{t&&c(m());},[t,m]),useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;l.current&&!l.current.contains(y)&&e.current&&!e.current.contains(y)&&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(Xt,{children:jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${i.top}px`,left:`${i.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 ut={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 ny=["LOW","MEDIUM","HIGH","URGENT"],sy=["todo","in-progress","review","done"];function Ql({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],onAddComment:c,onDeleteComment:l,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:b,unsplashAccessKey:v,theme:C,onSubtasksChange:N,attachments:T=[],onUploadAttachments:k,onDeleteAttachment:w}){let E=fn(),I=C||E?.themeName||"dark",[D,X]=useState(e),[O,H]=useState(false),[F,q]=useState(()=>[...e?.subtasks||[]].sort((_,K)=>(_.position??0)-(K.position??0))),[ee,Se]=useState(false),[R,j]=useState(""),[be,Je]=useState(""),[z,re]=useState("all"),[J,Fe]=useState(false),[he,Ue]=useState(false),[Be,nt]=useState(false),[Z,st]=useState(false),[oe,rt]=useState(false),[ht,Mt]=useState(false),ke=useRef(null),yt=useRef(null),dt=useRef(null),at=useRef(null),$=useRef(null),de=useRef(null),S=useRef(null),Y=useRef(null),le=useRef(null),we=useRef(null),W=useRef(null),te=useRef(null);useEffect(()=>{if(e&&!D){X({...e});let L=[...e.subtasks||[]].sort((_,K)=>(_.position??0)-(K.position??0));q(L);}else if(e&&D&&e.id!==D.id){X({...e});let L=[...e.subtasks||[]].sort((_,K)=>(_.position??0)-(K.position??0));q(L);}},[e,D]),useEffect(()=>{let L=_=>{let K=_.target;at.current&&!at.current.contains(K)&&Fe(false),$.current&&!$.current.contains(K)&&Ue(false),de.current&&!de.current.contains(K)&&nt(false),S.current&&!S.current.contains(K)&&st(false);};if(J||he||Be||Z)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[J,he,Be,Z]),useEffect(()=>{if(!t)return;let L=_=>{let K=_.target,ue=K.tagName==="INPUT"||K.tagName==="TEXTAREA"||K.isContentEditable;if(_.key==="Escape"){_.preventDefault(),J||he||Be||Z||oe||ht?(Fe(false),Ue(false),nt(false),st(false),rt(false),Mt(false)):ue||a();return}if(ue&&_.key!=="Escape")return;let Me=_.metaKey||_.ctrlKey;switch(_.key.toLowerCase()){case "s":_.preventDefault(),Fe(true);break;case "a":_.preventDefault(),nt(true);break;case "p":_.preventDefault(),Ue(true);break;case "l":_.preventDefault(),st(true);break;case "d":Me||(_.preventDefault(),rt(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":Me||(_.preventDefault(),Mt(true));break;case "i":_.preventDefault(),H(true),setTimeout(()=>yt.current?.focus(),0);break;case "t":_.preventDefault(),Se(true);break;case "c":_.preventDefault(),dt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,J,he,Be,Z,oe,ht]);let We=useCallback(L=>{let _=L.currentTarget.textContent?.trim()||"";if(D&&_!==D.title){let K={...D,title:_};X(K),r?.(D.id,{title:_});}},[D,r]),Ce=useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=D?.title||"",L.currentTarget.blur());},[D]),He=useCallback(()=>{D&&e&&D.description!==e.description&&r?.(D.id,{description:D.description}),H(false);},[D,e,r]),Ne=useCallback(L=>{if(D){let _={...D,columnId:L};X(_),r?.(D.id,{columnId:L}),Fe(false);}},[D,r]),_e=useCallback(L=>{if(D){let _={...D,priority:L};X(_),r?.(D.id,{priority:L}),Ue(false);}},[D,r]),wt=useCallback(L=>{if(D){let _=D.assignedUserIds||[],K=_.includes(L)?_.filter(Me=>Me!==L):[..._,L],ue={...D,assignedUserIds:K};X(ue),r?.(D.id,{assignedUserIds:K});}},[D,r]),mt=useCallback(L=>{if(D){let _=D.labels||[],K=_.includes(L)?_.filter(Me=>Me!==L):[..._,L],ue={...D,labels:K};X(ue),r?.(D.id,{labels:K});}},[D,r]),ot=useCallback(L=>{if(D){let _={...D,tags:L};X(_),r?.(D.id,{tags:L});}},[D,r]),et=useCallback(L=>{if(D){let _=L.target.value,K={...D,endDate:_};X(K),r?.(D.id,{endDate:_}),rt(false);}},[D,r]),Yt=useCallback(L=>{if(D){let _={...D,estimatedTime:parseFloat(L)||0};X(_),r?.(D.id,{estimatedTime:parseFloat(L)||0});}},[D,r]),Ft=useCallback(()=>{if(R.trim()&&D){let L={id:`subtask-${Date.now()}`,title:R.trim(),completed:false,position:F.length,createdAt:new Date},_=[...F,L];q(_),j(""),Se(false),N?.(D.id,_);}},[R,F,D,N]),xt=useCallback(L=>{let _=F.map(K=>K.id===L?{...K,completed:!K.completed,updatedAt:new Date}:K);q(_),D&&N?.(D.id,_);},[F,D,N]),Tt=useCallback(L=>{let _=F.filter(K=>K.id!==L);q(_),D&&N?.(D.id,_);},[F,D,N]),gt=useCallback(()=>{be.trim()&&D&&c&&(c(D.id,be.trim()),Je(""));},[be,D,c]),zt=useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),gt());},[gt]),Re=L=>jsx(ay,{remarkPlugins:[ry],rehypePlugins:[oy],components:{a:({node:_,...K})=>jsx("a",{...K,target:"_blank",rel:"noopener noreferrer"})},children:L}),Ae=i.filter(L=>z==="comments"?L.type.includes("COMMENT"):z==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let ct=D||e,se=s.filter(L=>ct.assignedUserIds?.includes(L.id)),fe=F.filter(L=>L.completed).length;return jsx(Xt,{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:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:ke,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:We,onKeyDown:Ce,children:ct.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:at,children:[jsxs("button",{ref:le,className:"modal-v2-field",onClick:()=>Fe(!J),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:ct.columnId||"No status"})]}),jsx(ns,{triggerRef:le,isOpen:J,onClose:()=>Fe(false),width:250,estimatedHeight:200,children:(y.length>0?y:sy.map(L=>({id:L,title:L}))).map(L=>jsx("button",{className:`modal-v2-popover-item ${ct.columnId===L.id?"active":""}`,onClick:()=>Ne(L.id),children:L.title},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:de,children:[jsxs("button",{ref:we,className:"modal-v2-field",onClick:()=>nt(!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:"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:se.length>0?jsx("div",{className:"modal-v2-avatars",children:se.map(L=>jsx("div",{className:"modal-v2-avatar",style:{background:L.color},title:L.name,children:L.initials},L.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(ns,{triggerRef:we,isOpen:Be,onClose:()=>nt(false),width:280,estimatedHeight:300,children:s.map(L=>jsxs("button",{className:`modal-v2-popover-item ${ct.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>wt(L.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,ct.assignedUserIds?.includes(L.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"})})]},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:$,children:[jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>Ue(!he),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:ct.priority||"None"})]}),jsxs(ns,{triggerRef:W,isOpen:he,onClose:()=>Ue(false),width:180,estimatedHeight:220,children:[ny.map(L=>jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${ct.priority===L?"active":""}`,onClick:()=>_e(L),children:L},L)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>_e(""),children:"None"})]})]}),h.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(No,{selectedTags:ct.tags||[],availableTags:h,onChange:ot,onCreateTag:f,theme:ut[I]||ut.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:S,children:[jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>st(!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:ct.labels&&ct.labels.length>0?jsx("span",{children:ct.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(ns,{triggerRef:te,isOpen:Z,onClose:()=>st(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxs("button",{className:`modal-v2-popover-item ${ct.labels?.includes(L)?"active":""}`,onClick:()=>mt(L),children:[L,ct.labels?.includes(L)&&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"})})]},L))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{rt(!oe),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:ct.endDate?new Date(ct.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Y,type:"date",value:typeof ct.endDate=="string"?ct.endDate.split("T")[0]:ct.endDate?(()=>{let L=new Date(ct.endDate),_=L.getUTCFullYear(),K=String(L.getUTCMonth()+1).padStart(2,"0"),ue=String(L.getUTCDate()).padStart(2,"0");return `${_}-${K}-${ue}`})():"",onChange:et,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Mt(!ht),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:ct.estimatedTime?`${ct.estimatedTime}h`:"Not set"})]}),ht&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ct.estimatedTime||"",onChange:L=>Yt(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Mt(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"})]}),O?jsx("textarea",{className:"modal-v2-textarea",value:ct.description||"",onChange:L=>{if(D){let _={...D,description:L.target.value};X(_);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:ct.description?jsx("div",{className:"modal-v2-markdown",children:Re(ct.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"}),F.length>0&&jsxs("span",{className:"modal-v2-count",children:[fe,"/",F.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Se(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:[F.map(L=>jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>xt(L.id),children:L.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:L.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Tt(L.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"})]})})]},L.id)),ee&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:R,onChange:L=>j(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Ft(),L.key==="Escape"&&(Se(false),j(""));},onBlur:Ft,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||T.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"}),T.length>0&&jsx("span",{className:"modal-v2-count",children:T.length})]}),jsx(no,{cardId:ct.id,attachments:T,onUpload:k?L=>k(ct.id,L):void 0,onDelete:w,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:()=>re("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>re("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>re("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:dt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:be,onChange:L=>Je(L.target.value),onKeyDown:zt,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:gt,disabled:!be.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Ae.map(L=>{let _=s.find(ue=>ue.id===L.userId);if(L.type.includes("COMMENT")){let ue=n.find(Me=>Me.id===L.metadata?.commentId);return ue?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[_&&jsx("div",{className:"modal-v2-avatar",style:{background:_.color},children:_.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:_?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:ue.content})]})]},L.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.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:_?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:L.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.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 fy({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 ed({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((i,c)=>i+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(fy,{})}),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,i)=>n+i.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,i)=>n+i.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,i)=>n+(i.planned||0),0)})]})]})]})}function Ty({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 td({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,i=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,l=n<=i;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(Ty,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ly={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Fp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Iy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,i=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Pp({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 ad({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,l)=>c+l.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||Ly[c.name]||Fp[e.indexOf(c)%Fp.length]})),i=n.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Iy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(Pp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let m=l.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${c} (${m.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(Pp,{})}),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((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var ci=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,i]=useState(false),[c,l]=useState(false),[m,d]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let y=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(y,{priority:C}),i(false);},h=C=>{r.onBulkMove?.(y,C),l(false),a();},f=C=>{r.onBulkUpdate?.(y,{assignedUserIds:C}),d(false);},b=C=>{let N=new Set;e.forEach(k=>{k.labels?.forEach(w=>N.add(w));});let T=Array.from(new Set([...N,...C]));r.onBulkUpdate?.(y,{labels:T}),g(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),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:()=>i(!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(C=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(C),children:[jsx("span",{className:u("asakaa-priority-dot",C==="LOW"&&"bg-asakaa-priority-low",C==="MEDIUM"&&"bg-asakaa-priority-medium",C==="HIGH"&&"bg-asakaa-priority-high",C==="URGENT"&&"bg-asakaa-priority-urgent")}),C]},C))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(C.id),children:C.title},C.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([C.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:C.color},children:C.initials}),C.name]},C.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(C=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([C]),children:C},C))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,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"})})]})]})})});ci.displayName="BulkOperationsToolbar";function Hy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,i,c,l;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,i=y?.name||`User ${g}`,c=y?.color,l=y?.avatar,r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c,icon:l}),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];i=p.title,c=p.color,r.has(n)||r.set(n,{id:n,title:i,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,i=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",i="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function rd({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),i=useMemo(()=>Hy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(l=>{n(m=>{let d=new Set(m);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||i.length===0?jsx(Eo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[i.map(l=>{let m=s.has(l.id),d=e.cards.filter(g=>l.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&&c(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Eo,{board:p,callbacks:r,availableUsers:a})})]},l.id)}),i.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 od=[{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 nd({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),i=od.find(l=>l.value===e)||od[0];useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);};return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:i.icon}),jsx("span",{children:i.label}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:od.map(l=>jsxs("button",{onClick:()=>c(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var ss=[{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 Wy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,i=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&i&&c}function Rp(e={}){let{shortcuts:t=ss,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(c=>{o.current=[...o.current,c];},[]),i=useCallback(c=>{o.current=o.current.filter(l=>l.action!==c);},[]);return useEffect(()=>{function c(l){if(!s.current)return;let m=l.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(Wy(l,d)){r&&l.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:i,isEnabled:a}}function Vy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function _y(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 jy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=_y(e),r=t?Vy(t):"";return a?`${a} + ${r}`:r}function Ky(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 sd({shortcuts:e=ss,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!o||!t)return null;let n=Ky(e);return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([i,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),i]}),jsx("div",{className:"space-y-3",children:c.map(l=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:jy(l)})]},l.action))})]},i))})}),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 id=[{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=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;l(),o(x);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(i),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Xh(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 Jh(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 ql(e){return e.startsWith("image/")}function no({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,i]=useState(false),[c,l]=useState(false),[m,d]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let y=useCallback((v,E)=>{E.preventDefault(),E.stopPropagation();let I=g.current.filter(O=>ql(O.type)),D=I.findIndex(O=>O.id===v.id),X=O=>{let H=g.current.filter(q=>ql(q.type)),F=H[O];F&&wp(F.url,F.name,H,O,X);};wp(v.url,v.name,I,D,X);},[]),x=useCallback(v=>{let E=[],I=[];return e.length+v.length>s?(I.push(`Maximum ${s} files allowed`),{valid:E,errors:I}):(v.forEach(D=>{if(D.size/1048576>r){I.push(`${D.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>D.type.match(O))){I.push(`${D.name} has invalid file type`);return}E.push(D);}),{valid:E,errors:I})},[e.length,s,r,o]),h=useCallback(async v=>{let{valid:E,errors:I}=x(v);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(E.length!==0){l(true),d(null);try{await t?.(E);}catch(D){d(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[x,t]),f=useCallback(v=>{v.preventDefault(),v.stopPropagation(),i(true);},[]),b=useCallback(v=>{v.preventDefault(),v.stopPropagation(),i(false);},[]),w=useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),C=useCallback(v=>{v.preventDefault(),v.stopPropagation(),i(false);let E=Array.from(v.dataTransfer.files);h(E);},[h]),N=useCallback(v=>{let E=v.target.files?Array.from(v.target.files):[];h(E),p.current&&(p.current.value="");},[h]),T=useCallback(()=>{p.current?.click();},[]),k=useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:b,onDragOver:w,onDrop:C,onClick:T,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:c?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children: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"]})]})})]}),m&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(v=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:ql(v.type)&&v.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:E=>y(v,E),title:"Click to view full size",children:[jsx("img",{src:v.thumbnailUrl||v.url,alt:v.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:Jh(v.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Xh(v.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>k(v.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"})})})]},v.id))})]})}function Xl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],aiInsights:c=[],attachments:l=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:f="user-1"}){let[b,w]=useState("details"),[C,N]=useState(false),[T,k]=useState({}),[v,E]=useState(""),[I,D]=useState(false),[X,O]=useState({});if(!t||!e)return null;let H=useCallback(()=>{N(false),k({}),w("details"),E(""),O({}),a();},[a]),F=useCallback(()=>{r&&Object.keys(T).length>0&&(r(e.id,T),k({}),N(false));},[e.id,T,r]),q=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),ee=useCallback(()=>{m&&v.trim()&&(m(e.id,v.trim()),E(""));},[e.id,v,m]),Se=useCallback(async()=>{if(y){D(true);try{let z=await y(e);O(re=>({...re,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{D(false);}}},[e,y]),R=useCallback(async()=>{if(x){D(true);try{let z=await x(e);O(re=>({...re,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{D(false);}}},[e,x]),j=useCallback(async()=>{if(h){D(true);try{let z=await h(e);O(re=>({...re,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{D(false);}}},[e,h]),be={...e,...T},Xe=s.filter(z=>be.assignedUserIds?.includes(z.id));return jsx(Xt,{children:jsx("div",{className:"card-detail-overlay",onClick:H,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:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsx("input",{type:"text",value:T.title??be.title,onChange:z=>k({...T,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:be.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[C?jsxs(Fragment,{children:[jsx("button",{onClick:F,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>N(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:H,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:()=>w("details"),className:`card-detail-tab ${b==="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:()=>w("comments"),className:`card-detail-tab ${b==="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:()=>w("activity"),className:`card-detail-tab ${b==="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",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${b==="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:[b==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),C?jsx("textarea",{value:T.description??be.description??"",onChange:z=>k({...T,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:be.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),C?jsx("select",{multiple:true,value:T.assignedUserIds??be.assignedUserIds??[],onChange:z=>{let re=Array.from(z.target.selectedOptions,J=>J.value);k({...T,assignedUserIds:re});},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:Xe.length>0?Xe.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"}),C?jsxs("select",{value:T.priority??be.priority??"",onChange:z=>k({...T,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:be.priority==="URGENT"?"#EF4444":be.priority==="HIGH"?"#F59E0B":be.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:be.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:be.labels&&be.labels.length>0?be.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"}),C?jsx("input",{type:"date",value:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:be.startDate?new Date(be.startDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:be.startDate?new Date(be.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),C?jsx("input",{type:"date",value:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:be.endDate?new Date(be.endDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:be.endDate?new Date(be.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),C?jsx("input",{type:"number",min:"0",step:"0.5",value:T.estimatedTime??be.estimatedTime??"",onChange:z=>k({...T,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:be.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:be.dependencies&&be.dependencies.length>0?be.dependencies.map(z=>{let re=typeof z=="string"?z:z.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",re.slice(-4)]},re)}):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:be.createdAt?new Date(be.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:v,onChange:z=>E(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ee,disabled:!v.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 re=s.find(J=>J.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:[re&&jsx("div",{className:"card-detail-user-avatar",style:{background:re.color},children:re.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:re?.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"})]})})]}),b==="activity"&&jsx("div",{className:"card-detail-activity",children:i.length>0?jsx("div",{className:"card-detail-activity-list",children:i.map(z=>{let re=s.find(J=>J.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:re?.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"})]})}),b==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(no,{cardId:e.id,attachments:l,onUpload:p?z=>p(e.id,z):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),b==="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:Se,disabled:I||!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("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:R,disabled:I||!x,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:j,disabled:I||!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("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),X.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),X.assignees.map((z,re)=>{let J=s.find(Fe=>Fe.id===z.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.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),"%"]})]})]},re)})]}),X.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),X.subtasks.map((z,re)=>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"]})]},re))]}),X.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:[X.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(X.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.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))]}),!X.assignees&&!X.subtasks&&!X.effort&&c.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 is({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[i,c]=useState({top:0,left:0}),l=useRef(null),m=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=p-d.bottom,f=d.top,b;return h>=s+y?b=d.bottom+y:f>=s+y?b=d.top-s-y:h>=f?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:x}},[e,o,s]);return useEffect(()=>{t&&c(m());},[t,m]),useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;l.current&&!l.current.contains(y)&&e.current&&!e.current.contains(y)&&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(Xt,{children:jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${i.top}px`,left:`${i.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 ut={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 ny=["LOW","MEDIUM","HIGH","URGENT"],sy=["todo","in-progress","review","done"];function Zl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],onAddComment:c,onDeleteComment:l,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:b,unsplashAccessKey:w,theme:C,onSubtasksChange:N,attachments:T=[],onUploadAttachments:k,onDeleteAttachment:v}){let E=hn(),I=C||E?.themeName||"dark",[D,X]=useState(e),[O,H]=useState(false),[F,q]=useState(()=>[...e?.subtasks||[]].sort((_,K)=>(_.position??0)-(K.position??0))),[ee,Se]=useState(false),[R,j]=useState(""),[be,Xe]=useState(""),[z,re]=useState("all"),[J,Fe]=useState(false),[he,Ue]=useState(false),[Be,nt]=useState(false),[Z,st]=useState(false),[oe,rt]=useState(false),[ht,Ft]=useState(false),ke=useRef(null),yt=useRef(null),dt=useRef(null),at=useRef(null),$=useRef(null),de=useRef(null),S=useRef(null),Y=useRef(null),le=useRef(null),we=useRef(null),W=useRef(null),te=useRef(null);useEffect(()=>{if(e&&!D){X({...e});let L=[...e.subtasks||[]].sort((_,K)=>(_.position??0)-(K.position??0));q(L);}else if(e&&D&&e.id!==D.id){X({...e});let L=[...e.subtasks||[]].sort((_,K)=>(_.position??0)-(K.position??0));q(L);}},[e,D]),useEffect(()=>{let L=_=>{let K=_.target;at.current&&!at.current.contains(K)&&Fe(false),$.current&&!$.current.contains(K)&&Ue(false),de.current&&!de.current.contains(K)&&nt(false),S.current&&!S.current.contains(K)&&st(false);};if(J||he||Be||Z)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[J,he,Be,Z]),useEffect(()=>{if(!t)return;let L=_=>{let K=_.target,ue=K.tagName==="INPUT"||K.tagName==="TEXTAREA"||K.isContentEditable;if(_.key==="Escape"){_.preventDefault(),J||he||Be||Z||oe||ht?(Fe(false),Ue(false),nt(false),st(false),rt(false),Ft(false)):ue||a();return}if(ue&&_.key!=="Escape")return;let Me=_.metaKey||_.ctrlKey;switch(_.key.toLowerCase()){case "s":_.preventDefault(),Fe(true);break;case "a":_.preventDefault(),nt(true);break;case "p":_.preventDefault(),Ue(true);break;case "l":_.preventDefault(),st(true);break;case "d":Me||(_.preventDefault(),rt(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":Me||(_.preventDefault(),Ft(true));break;case "i":_.preventDefault(),H(true),setTimeout(()=>yt.current?.focus(),0);break;case "t":_.preventDefault(),Se(true);break;case "c":_.preventDefault(),dt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,J,he,Be,Z,oe,ht]);let We=useCallback(L=>{let _=L.currentTarget.textContent?.trim()||"";if(D&&_!==D.title){let K={...D,title:_};X(K),r?.(D.id,{title:_});}},[D,r]),Ce=useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=D?.title||"",L.currentTarget.blur());},[D]),He=useCallback(()=>{D&&e&&D.description!==e.description&&r?.(D.id,{description:D.description}),H(false);},[D,e,r]),Ne=useCallback(L=>{if(D){let _={...D,columnId:L};X(_),r?.(D.id,{columnId:L}),Fe(false);}},[D,r]),_e=useCallback(L=>{if(D){let _={...D,priority:L};X(_),r?.(D.id,{priority:L}),Ue(false);}},[D,r]),kt=useCallback(L=>{if(D){let _=D.assignedUserIds||[],K=_.includes(L)?_.filter(Me=>Me!==L):[..._,L],ue={...D,assignedUserIds:K};X(ue),r?.(D.id,{assignedUserIds:K});}},[D,r]),mt=useCallback(L=>{if(D){let _=D.labels||[],K=_.includes(L)?_.filter(Me=>Me!==L):[..._,L],ue={...D,labels:K};X(ue),r?.(D.id,{labels:K});}},[D,r]),ot=useCallback(L=>{if(D){let _={...D,tags:L};X(_),r?.(D.id,{tags:L});}},[D,r]),et=useCallback(L=>{if(D){let _=L.target.value,K={...D,endDate:_};X(K),r?.(D.id,{endDate:_}),rt(false);}},[D,r]),Yt=useCallback(L=>{if(D){let _={...D,estimatedTime:parseFloat(L)||0};X(_),r?.(D.id,{estimatedTime:parseFloat(L)||0});}},[D,r]),Pt=useCallback(()=>{if(R.trim()&&D){let L={id:`subtask-${Date.now()}`,title:R.trim(),completed:false,position:F.length,createdAt:new Date},_=[...F,L];q(_),j(""),Se(false),N?.(D.id,_);}},[R,F,D,N]),vt=useCallback(L=>{let _=F.map(K=>K.id===L?{...K,completed:!K.completed,updatedAt:new Date}:K);q(_),D&&N?.(D.id,_);},[F,D,N]),Nt=useCallback(L=>{let _=F.filter(K=>K.id!==L);q(_),D&&N?.(D.id,_);},[F,D,N]),gt=useCallback(()=>{be.trim()&&D&&c&&(c(D.id,be.trim()),Xe(""));},[be,D,c]),Wt=useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),gt());},[gt]),Re=L=>jsx(ay,{remarkPlugins:[ry],rehypePlugins:[oy],components:{a:({node:_,...K})=>jsx("a",{...K,target:"_blank",rel:"noopener noreferrer"})},children:L}),Ae=i.filter(L=>z==="comments"?L.type.includes("COMMENT"):z==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let ct=D||e,se=s.filter(L=>ct.assignedUserIds?.includes(L.id)),fe=F.filter(L=>L.completed).length;return jsx(Xt,{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:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:ke,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:We,onKeyDown:Ce,children:ct.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:at,children:[jsxs("button",{ref:le,className:"modal-v2-field",onClick:()=>Fe(!J),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:ct.columnId||"No status"})]}),jsx(is,{triggerRef:le,isOpen:J,onClose:()=>Fe(false),width:250,estimatedHeight:200,children:(y.length>0?y:sy.map(L=>({id:L,title:L}))).map(L=>jsx("button",{className:`modal-v2-popover-item ${ct.columnId===L.id?"active":""}`,onClick:()=>Ne(L.id),children:L.title},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:de,children:[jsxs("button",{ref:we,className:"modal-v2-field",onClick:()=>nt(!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:"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:se.length>0?jsx("div",{className:"modal-v2-avatars",children:se.map(L=>jsx("div",{className:"modal-v2-avatar",style:{background:L.color},title:L.name,children:L.initials},L.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(is,{triggerRef:we,isOpen:Be,onClose:()=>nt(false),width:280,estimatedHeight:300,children:s.map(L=>jsxs("button",{className:`modal-v2-popover-item ${ct.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>kt(L.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,ct.assignedUserIds?.includes(L.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"})})]},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:$,children:[jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>Ue(!he),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:ct.priority||"None"})]}),jsxs(is,{triggerRef:W,isOpen:he,onClose:()=>Ue(false),width:180,estimatedHeight:220,children:[ny.map(L=>jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${ct.priority===L?"active":""}`,onClick:()=>_e(L),children:L},L)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>_e(""),children:"None"})]})]}),h.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(Do,{selectedTags:ct.tags||[],availableTags:h,onChange:ot,onCreateTag:f,theme:ut[I]||ut.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:S,children:[jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>st(!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:ct.labels&&ct.labels.length>0?jsx("span",{children:ct.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(is,{triggerRef:te,isOpen:Z,onClose:()=>st(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxs("button",{className:`modal-v2-popover-item ${ct.labels?.includes(L)?"active":""}`,onClick:()=>mt(L),children:[L,ct.labels?.includes(L)&&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"})})]},L))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{rt(!oe),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:ct.endDate?new Date(ct.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Y,type:"date",value:typeof ct.endDate=="string"?ct.endDate.split("T")[0]:ct.endDate?(()=>{let L=new Date(ct.endDate),_=L.getUTCFullYear(),K=String(L.getUTCMonth()+1).padStart(2,"0"),ue=String(L.getUTCDate()).padStart(2,"0");return `${_}-${K}-${ue}`})():"",onChange:et,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Ft(!ht),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:ct.estimatedTime?`${ct.estimatedTime}h`:"Not set"})]}),ht&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ct.estimatedTime||"",onChange:L=>Yt(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ft(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"})]}),O?jsx("textarea",{className:"modal-v2-textarea",value:ct.description||"",onChange:L=>{if(D){let _={...D,description:L.target.value};X(_);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:ct.description?jsx("div",{className:"modal-v2-markdown",children:Re(ct.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"}),F.length>0&&jsxs("span",{className:"modal-v2-count",children:[fe,"/",F.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Se(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:[F.map(L=>jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>vt(L.id),children:L.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:L.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Nt(L.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"})]})})]},L.id)),ee&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:R,onChange:L=>j(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Pt(),L.key==="Escape"&&(Se(false),j(""));},onBlur:Pt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||T.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"}),T.length>0&&jsx("span",{className:"modal-v2-count",children:T.length})]}),jsx(no,{cardId:ct.id,attachments:T,onUpload:k?L=>k(ct.id,L):void 0,onDelete:v,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:()=>re("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>re("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>re("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:dt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:be,onChange:L=>Xe(L.target.value),onKeyDown:Wt,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:gt,disabled:!be.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Ae.map(L=>{let _=s.find(ue=>ue.id===L.userId);if(L.type.includes("COMMENT")){let ue=n.find(Me=>Me.id===L.metadata?.commentId);return ue?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[_&&jsx("div",{className:"modal-v2-avatar",style:{background:_.color},children:_.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:_?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:ue.content})]})]},L.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.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:_?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:L.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.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 fy({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 td({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((i,c)=>i+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(fy,{})}),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,i)=>n+i.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,i)=>n+i.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,i)=>n+(i.planned||0),0)})]})]})]})}function Ty({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 ad({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,i=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,l=n<=i;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(Ty,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ly={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Fp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Iy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,i=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Pp({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 rd({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,l)=>c+l.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||Ly[c.name]||Fp[e.indexOf(c)%Fp.length]})),i=n.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:n,cx:"50%",cy:"50%",labelLine:false,label:o?Iy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(Pp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let m=l.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${c} (${m.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(Pp,{})}),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((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var ui=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,i]=useState(false),[c,l]=useState(false),[m,d]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let y=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(y,{priority:C}),i(false);},h=C=>{r.onBulkMove?.(y,C),l(false),a();},f=C=>{r.onBulkUpdate?.(y,{assignedUserIds:C}),d(false);},b=C=>{let N=new Set;e.forEach(k=>{k.labels?.forEach(v=>N.add(v));});let T=Array.from(new Set([...N,...C]));r.onBulkUpdate?.(y,{labels:T}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),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:()=>i(!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(C=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(C),children:[jsx("span",{className:u("asakaa-priority-dot",C==="LOW"&&"bg-asakaa-priority-low",C==="MEDIUM"&&"bg-asakaa-priority-medium",C==="HIGH"&&"bg-asakaa-priority-high",C==="URGENT"&&"bg-asakaa-priority-urgent")}),C]},C))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(C.id),children:C.title},C.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([C.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:C.color},children:C.initials}),C.name]},C.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(C=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([C]),children:C},C))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,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"})})]})]})})});ui.displayName="BulkOperationsToolbar";function Hy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,i,c,l;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,i=y?.name||`User ${g}`,c=y?.color,l=y?.avatar,r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c,icon:l}),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];i=p.title,c=p.color,r.has(n)||r.set(n,{id:n,title:i,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,i=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",i="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function od({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),i=useMemo(()=>Hy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(l=>{n(m=>{let d=new Set(m);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||i.length===0?jsx(Mo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[i.map(l=>{let m=s.has(l.id),d=e.cards.filter(g=>l.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&&c(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Mo,{board:p,callbacks:r,availableUsers:a})})]},l.id)}),i.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 nd=[{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 sd({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),i=nd.find(l=>l.value===e)||nd[0];useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);};return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:i.icon}),jsx("span",{children:i.label}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:nd.map(l=>jsxs("button",{onClick:()=>c(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var ls=[{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 Wy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,i=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&i&&c}function Rp(e={}){let{shortcuts:t=ls,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(c=>{o.current=[...o.current,c];},[]),i=useCallback(c=>{o.current=o.current.filter(l=>l.action!==c);},[]);return useEffect(()=>{function c(l){if(!s.current)return;let m=l.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(Wy(l,d)){r&&l.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:i,isEnabled:a}}function Vy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function _y(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 jy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=_y(e),r=t?Vy(t):"";return a?`${a} + ${r}`:r}function Ky(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 id({shortcuts:e=ls,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!o||!t)return null;let n=Ky(e);return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([i,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),i]}),jsx("div",{className:"space-y-3",children:c.map(l=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:jy(l)})]},l.action))})]},i))})}),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 ld=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,13 +122,13 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ld({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,m)=>{let d=m.category||"Other";return l[d]||(l[d]=[]),l[d].push(m),l},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,m])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsx("div",{children:m.map(d=>jsxs("button",{onClick:()=>i(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))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function cd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=useState("export"),[c,l]=useState("json"),[m,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await iu(e,c,x);lu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await uu(h),b=h.name.endsWith(".json")?"json":"csv",v=cu(f,b);d(v),v.success&&r&&r(v,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:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxs("button",{onClick:()=>l(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"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:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),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:y,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"})]})]}),m&&jsxs("div",{className:u("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:u("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:m.errors.map((x,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Qy=["URGENT","HIGH","MEDIUM","LOW"],Zy=[{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"}],ex=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ud({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:m=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=useState(true),f=useCallback(T=>{a({search:T.target.value});},[a]),b=useCallback(T=>{a({dateFilter:T.target.value});},[a]),v=useCallback(T=>{r({by:T.target.value});},[r]),C=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=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":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"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"}),N&&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)"]})]}),!x&&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"}),i&&jsx("button",{onClick:i,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:b,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:T=>{let k=T.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Qy.map(T=>jsx("option",{value:T,children:T},T))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:T=>{let k=T.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(T=>jsx("option",{value:T.id,children:T.name},T.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:T=>{let k=T.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(T=>jsx("option",{value:T,children:T},T))]})}),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:v,className:"filter-bar__select filter-bar__select--sm",children:Zy.map(T=>jsx("option",{value:T.value,children:T.label},T.value))}),t.by!=="none"&&jsx("button",{onClick:C,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:T=>y(T.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ex.map(T=>jsx("option",{value:T.value,children:T.label},T.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function pd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,m]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let p=g=>{g(),m(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>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 i?.()),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(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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 md={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"}},gd={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"}},fd={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"}},Qo={dark:md,light:gd,neutral:fd},pi="dark";var mi=createContext(void 0),cx="asakaa-theme";function Hp({children:e,defaultTheme:t=pi,storageKey:a=cx}){let[r,o]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Qo[r];Object.entries(c.colors).forEach(([m,d])=>{d&&i.style.setProperty(`--theme-${ux(m)}`,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(([m,d])=>{let p=c.colors[m];p&&i.style.setProperty(d,p);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Qo};return jsx(mi.Provider,{value:n,children:e})}function Nn(){let e=useContext(mi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ux(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function bd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Nn();return e?jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(Qo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function zp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ut[e]||ut.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ut[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ut[e].bgSecondary),bgGrid:r("--theme-bg-card",ut[e].bgGrid),bgWeekend:r("--theme-bg-hover",ut[e].bgWeekend),border:r("--theme-border-primary",ut[e].border),borderLight:r("--theme-border-subtle",ut[e].borderLight),textPrimary:r("--theme-text-primary",ut[e].textPrimary),textSecondary:r("--theme-text-secondary",ut[e].textSecondary),textTertiary:r("--theme-text-tertiary",ut[e].textTertiary),accent:r("--theme-accent-primary",ut[e].accent),accentHover:r("--theme-accent-hover",ut[e].accentHover),accentLight:r("--theme-accent-primary",ut[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ut[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ut[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ut[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ut[e].dependency),dependencyHover:r("--theme-border-secondary",ut[e].dependencyHover),criticalPath:r("--theme-error",ut[e].criticalPath),criticalPathLight:r("--theme-error",ut[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ut[e].today):e==="neutral"?r("--theme-text-primary",ut[e].today):r("--theme-error",ut[e].today),todayLight:e==="light"?r("--theme-accent-primary",ut[e].todayLight):e==="neutral"?r("--theme-text-primary",ut[e].todayLight):r("--theme-error",ut[e].todayLight),milestone:r("--theme-warning",ut[e].milestone),milestoneLight:r("--theme-warning",ut[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ut[e].statusTodo),statusInProgress:r("--theme-accent-primary",ut[e].statusInProgress),statusCompleted:r("--theme-success",ut[e].statusCompleted),hoverBg:r("--theme-bg-hover",ut[e].hoverBg),focusRing:r("--theme-accent-primary",ut[e].focusRing),...ut[e].dotGrid&&{dotGrid:ut[e].dotGrid},...ut[e].glassHeader&&{glassHeader:ut[e].glassHeader},...ut[e].glassToolbar&&{glassToolbar:ut[e].glassToolbar},...ut[e].forecastHud&&{forecastHud:ut[e].forecastHud},...ut[e].neonRedGlow&&{neonRedGlow:ut[e].neonRedGlow},...ut[e].executionBarBg&&{executionBarBg:ut[e].executionBarBg}}}var gi={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"}},Up={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"}},hd={en:gi,es:Up};function Wp(e){return hd[e]||hd.en}function yd(e,t){let a=Wp(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 Sn=createContext(gi);function Br(){return useContext(Sn)}function ds(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(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Jp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[i,c]=useState(false),[l,m]=useState(null),d=useRef(null),p=useRef(null),g=Br(),y=ds(d,i,"right",176);if(useEffect(()=>{if(!i)return;let b=v=>{let C=v.target;d.current&&!d.current.contains(C)&&p.current&&!p.current.contains(C)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[i]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(b=>b.handler),f=async(b,v)=>{if(v){m(b);try{await v();}catch(C){console.error(`Export ${b} failed:`,C);}finally{m(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#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:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:i&&jsx(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:h.map((b,v)=>jsxs(motion.button,{onClick:()=>f(b.id,b.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===b.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"})}):b.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})}),document.body)]})}function Vp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=useState(false),[c,l]=useState(null),[m,d]=useState(false),p=useRef(null),g=useRef(null),y=Br(),x=ds(p,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let N=T=>{let k=T.target;p.current&&!p.current.contains(k)&&g.current&&!g.current.contains(k)&&i(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[n]);let b=[{id:"png",label:y.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(N=>N.handler),v=async(N,T)=>{if(T){l(N);try{await T();}catch(k){console.error(`Export ${N} failed:`,k);}finally{l(null),i(false);}}},C=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>i(!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:y.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:x.top,left:x.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[b.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:b.map((N,T)=>jsxs(motion.button,{onClick:()=>v(N.id,N.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:T*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===N.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"})}):N.icon}),jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),b.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:C,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:m?"rgba(34,197,94,0.15)":e.accentLight,color:m?"#22C55E":e.accent},children:m?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:m?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Ix({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 Bx({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 _p({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),i=useRef(null),c=Br(),l=ds(n,o,"left");useEffect(()=>{if(!o)return;let p=g=>{let y=g.target;n.current&&!n.current.contains(y)&&i.current&&!i.current.contains(y)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let m=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.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:`${c.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:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:m.map((p,g)=>{let y=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:y?e.accentLight:"transparent",borderBottom:g<m.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?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:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:p.label}),y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function jp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),i=useRef(null),c=useRef(null),l=Br(),m=ds(i,s,"left");useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;i.current&&!i.current.contains(b)&&c.current&&!c.current.contains(b)&&n(false);},h=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],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:i,onClick:y=>{y.stopPropagation(),n(x=>!x);},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:l.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:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:m.top,left:m.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?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"}):y.icon;return jsxs(motion.button,{onClick:()=>{a(y.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:x?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:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Rx({value:e,onChange:t,theme:a}){let r=Br(),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 i=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:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?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 Ox({theme:e,forecast:t}){let a=Br(),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,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,m=l!=null?l>=75?"#22C55E":l>=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",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<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&&i&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),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:m,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&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:h})]})]})]})}function $x({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:m,hasDependencies:d=true}){let[p,g]=useState(false),y=useRef(null),x=useRef(null),h=Br(),f=ds(y,p,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let T=k=>{let w=k.target;y.current&&!y.current.contains(w)&&x.current&&!x.current.contains(w)&&g(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[p]);let v=h.toolbar.visibility==="Visibilidad",C=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],N=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:y,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:h.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:x,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:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:C.map((T,k)=>{let w=T.icon,E=T.disabled,I=T.tooltip;return jsxs(motion.button,{onClick:()=>!E&&T.onChange?.(!T.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:E?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:E?"not-allowed":"pointer"},whileHover:E?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},title:I,children:[jsx(w,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:E?b?"rgba(255,255,255,0.2)":"#D1D5DB":T.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:T.label}),T.active&&!E&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((T,k)=>{let w=l===T.value;return jsxs(motion.button,{onClick:()=>m(T.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(C.length+k)*.03},children:[jsx("span",{style:{color:w?e.accent||"#2E94FF":b?"rgba(255,255,255,0.85)":e.textPrimary},children:T.label}),w&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.value)})]})]})}),document.body)]})}function fi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:f,wbsLevel:b,onWbsLevelChange:v,maxWbsDepth:C=4,viewMode:N="execution",onViewModeChange:T,projectForecast:k,onExportPNG:w,onExportPDF:E,onExportExcel:I,onExportCSV:D,onExportJSON:X,onExportMSProject:O,showCriticalPath:H=true,onShowCriticalPathChange:F,showDependencies:q=true,onShowDependenciesChange:ee,highlightWeekends:Se=true,onHighlightWeekendsChange:R,showBaseline:j=false,onShowBaselineChange:be,onCopySnapshotLink:Je,hasDependencies:z=true}){let re=Br(),J=w||E||I||D||X||O,Fe=!!e.glassToolbar,[he,Ue]=useState(false),Be=useRef(null);useEffect(()=>{he&&Be.current&&Be.current.focus();},[he]);let nt=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.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"})}],st=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Fe){let oe=st?"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:st?"#1A1A1A":e.bgSecondary,border:`1px solid ${st?"rgba(255,255,255,0.08)":e.border}`},animate:{width:he?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Ue(!he),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"})}),he&&jsx("input",{ref:Be,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:()=>Ue(false),onKeyDown:rt=>{rt.key==="Escape"&&Ue(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:oe}}),T&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:st?"#000000":e.bgSecondary,border:`1px solid ${st?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>T("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?st?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:re.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>T("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?st?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:N==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:re.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Rx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:oe}}),v&&jsx(_p,{theme:e,value:b??"all",onChange:v,maxDepth:C}),y&&jsx(jp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:oe}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:oe}}),jsx($x,{theme:e,showCriticalPath:H,onShowCriticalPathChange:F,showBaseline:j,onShowBaselineChange:be,highlightWeekends:Se,onHighlightWeekendsChange:R,showDependencies:q,onShowDependenciesChange:ee,rowDensity:i,onRowDensityChange:c,hasDependencies:z}),jsx(Vp,{theme:e,onExportPNG:w,onExportPDF:E,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Je}),m&&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 ${st?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${st?"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||re.toolbar.createTask})]})]})]}),k&&jsx(Ox,{theme:e,forecast:k})]})}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(Bx,{options:nt,value:t,onChange:oe=>a(oe),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}}),v&&jsx(_p,{theme:e,value:b??"all",onChange:v,maxDepth:C}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(jp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),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}})]}),m&&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||re.toolbar.createTask})]}),(J||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Vp,{theme:e,onExportPNG:w,onExportPDF:E,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Je}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsx(Ix,{options:Z,value:s,onChange:oe=>n(oe),theme:e})]})]})}function bi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),i=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let m=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let l=e.filter(m=>m.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let m=c.current.getBoundingClientRect();n({x:m.left,y:m.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(Xt,{children:jsx(motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(m=>jsxs("button",{onClick:()=>{t(m.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:m.label}),m.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Mn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,p=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+m+p>g&&(x=t-m,x<p&&(x=p)),a+d+p>y&&(h=y-d-p,h<p&&(h=p)),c({x,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let m=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m: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:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(m=>jsxs("div",{children:[m.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var da={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 om({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:p=true}){let g=useRef(false),y=useCallback(v=>{g.current=v;},[]),x=useCallback(v=>{let C=[],N=T=>{for(let k of T)C.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&N(k.subtasks);};return N(v),C},[]),h=useCallback(()=>{let v=x(e);for(let C of v)if(t.has(C.id))return C;return null},[e,t,x]),f=useCallback((v,C)=>{let N=x(e);if(N.length===0)return;let T=h();if(!T){a(N[0].id,false);return}let k=N.findIndex(I=>I.id===T.id);if(k===-1)return;let w=v==="up"?k-1:k+1;if(w<0||w>=N.length)return;let E=N[w];a(E.id,C);},[e,h,x,a]),b=useCallback(v=>{if(!p)return;let C=v.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||g.current){v.key==="Escape"&&(C.blur(),g.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,w=Array.from(t),E=h();if(v.key==="ArrowUp"){v.preventDefault(),f("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),f("down",v.shiftKey);return}if(E&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){E.subtasks&&E.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!E.isExpanded||v.key==="ArrowLeft"&&E.isExpanded)&&m(E.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){w.length>0&&(v.preventDefault(),n(w,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){w.length>0&&(v.preventDefault(),i(w));return}if(v.key==="Tab"&&v.shiftKey){w.length>0&&(v.preventDefault(),c(w));return}if(v.key==="Enter"&&!v.shiftKey&&!k){E&&(v.preventDefault(),r(E.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!k){E&&(v.preventDefault(),r(E.id,"above"));return}if(v.key==="Enter"&&k){E&&(v.preventDefault(),d(E.id));return}if(v.key==="F2"){E&&(v.preventDefault(),l(E.id));return}if(v.key==="Delete"||v.key==="Backspace"&&k){w.length>0&&(v.preventDefault(),o(w));return}if(v.key==="d"&&k&&!v.shiftKey){w.length>0&&(v.preventDefault(),s(w));return}},[p,t,h,f,r,o,s,n,i,c,l,m,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[p,b]),{setIsEditing:y}}function sm(){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),y=p.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=p.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),i=useCallback((d,p,g,y)=>{y?n(d,p):g?s(d):o(d);},[o,s,n]),c=useCallback((d,p)=>{p?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:m}}function Cd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Cd(t.subtasks):t.subtasks}))}function Fn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function hi(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=hi(a.subtasks,t);if(r)return r}}return null}function kd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=kd(a.subtasks,t);if(r)return r}return null}function Td(e,t){if(t.length===0)return e;let a=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 y=[];return {tasks:p.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let f=n(h.subtasks,g);h.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},i=(p,g,y)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:i(x.subtasks,g,y)}:x),c=new Set(t),{tasks:l,removed:m}=n(e,c),d=i(l,s.id,m);return Cd(d)}function Nd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=kd(a,r);if(!o)continue;let s=kd(a,o.id),n=(l,m,d)=>{for(let p=0;p<l.length;p++){let g=l[p];if(g.id===m&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,m,d);if(y)return y}}return null},i=(l,m,d)=>{let p=l.findIndex(g=>g.id===m);if(p!==-1)return l.splice(p+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,m,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return Cd(a)}function Dd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let m=c==="up"?l-1:l+1;return m<0||m>=n.length?false:([n[l],n[m]]=[n[m],n[l]],n[l]={...n[l],position:l},n[m]={...n[m],position:m},true)};return s(r,o,a),r}function Sd(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 us(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((m,d)=>({...m,id:`${m.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let m=c[l],d=`${m.id}-copy-${Date.now()}`,p={...m,id:d,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks,d):void 0};return c.splice(l+1,0,p),p},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function im(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"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let m=a==="above"?l:l+1;return c.splice(m,0,n),true};return i(r),{tasks:r,newTask:n}}function Ed(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ed(r.subtasks,t,a)}:r)}function Md(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Md(a.subtasks,t)}:a)}function Fd(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,i=r?.endDate||s,c=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},l=c(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=p=>p.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,m],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:m}}function lm(e,t,a,r){if(t===a)return e;let o=hi(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===l||i(m,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(m=>m.id!==t),l=c.length<i.length;return c.map((m,d)=>{let p=l?{...m,position:d}:m;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let m=l.subtasks||[],d=r!==void 0?r:m.length,p=[...m];p.splice(d,0,{...o,parentId:a});let g=p.map((y,x)=>({...y,position:x}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function Rr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Rr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{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((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function xi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:m,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:b,onTaskCreate:v,onTaskRename:C,onCreateSubtask:N,onOpenTaskModal:T,onDeleteRequest:k,onTaskReparent:w,scrollContainerRef:E,showCriticalPath:I=false}){let D=useContext(Sn),[X,O]=useState(null),[H,F]=useState(null),[q,ee]=useState(""),Se=useRef(null),[R,j]=useState(null),[be,Je]=useState(0),[z,re]=useState(0),[J,Fe]=useState({isOpen:false,x:0,y:0,type:"header"}),[he,Ue]=useState(null),[Be,nt]=useState(null),[Z,st]=useState(null),oe=useRef(0),rt=5,ht=useRef(false),[Mt,ke]=useState(null),[yt,dt]=useState(false),at=useRef(null),[$,de]=useState(null),[S,Y]=useState(false),le=useRef(null);useEffect(()=>{function se(fe){le.current&&!le.current.contains(fe.target)&&Y(false);}if(S)return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[S]),useEffect(()=>{H&&Se.current&&(Se.current.focus(),Se.current.select());},[H]),useEffect(()=>{if(!R)return;let se=L=>{let _=L.clientX-be,K=z+_;p?.(R,K);},fe=()=>{j(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[R,be,z,p]);let{selectedTaskIds:we,handleTaskClick:W,isTaskSelected:te}=sm(),{setIsEditing:We}=om({tasks:e,selectedTaskIds:we,onTaskSelect:(se,fe)=>{let _=Fn(e).map(K=>K.id);W(se,_,fe||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:se=>{let fe=Fn(e).find(L=>L.id===se);fe&&mt(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:se=>{let fe=Fn(e).find(L=>L.id===se);fe&&T&&T(fe);},enableKeyboard:true}),Ce=(se,fe=0,L="")=>{let _=[],K=[...se].sort((ue,Me)=>(ue.position??0)-(Me.position??0));for(let ue=0;ue<K.length;ue++){let Me=K[ue],Ke=ue+1,je=L?`${L}.${Ke}`:`${Ke}.0`;if(Me.wbsCode=je,_.push({task:Me,level:fe}),Me.subtasks&&Me.subtasks.length>0&&Me.isExpanded){let Le=L?`${L}.${Ke}`:`${Ke}`;_.push(...Ce(Me.subtasks,fe+1,Le));}}return _},He=Ce(e),Ne=48,_e=Math.max(He.length*a,600-Ne),wt=se=>!se.startDate||!se.endDate?"-":`${Math.ceil((se.endDate.getTime()-se.startDate.getTime())/(1e3*60*60*24))}d`,mt=se=>{F(se.id),ee(se.name),We(true);},ot=se=>{q.trim()&&q!==e.find(fe=>fe.id===se)?.name&&C?.(se,q.trim()),F(null),ee(""),We(false);},et=()=>{F(null),ee(""),We(false);},Yt=(se,fe)=>{fe.stopPropagation(),N?.(se.id);},Ft=(se,fe)=>{fe.preventDefault(),oe.current=fe.clientY,Ue(se),ht.current=false,dt(false),ke({x:fe.clientX,y:fe.clientY});},xt=se=>{if(!he||(Math.abs(se.clientY-oe.current)>rt&&!ht.current&&(ht.current=true,dt(true)),ke({x:se.clientX,y:se.clientY}),!ht.current))return;if(E?.current){let ue=E.current,Me=ue.getBoundingClientRect(),Ke=60,je=12;at.current&&(cancelAnimationFrame(at.current),at.current=null);let Le=se.clientY-Me.top,ft=Me.bottom-se.clientY;if(Le<Ke&&ue.scrollTop>0){let kt=Math.round(je*(1-Le/Ke)),Ht=()=>{ue.scrollTop-=kt,ht.current&&ue.scrollTop>0&&(at.current=requestAnimationFrame(Ht));};at.current=requestAnimationFrame(Ht);}else if(ft<Ke&&ue.scrollTop<ue.scrollHeight-ue.clientHeight){let kt=Math.round(je*(1-ft/Ke)),Ht=()=>{ue.scrollTop+=kt,ht.current&&ue.scrollTop<ue.scrollHeight-ue.clientHeight&&(at.current=requestAnimationFrame(Ht));};at.current=requestAnimationFrame(Ht);}}let L=document.querySelectorAll("[data-task-row]"),_=null,K=null;L.forEach(ue=>{let Me=ue.getBoundingClientRect(),Ke=ue.getAttribute("data-task-row");if(Ke&&Ke!==he&&se.clientY>=Me.top&&se.clientY<=Me.bottom){_=Ke;let je=se.clientY-Me.top,Le=Me.height;je<Le*.25?K="above":je>Le*.75?K="below":K="child";}}),nt(_),st(K);},Tt=()=>{if(ht.current&&he&&Be&&Z){if(Z==="child")w?.(he,Be);else if(Z==="above"||Z==="below"){let se=(K,ue,Me=null)=>{for(let Ke of K){if(Ke.id===ue)return Me;if(Ke.subtasks){let je=se(Ke.subtasks,ue,Ke.id);if(je!==void 0)return je}}},fe=se(e,he,null),L=se(e,Be,null),_=(K,ue,Me,Ke)=>{let je=K.findIndex(kt=>kt.id===ue),Le=Ke?K.findIndex(kt=>kt.id===Me):-1,ft=Z==="below"?je+1:je;return Ke&&Le!==-1&&Le<je&&(ft-=1),Math.max(0,ft)};if(L===null){let ue=_(e,Be,he,fe===null);w?.(he,null,ue);}else {let K=He.find(ue=>ue.task.id===L)?.task;if(K?.subtasks){let ue=fe===L,Me=_(K.subtasks,Be,he,ue);w?.(he,L,Me);}}}}at.current&&(cancelAnimationFrame(at.current),at.current=null),Ue(null),nt(null),st(null),ke(null),ht.current=false,dt(false);};useEffect(()=>{if(he)return document.addEventListener("mousemove",xt),document.addEventListener("mouseup",Tt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",xt),document.removeEventListener("mouseup",Tt),document.body.style.cursor="",document.body.style.userSelect="";}},[he,Be,Z]);let gt=(se,fe,L)=>{let _=fe.subtasks&&fe.subtasks.length>0;switch(se.id){case "name":let K=H===fe.id,ue=X===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${L*20}px`},children:[w&&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:ue?1:.3},onMouseDown:U=>Ft(fe.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),K?jsx("input",{ref:Se,type:"text",value:q,onChange:U=>ee(U.target.value),onKeyDown:U=>{U.key==="Enter"?ot(fe.id):U.key==="Escape"&&et();},onBlur:()=>ot(fe.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:U=>U.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),I&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),I&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),ue&&!K&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>Yt(fe,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(),mt(fe);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Ke=se.id==="startDate"?"startDate":"endDate",je=fe[Ke],Le=$?.taskId===fe.id&&$?.field===Ke,ft=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:_?.5:1,cursor:_?"default":"pointer"},title:_?"Auto-calculated from subtasks":void 0,onClick:U=>{if(!_)if(Le)de(null);else {let ne=U.currentTarget.getBoundingClientRect();de({taskId:fe.id,field:Ke,month:je?typeof je=="string"?new Date(je):je:new Date,position:{top:ne.bottom+4,left:ne.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:ft(je)}),_&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Le&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>de(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,ne=new Date(U);ne.setDate(U.getDate()+1);let Oe=new Date(U);Oe.setDate(U.getDate()+7);let A=new Date(U);return A.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:Oe},{label:"2 semanas",date:A}].map((Ve,tt)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:oa=>oa.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:oa=>oa.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Ke]:Ve.date}),de(null);},children:Ve.label},tt))})(),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?.(fe.id,{[Ke]:void 0}),de(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:()=>de(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:()=>de(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,ne)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},ne))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=$?.month||new Date,ne=U.getFullYear(),Oe=U.getMonth(),A=new Date(ne,Oe,1).getDay(),ge=new Date(ne,Oe+1,0).getDate(),Ve=new Date,tt=[];for(let Wt=A-1;Wt>=0;Wt--)tt.push({day:new Date(ne,Oe,-Wt).getDate(),date:new Date(ne,Oe-1,new Date(ne,Oe,-Wt).getDate()),isCurrentMonth:false});for(let Wt=1;Wt<=ge;Wt++)tt.push({day:Wt,date:new Date(ne,Oe,Wt),isCurrentMonth:true});let oa=42-tt.length;for(let Wt=1;Wt<=oa;Wt++)tt.push({day:Wt,date:new Date(ne,Oe+1,Wt),isCurrentMonth:false});return tt.map((Wt,ka)=>{let Ca=Wt.date.toDateString()===Ve.toDateString(),fa=(je?typeof je=="string"?new Date(je):je:null)?.toDateString()===Wt.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:Wt.isCurrentMonth?fa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:fa?"#2E94FF":"transparent",boxShadow:Ca&&!fa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[Ke]:Wt.date}),de(null);},children:Wt.day},ka)})})()})]})]})]}),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:wt(fe)})});case "assignees":if(_)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 kt=r.filter(U=>fe.assignees?.some(ne=>ne.name===U.name||ne.initials===U.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(jo,{assignedUsers:kt,availableUsers:r,onChange:U=>{let ne=U.map(Oe=>({id:Oe.id,name:Oe.name,initials:Oe.initials,color:Oe.color}));g?.(fe.id,{assignees:ne.length>0?ne:void 0});}})});case "status":if(_){let U=fe.progress===100?"\u2713":fe.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:U})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Fu,{status:fe.status||"todo",onChange:U=>{g?.(fe.id,{status:U,progress:U==="completed"?100:fe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${fe.progress}%`,backgroundColor:fe.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[fe.progress,"%"]})]});case "priority":let Ht={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},wa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ta=Ht[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Vo,{priority:ta,onChange:U=>{U&&g?.(fe.id,{priority:wa[U]||"medium"});}})});default:return null}},zt=se=>[{id:"hide",label:"Hide Column",icon:da.Hide,onClick:()=>d(se),disabled:se==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:da.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:da.SortDesc,onClick:()=>{}}],Re=se=>se.subtasks&&se.subtasks.length>0?[{id:"addSubtask",label:D?.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{N?.(se.id);}},{id:"duplicate",label:D?.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{b?.([se.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:D?.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{k?k(se.id,se.name):f?.([se.id]);}}]:[{id:"edit",label:D?.contextMenu?.editTask||"Edit Task",icon:da.Pencil,onClick:()=>{n?.(se);}},{id:"addSubtask",label:D?.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{N?.(se.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:D?.contextMenu?.markIncomplete||"Mark Incomplete",icon:da.MarkIncomplete,onClick:()=>{g?.(se.id,{status:"todo",progress:0});},disabled:se.status==="todo"},{id:"setInProgress",label:D?.contextMenu?.setInProgress||"Set In Progress",icon:da.SetInProgress,onClick:()=>{g?.(se.id,{status:"in-progress"});},disabled:se.status==="in-progress"},{id:"markComplete",label:D?.contextMenu?.markComplete||"Mark Complete",icon:da.MarkComplete,onClick:()=>{g?.(se.id,{status:"completed",progress:100});},disabled:se.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:D?.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{b?.([se.id]);}},{id:"split",label:D?.contextMenu?.splitTask||"Split Task",icon:da.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:D?.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{k?k(se.id,se.name):f?.([se.id]);}}],Ae=m.filter(se=>se.visible),ct=Ae.reduce((se,fe)=>se+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ct},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((se,fe)=>{let L=fe===Ae.length-1,_=se.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_?"":"justify-center"}`,style:{width:`${se.width}px`,minWidth:`${se.minWidth??(_?200:60)}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:_&&Ae.length===1?1:0,flexGrow:_&&Ae.length===1?1:0,borderRight:L?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:K=>{K.preventDefault(),Fe({isOpen:true,x:K.clientX,y:K.clientY,type:"header",columnId:se.id});},onMouseEnter:K=>{K.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:K=>{K.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:se.label,children:se.label}),se.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:R===se.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:K=>{K.preventDefault(),K.stopPropagation(),j(se.id),Je(K.clientX),re(se.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:R===se.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},se.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(bi,{columns:m,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>Y(!S),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"})}),S&&jsxs("div",{ref:le,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:se=>se.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>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:_e},children:He.map(({task:se,level:fe},L)=>{let _=te(se.id),K=Be===se.id,ue=K&&Z==="above",Me=K&&Z==="below",Ke=K&&Z==="child",je={};return Ke&&(je.backgroundColor=`${t.accent}15`,je.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":se.id,className:`flex items-center cursor-pointer group ${he===se.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:Ke?`${t.accent}15`:L%2===0?t.bgPrimary:t.bgGrid,opacity:I?se.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...je},onMouseEnter:()=>O(se.id),onMouseLeave:()=>O(null),onClick:Le=>{let kt=Fn(e).map(ta=>ta.id),wa=navigator.platform.toUpperCase().indexOf("MAC")>=0?Le.metaKey:Le.ctrlKey;W(se.id,kt,wa,Le.shiftKey),s?.(se);},onDoubleClick:Le=>{Le.stopPropagation(),n?.(se);},onContextMenu:Le=>{Le.preventDefault(),Fe({isOpen:true,x:Le.clientX,y:Le.clientY,type:"task",task:se}),i?.(se,Le);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[ue&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Me&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ae.map((Le,ft)=>{let kt=ft===Ae.length-1,Ht=Le.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ht?"justify-start":"justify-center"}`,style:{width:`${Le.width}px`,minWidth:`${Le.minWidth??(Ht?200:60)}px`,maxWidth:`${Le.maxWidth??2e3}px`,flexShrink:Ht&&Ae.length===1?1:0,flexGrow:Ht&&Ae.length===1?1:0,borderRight:kt?"none":`1px solid ${X===se.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:gt(Le,se,Ht?fe:0)},`${se.id}-${Le.id}`)})]},se.id)})}),jsx(Mn,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?zt(J.columnId):J.type==="task"&&J.task?Re(J.task):[],onClose:()=>Fe({...J,isOpen:false}),theme:t}),yt&&Mt&&he&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Mt.x+12,top:Mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=He.find(fe=>fe.task.id===he)?.task;return se?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:se.name})}):null})()}),document.body)]})}function mm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,i]=useState(e),[c,l]=useState(t),[m,d]=useState(null),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,v]=useState(0),[C,N]=useState(0),[T,k]=useState(null),[w,E]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:m,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:b,setDraggedSegmentStartX:v,segmentDragOffsetX:C,setSegmentDragOffsetX:N,hoveredSegmentIndex:T,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:E,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,F)=>{r("none"),d(null),g(null),i(H),l(F),N(0),f(null),v(0);}}}function ki({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:m,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:v=false}){let C=mm(t,r),N=useRef(null),T=useRef(false),k=useRef(null),w=useRef(null),{dragMode:E,setDragMode:I,dragOffset:D,setDragOffset:X,ghostX:O,setGhostX:H,ghostWidth:F,setGhostWidth:q,connectionLine:ee,setConnectionLine:Se,hoveredTaskId:R,setHoveredTaskId:j,activeZone:be,setActiveZone:Je,draggedSegmentIndex:z,setDraggedSegmentIndex:re,draggedSegmentStartX:J,setDraggedSegmentStartX:Fe,segmentDragOffsetX:he,setSegmentDragOffsetX:Ue,hoveredSegmentIndex:Be,setHoveredSegmentIndex:nt,isHovered:Z,setIsHovered:st,isDragging:oe,isResizing:rt,isConnecting:ht,resetDragState:Mt}=C,ke=18,yt=!!o.executionBarBg,dt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",at=yt?3:6,$=e.subtasks&&e.subtasks.length>0,de=e.endDate&&(()=>{let L=new Date;L.setHours(0,0,0,0);let _=new Date(e.endDate);return _.setHours(0,0,0,0),_<L})()&&e.progress<100,S=b&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",le=e.status==="completed"||e.progress===100,we={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=b&&e.isCriticalPath||de?"#EF4444":e.color?e.color:e.priority&&we[e.priority]?we[e.priority]:o.taskBarPrimary,We=v?"default":oe?ht?"crosshair":rt?"ew-resize":"grabbing":"grab",Ce=v?"default":"ew-resize",Ne=(L=>L>=80?20:L>=60?15:L>=50?12:10)(r),_e=r<50,wt=r<40;useEffect(()=>{x&&(!Z||oe||e.segments)&&x(null);},[Z,oe,e.segments,x]);let mt=L=>L.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ot=()=>{let L=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${L} day${L!==1?"s":""}`},et=L=>Math.round(L/s)*s,Yt=L=>{let _=Math.round(L/s),K=new Date(n);return K.setDate(K.getDate()+_),K},Ft=(L,_)=>{for(let K of g){if(K.id===e.id)continue;let ue=5;if(L>=K.x-ue&&L<=K.x+K.width+ue&&_>=K.y-ue&&_<=K.y+K.height+ue)return K.id}return null},xt=useCallback((L,_,K)=>{if(v)return;L.preventDefault(),L.stopPropagation();let ue=N.current?.ownerSVGElement;if(!ue)return;let Me=ue.createSVGPoint();Me.x=L.clientX,Me.y=L.clientY;let Ke=Me.matrixTransform(ue.getScreenCTM()?.inverse()),je=K!==void 0?K:t,Le=_;if(!Le){let ft=Ke.x-je;L.shiftKey?(Le="connect",Se({x:t+r,y:a+ke/2})):L.ctrlKey||L.metaKey?Le="move":L.altKey?Le=ft<r/2?"resize-start":"resize-end":wt?ft<r/2?Le="move":Le="resize-end":_e?ft<=Ne/2?Le="resize-start":ft>=r-Ne/2?Le="resize-end":Le="move":ft<=Ne?Le="resize-start":ft>=r-Ne?Le="resize-end":Le="move";}T.current=false,I(Le),st(false),Je(null),Le==="move"?X(Ke.x-je):Le==="connect"?Se({x:t+r,y:a+ke/2}):X(0),H(je),q(r);},[t,r,a,ke,v]),Tt=useCallback(L=>{let _=N.current?.ownerSVGElement;if(!_)return;let K=_.closest(".gantt-timeline-scroll");if(!K)return;let ue=K.getBoundingClientRect(),Me=60,Ke=15,je=0;if(L.clientX<ue.left+Me){let Le=ue.left+Me-L.clientX;je=-Math.min(Ke,Le/2);}else if(L.clientX>ue.right-Me){let Le=L.clientX-(ue.right-Me);je=Math.min(Ke,Le/2);}return je!==0&&(K.scrollLeft+=je),je!==0},[]),gt=useCallback(L=>{if(E==="none")return;T.current=true,w.current=L;let _=N.current?.ownerSVGElement;if(!_)return;if(E==="move"||E==="resize-start"||E==="resize-end"){let Me=Tt(L);Me&&!k.current?k.current=window.setInterval(()=>{w.current&&(Tt(w.current),gt(w.current));},16):!Me&&k.current&&(window.clearInterval(k.current),k.current=null);}let K=_.createSVGPoint();K.x=L.clientX,K.y=L.clientY;let ue=K.matrixTransform(_.getScreenCTM()?.inverse());if(E==="connect"){Se({x:ue.x,y:ue.y});let Me=Ft(ue.x,ue.y);j(Me);}else if(E==="move"){let Me=ue.x-D,Ke=et(Me);H(Ke),q(r);let je=Math.round((Ke-t)/s);if(y?.(e.id,je,true),e.segments&&e.segments.length>0&&z!==null){let Le=Ke-J;Ue(Le);}}else if(E==="resize-start"){let Me=ue.x,Ke=et(Me),je=t+r-Ke;je>=s&&(H(Ke),q(je));}else if(E==="resize-end"){let Me=ue.x,je=et(Me)-t;je>=s&&q(je);}},[E,t,r,s,D,e,et,z,J,Ft,j,Se,H,q,Ue,y,Tt]),zt=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),w.current=null,E!=="none"){if(E==="connect")R&&p&&p(e,R),Se(null),j(null);else {let L=e.endDate.getTime()-e.startDate.getTime(),_,K,ue=true;if(E==="move"){if(_=Yt(O),K=new Date(_.getTime()+L),e.segments&&e.segments.length>0&&z!==null){let Me=Math.round(he/s),Ke=e.segments.map((kt,Ht)=>{if(Ht===z){let wa=new Date(kt.startDate),ta=new Date(kt.endDate);return wa.setDate(wa.getDate()+Me),ta.setDate(ta.getDate()+Me),{startDate:wa,endDate:ta}}return kt}),je=Ke.flatMap(kt=>[kt.startDate,kt.endDate]),Le=new Date(Math.min(...je.map(kt=>kt.getTime()))),ft=new Date(Math.max(...je.map(kt=>kt.getTime())));d?.({...e,segments:Ke},Le,ft),Mt(t,r);return}}else E==="resize-start"?(_=Yt(O),K=e.endDate,_>K&&(console.warn("Invalid date range: start date must be before or equal to end date"),ue=false)):E==="resize-end"?(_=e.startDate,K=Yt(O+F),K.setDate(K.getDate()-1),K<_&&(console.warn("Invalid date range: end date must be after or equal to start date"),ue=false)):ue=false;ue&&_&&K&&(K.getTime()<_.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,_,K));}y?.(e.id,0,false),Mt(t,r);}},[E,O,F,e,d,R,p,t,r,s,Yt,he,z,Mt,y]);useEffect(()=>{if(E==="none")return;let L=K=>{gt(K);},_=()=>{zt();};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",_),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",_),k.current&&(window.clearInterval(k.current),k.current=null);}},[E,gt,zt]);let Re=oe&&!ht?O:t,Ae=oe&&!ht?F:r,ct=i.taskClass(e),se=24,fe=b?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:N,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!oe&&!T.current&&c?.(e),T.current=false;},onDoubleClick:L=>{!oe&&!T.current&&(L.stopPropagation(),l?.(e));},onContextMenu:L=>{L.preventDefault(),m?.(e,L);},onMouseEnter:()=>!oe&&st(true),onMouseMove:L=>{x&&Z&&!oe&&!e.segments&&x({task:e,x:t,y:a,width:r,height:ke,showBelow:false,mouseX:L.clientX,mouseY:L.clientY});},onMouseLeave:()=>{oe||(st(false),Je(null));},children:[jsx("rect",{x:t,y:a,width:r+se,height:ke,fill:"transparent",style:{pointerEvents:"all"}}),Z&&!oe&&!_e&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ne,height:ke,fill:be==="resize-start"?o.accent:"transparent",opacity:be==="resize-start"?.15:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Je("resize-start"),onMouseDown:L=>xt(L,"resize-start")}),jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:ke,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Je("move"),onMouseDown:L=>xt(L,"move")}),jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:ke,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.15:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Je("resize-end"),onMouseDown:L=>xt(L,"resize-end")})]}),Z&&!oe&&wt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ke,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Je("move"),onMouseDown:L=>xt(L,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ke,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.2:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Je("resize-end"),onMouseDown:L=>xt(L,"resize-end")}),Z&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ke-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),oe&&!ht&&!e.segments&&jsx(motion.rect,{x:O,y:a,width:F,height:ke,rx:at,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"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!oe&&(()=>{let L=e.baselineStartDate.getTime(),_=e.baselineEndDate.getTime(),K=n.getTime(),ue=864e5,Me=(L-K)/ue,Ke=(_-L)/ue,je=Me*s,Le=Math.max(Ke*s,s),ft=Re+Ae,kt=je+Le,Ht=e.endDate?.getTime()??0,wa=Math.ceil((Ht-_)/ue),ta=wa>0,U=wa<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:je,y:a,width:Le,height:ke,rx:at,fill:"none",stroke:dt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ta&&ft>kt&&jsx("rect",{x:kt,y:a,width:ft-kt,height:ke,rx:0,fill:"#EF4444",opacity:.2}),ta&&jsxs("text",{x:Math.max(ft,kt)+6,y:a+ke/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",wa,"d"]}),U&&jsxs("text",{x:ft+6,y:a+ke/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[wa,"d"]})]})})(),!e.segments&&yt&&$&&(()=>{let _=a+(ke-8)/2,K=4,ue=e.progress||0,Me=new Date;Me.setHours(0,0,0,0);let Ke=e.startDate&&Me>=e.startDate,je=e.endDate&&(()=>{let ta=new Date(e.endDate);return ta.setHours(0,0,0,0),Me>ta})(),Le=e.startDate&&Me<e.startDate,ft=1;if(Ke&&e.startDate&&e.endDate&&!Le){let ta=new Date(e.startDate);ta.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let ne=Math.max(1,(U.getTime()-ta.getTime())/(1e3*60*60*24)),A=Math.min((Me.getTime()-ta.getTime())/(1e3*60*60*24),ne)/ne*100;ft=A>0?ue/A:1;}let kt;ue>=100?kt="#00E5CC":Le?kt="#4B5563":je&&ue<100?kt="#EF4444":ft>=.95?kt="#22C55E":ft>=.8?kt="#F59E0B":kt="#EF4444";let Ht=Math.max(ue/100*Ae,ue>0?K*2:0),wa=Ae>100&&ue>0;return jsxs("g",{"data-task-class":ct,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Re,y:_,width:Ae,height:8,rx:K,fill:"rgba(255,255,255,0.10)"}),ue>0&&jsx("rect",{x:Re,y:_,width:Ht,height:8,rx:K,fill:kt}),wa&&jsxs("text",{x:Re+Ht+6,y:_+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(ue),"%"]})]})})(),!e.segments&&yt&&!$&&jsx(motion.rect,{x:Re,y:a,width:Ae,height:ke,rx:at,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ct,initial:{opacity:0,scale:.95},animate:{opacity:oe&&!ht?.15:e.parentId?.6:1,scale:Z&&!oe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:L=>xt(L),style:{cursor:We,pointerEvents:"all"}}),!e.segments&&!yt&&jsx(motion.rect,{x:Re,y:a,width:Ae,height:ke,rx:at,fill:te,"data-task-class":ct,initial:{opacity:0,scale:.95},animate:{opacity:oe&&!ht?.15:e.parentId?.6:Z?.9:.8,scale:Z&&!oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:$?void 0:L=>xt(L),style:{cursor:$?"default":We,pointerEvents:"all"}}),yt&&(de||S)&&!e.segments&&jsx("rect",{x:Re,y:a,width:Ae,height:ke,rx:at,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),at*2),height:ke,rx:at,fill:te,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!$&&e.progress<100&&(()=>{let L=e.progress>0?Ae*(e.progress/100):0,_=Re+L,K=Ae-L,ue=e.progress===0?at:0,Me=e.progress===0?Re:_,Ke=e.progress===0?Ae:K;return jsxs(Fragment,{children:[jsx("rect",{x:Me,y:a,width:Ke,height:ke,rx:ue,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Me,y:a,width:Ke,height:ke,rx:ue,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),yt&&!e.segments&&e.progress>0&&e.progress<100&&!$&&!oe&&(()=>{let L=Re+Ae*(e.progress/100),_=8,K=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:L,cy:a+ke/2,r:_,fill:K?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:L,y:a+ke/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:K?.initials||K?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((L,_)=>{let K=(L.startDate.getTime()-n.getTime())/864e5*s,Me=(L.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-K+s,Ke=oe&&E==="move"&&z===_,je=Be===_,Le=Ke?K+he:K;return jsxs("g",{onMouseEnter:()=>!oe&&nt(_),onMouseLeave:()=>!oe&&nt(null),children:[jsx(motion.rect,{x:Le,y:a,width:Me,height:ke,rx:at,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:Ke||e.parentId?.6:je?.9:.8,scale:je&&!oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ft=>{ft.stopPropagation(),re(_),Fe(K),xt(ft,void 0,K);},style:{cursor:We,pointerEvents:"all"}}),jsx("rect",{x:Le,y:a,width:Me*(e.progress/100),height:ke,rx:at,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${_}`)}),Y&&(de||S)&&!e.segments&&jsxs(Fragment,{children:[S&&!de&&jsx("rect",{x:Re,y:a,width:Ae,height:ke,rx:at,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),de&&jsx("rect",{x:Re,y:a,width:Ae,height:ke,rx:at,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Ae>60&&!e.segments&&!(yt&&$)&&(()=>{let L=i.taskLabel(e),_=typeof L=="string"?L:e.name,K=_.length>Math.floor(Ae/8)?`${_.substring(0,Math.floor(Ae/8))}...`:_;return jsx("text",{x:Re+8,y:a+ke/2,dominantBaseline:"middle",fill:le?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:le?"line-through":"none"},children:K})})(),!oe&&!e.segments&&!$&&e.progress>0&&e.progress<100&&(yt?jsxs("text",{x:Re+Ae+6,y:a+ke/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+ke/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&&!oe&&!e.segments&&!(yt&&$)&&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||rt)&&!ht&&!e.segments&&!$&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Re-2,y:a,width:16,height:ke,fill:"transparent",style:{cursor:Ce},onMouseEnter:()=>Je("resize-start"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),xt(L,"resize-start");}}),jsx(motion.rect,{x:Re+4,y:a+8,width:3,height:ke-16,rx:1.5,fill:be==="resize-start"||E==="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:ke,fill:"transparent",style:{cursor:Ce},onMouseEnter:()=>Je("resize-end"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),xt(L,"resize-end");}}),jsx(motion.rect,{x:Re+Ae-7,y:a+8,width:3,height:ke-16,rx:1.5,fill:be==="resize-end"||E==="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&&!oe&&!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+ke/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Je("connect"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),xt(L,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ke/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:be==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ht&&ee&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ke/2,x2:ee.x,y2:ee.y,stroke:R?o.statusCompleted:o.accent,strokeWidth:R?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:R?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:ee.x,cy:ee.y,r:R?8:6,fill:R?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),R&&jsx(motion.text,{x:ee.x+15,y:ee.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ee.x+10},animate:{opacity:1,x:ee.x+15},transition:{duration:.2},children:"Connect"})]}),(Z||oe)&&!ht&&!e.segments&&jsx(motion.rect,{x:Re-1,y:a-1,width:Ae+2,height:ke+2,rx:at+1,fill:"none",stroke:oe?o.accent:yt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:yt?1:2,opacity:oe||yt?.6:.4,initial:{opacity:0},animate:{opacity:oe||yt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),rt&&jsxs(Fragment,{children:[jsx("line",{x1:O,y1:0,x2:O,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:O+F,y1:0,x2:O+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Z&&!oe&&!e.segments&&!x&&(()=>{let K=a<100,ue=K?a+ke+13:a-82-13,Me=K?`M ${Re+Ae/2-6} ${a+ke+3} L ${Re+Ae/2} ${a+ke+13} L ${Re+Ae/2+6} ${a+ke+3}`:`M ${Re+Ae/2-6} ${a-13} L ${Re+Ae/2} ${a-3} L ${Re+Ae/2+6} ${a-13}`,Ke=ue+22,je=ue+40,Le=ue+55,ft=ue+70,kt=K?ue+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:K?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:K?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Me,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Re+Ae/2-120,y:ue,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:Ke,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:je,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Re+Ae/2-70,y:je,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.startDate)}),jsx("text",{x:Re+Ae/2-110,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Re+Ae/2-70,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.endDate)}),jsx("text",{x:Re+Ae/2+10,y:je,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Re+Ae/2+65,y:je,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ot()}),jsx("text",{x:Re+Ae/2+10,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Re+Ae/2+65,y:Le,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:ft,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Re+Ae/2-50,y:ft,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ht=>Ht.name).join(", ").substring(0,30),e.assignees.map(Ht=>Ht.name).join(", ").length>30?"...":""]})]}),!K&&jsx("text",{x:Re+Ae/2,y:kt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:wt?"Left: move \u2022 Right: resize":_e?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Pd=260,Pn=8,bm=16,Nv=-12;function hm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:b,mouseX:v,mouseY:C}=e,T=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null?155:105,k=v+bm,w=C+Nv-T;k+Pd>window.innerWidth-Pn&&(k=v-Pd-bm),k<Pn&&(k=Pn);let E=w<Pn;E&&(w=C+20),w+T>window.innerHeight-Pn&&(w=window.innerHeight-Pn-T),o({left:k,top:w,showBelow:E});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={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"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let b=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${b} d\xEDa${b!==1?"s":""}`:`${b} day${b!==1?"s":""}`},m=b=>{if(b==null||b===0)return "N/A";let v=Math.floor(b/60),C=b%60;return v===0?`${C}m`:C===0?`${v}h`:`${v}h ${C}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Pd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:x,border:`1px solid ${h}`,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(Ci,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:p}),jsx(Ci,{label:i.duration,value:l(),labelColor:d,valueColor:p}),jsx(Ci,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:p}),jsx(Ci,{label:i.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:[i.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:s.assignees.map(b=>b.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:[i.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsx("span",{style:{color:y,fontWeight:600},children:m(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function dd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,m)=>{let d=m.category||"Other";return l[d]||(l[d]=[]),l[d].push(m),l},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,m])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsx("div",{children:m.map(d=>jsxs("button",{onClick:()=>i(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))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ud({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=useState("export"),[c,l]=useState("json"),[m,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await iu(e,c,x);lu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await uu(h),b=h.name.endsWith(".json")?"json":"csv",w=cu(f,b);d(w),w.success&&r&&r(w,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:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxs("button",{onClick:()=>l(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"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:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),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:y,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"})]})]}),m&&jsxs("div",{className:u("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:u("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:m.errors.map((x,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Qy=["URGENT","HIGH","MEDIUM","LOW"],Zy=[{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"}],ex=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function pd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:m=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=useState(true),f=useCallback(T=>{a({search:T.target.value});},[a]),b=useCallback(T=>{a({dateFilter:T.target.value});},[a]),w=useCallback(T=>{r({by:T.target.value});},[r]),C=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=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":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"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"}),N&&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)"]})]}),!x&&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"}),i&&jsx("button",{onClick:i,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:b,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:T=>{let k=T.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Qy.map(T=>jsx("option",{value:T,children:T},T))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:T=>{let k=T.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(T=>jsx("option",{value:T.id,children:T.name},T.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:T=>{let k=T.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(T=>jsx("option",{value:T,children:T},T))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Zy.map(T=>jsx("option",{value:T.value,children:T.label},T.value))}),t.by!=="none"&&jsx("button",{onClick:C,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:T=>y(T.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ex.map(T=>jsx("option",{value:T.value,children:T.label},T.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function md({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,m]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let p=g=>{g(),m(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>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 i?.()),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(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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 gd={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"}},fd={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"}},bd={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"}},en={dark:gd,light:fd,neutral:bd},mi="dark";var gi=createContext(void 0),cx="asakaa-theme";function Hp({children:e,defaultTheme:t=mi,storageKey:a=cx}){let[r,o]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=en[r];Object.entries(c.colors).forEach(([m,d])=>{d&&i.style.setProperty(`--theme-${ux(m)}`,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(([m,d])=>{let p=c.colors[m];p&&i.style.setProperty(d,p);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:en};return jsx(gi.Provider,{value:n,children:e})}function Sn(){let e=useContext(gi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ux(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function hd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Sn();return e?jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(en).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function zp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ut[e]||ut.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ut[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ut[e].bgSecondary),bgGrid:r("--theme-bg-card",ut[e].bgGrid),bgWeekend:r("--theme-bg-hover",ut[e].bgWeekend),border:r("--theme-border-primary",ut[e].border),borderLight:r("--theme-border-subtle",ut[e].borderLight),textPrimary:r("--theme-text-primary",ut[e].textPrimary),textSecondary:r("--theme-text-secondary",ut[e].textSecondary),textTertiary:r("--theme-text-tertiary",ut[e].textTertiary),accent:r("--theme-accent-primary",ut[e].accent),accentHover:r("--theme-accent-hover",ut[e].accentHover),accentLight:r("--theme-accent-primary",ut[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ut[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ut[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ut[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ut[e].dependency),dependencyHover:r("--theme-border-secondary",ut[e].dependencyHover),criticalPath:r("--theme-error",ut[e].criticalPath),criticalPathLight:r("--theme-error",ut[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ut[e].today):e==="neutral"?r("--theme-text-primary",ut[e].today):r("--theme-error",ut[e].today),todayLight:e==="light"?r("--theme-accent-primary",ut[e].todayLight):e==="neutral"?r("--theme-text-primary",ut[e].todayLight):r("--theme-error",ut[e].todayLight),milestone:r("--theme-warning",ut[e].milestone),milestoneLight:r("--theme-warning",ut[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ut[e].statusTodo),statusInProgress:r("--theme-accent-primary",ut[e].statusInProgress),statusCompleted:r("--theme-success",ut[e].statusCompleted),hoverBg:r("--theme-bg-hover",ut[e].hoverBg),focusRing:r("--theme-accent-primary",ut[e].focusRing),...ut[e].dotGrid&&{dotGrid:ut[e].dotGrid},...ut[e].glassHeader&&{glassHeader:ut[e].glassHeader},...ut[e].glassToolbar&&{glassToolbar:ut[e].glassToolbar},...ut[e].forecastHud&&{forecastHud:ut[e].forecastHud},...ut[e].neonRedGlow&&{neonRedGlow:ut[e].neonRedGlow},...ut[e].executionBarBg&&{executionBarBg:ut[e].executionBarBg}}}var fi={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"}},Up={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"}},yd={en:fi,es:Up};function Wp(e){return yd[e]||yd.en}function xd(e,t){let a=Wp(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 Mn=createContext(fi);function Br(){return useContext(Mn)}function us(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(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Jp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[i,c]=useState(false),[l,m]=useState(null),d=useRef(null),p=useRef(null),g=Br(),y=us(d,i,"right",176);if(useEffect(()=>{if(!i)return;let b=w=>{let C=w.target;d.current&&!d.current.contains(C)&&p.current&&!p.current.contains(C)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[i]),!(t||a||r||o||s||n))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(b=>b.handler),f=async(b,w)=>{if(w){m(b);try{await w();}catch(C){console.error(`Export ${b} failed:`,C);}finally{m(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#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:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:i&&jsx(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:h.map((b,w)=>jsxs(motion.button,{onClick:()=>f(b.id,b.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===b.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"})}):b.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})}),document.body)]})}function Vp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=useState(false),[c,l]=useState(null),[m,d]=useState(false),p=useRef(null),g=useRef(null),y=Br(),x=us(p,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let N=T=>{let k=T.target;p.current&&!p.current.contains(k)&&g.current&&!g.current.contains(k)&&i(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[n]);let b=[{id:"png",label:y.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(N=>N.handler),w=async(N,T)=>{if(T){l(N);try{await T();}catch(k){console.error(`Export ${N} failed:`,k);}finally{l(null),i(false);}}},C=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>i(!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:y.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:x.top,left:x.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[b.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:b.map((N,T)=>jsxs(motion.button,{onClick:()=>w(N.id,N.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:T*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===N.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"})}):N.icon}),jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),b.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:C,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:m?"rgba(34,197,94,0.15)":e.accentLight,color:m?"#22C55E":e.accent},children:m?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:m?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Ix({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 Bx({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 _p({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),i=useRef(null),c=Br(),l=us(n,o,"left");useEffect(()=>{if(!o)return;let p=g=>{let y=g.target;n.current&&!n.current.contains(y)&&i.current&&!i.current.contains(y)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let m=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.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:`${c.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:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:m.map((p,g)=>{let y=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:y?e.accentLight:"transparent",borderBottom:g<m.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?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:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:p.label}),y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function jp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),i=useRef(null),c=useRef(null),l=Br(),m=us(i,s,"left");useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;i.current&&!i.current.contains(b)&&c.current&&!c.current.contains(b)&&n(false);},h=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],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:i,onClick:y=>{y.stopPropagation(),n(x=>!x);},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:l.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:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:m.top,left:m.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?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"}):y.icon;return jsxs(motion.button,{onClick:()=>{a(y.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:x?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:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Rx({value:e,onChange:t,theme:a}){let r=Br(),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 i=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:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?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 Ox({theme:e,forecast:t}){let a=Br(),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,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,m=l!=null?l>=75?"#22C55E":l>=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",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<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&&i&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),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:m,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&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:h})]})]})]})}function $x({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:m,hasDependencies:d=true}){let[p,g]=useState(false),y=useRef(null),x=useRef(null),h=Br(),f=us(y,p,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let T=k=>{let v=k.target;y.current&&!y.current.contains(v)&&x.current&&!x.current.contains(v)&&g(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[p]);let w=h.toolbar.visibility==="Visibilidad",C=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],N=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:y,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:h.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:x,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:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:C.map((T,k)=>{let v=T.icon,E=T.disabled,I=T.tooltip;return jsxs(motion.button,{onClick:()=>!E&&T.onChange?.(!T.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:E?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:E?"not-allowed":"pointer"},whileHover:E?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},title:I,children:[jsx(v,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:E?b?"rgba(255,255,255,0.2)":"#D1D5DB":T.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:T.label}),T.active&&!E&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((T,k)=>{let v=l===T.value;return jsxs(motion.button,{onClick:()=>m(T.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(C.length+k)*.03},children:[jsx("span",{style:{color:v?e.accent||"#2E94FF":b?"rgba(255,255,255,0.85)":e.textPrimary},children:T.label}),v&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.value)})]})]})}),document.body)]})}function bi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:f,wbsLevel:b,onWbsLevelChange:w,maxWbsDepth:C=4,viewMode:N="execution",onViewModeChange:T,projectForecast:k,onExportPNG:v,onExportPDF:E,onExportExcel:I,onExportCSV:D,onExportJSON:X,onExportMSProject:O,showCriticalPath:H=true,onShowCriticalPathChange:F,showDependencies:q=true,onShowDependenciesChange:ee,highlightWeekends:Se=true,onHighlightWeekendsChange:R,showBaseline:j=false,onShowBaselineChange:be,onCopySnapshotLink:Xe,hasDependencies:z=true}){let re=Br(),J=v||E||I||D||X||O,Fe=!!e.glassToolbar,[he,Ue]=useState(false),Be=useRef(null);useEffect(()=>{he&&Be.current&&Be.current.focus();},[he]);let nt=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.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"})}],st=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Fe){let oe=st?"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:st?"#1A1A1A":e.bgSecondary,border:`1px solid ${st?"rgba(255,255,255,0.08)":e.border}`},animate:{width:he?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Ue(!he),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"})}),he&&jsx("input",{ref:Be,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:()=>Ue(false),onKeyDown:rt=>{rt.key==="Escape"&&Ue(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:oe}}),T&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:st?"#000000":e.bgSecondary,border:`1px solid ${st?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>T("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?st?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:re.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>T("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?st?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:N==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:re.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Rx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:oe}}),w&&jsx(_p,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsx(jp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:oe}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:oe}}),jsx($x,{theme:e,showCriticalPath:H,onShowCriticalPathChange:F,showBaseline:j,onShowBaselineChange:be,highlightWeekends:Se,onHighlightWeekendsChange:R,showDependencies:q,onShowDependenciesChange:ee,rowDensity:i,onRowDensityChange:c,hasDependencies:z}),jsx(Vp,{theme:e,onExportPNG:v,onExportPDF:E,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Xe}),m&&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 ${st?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${st?"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||re.toolbar.createTask})]})]})]}),k&&jsx(Ox,{theme:e,forecast:k})]})}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(Bx,{options:nt,value:t,onChange:oe=>a(oe),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}}),w&&jsx(_p,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(jp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),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}})]}),m&&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||re.toolbar.createTask})]}),(J||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Vp,{theme:e,onExportPNG:v,onExportPDF:E,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Xe}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsx(Ix,{options:Z,value:s,onChange:oe=>n(oe),theme:e})]})]})}function hi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),i=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let m=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let l=e.filter(m=>m.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let m=c.current.getBoundingClientRect();n({x:m.left,y:m.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(Xt,{children:jsx(motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),l.map(m=>jsxs("button",{onClick:()=>{t(m.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:m.label}),m.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Pn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,p=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+m+p>g&&(x=t-m,x<p&&(x=p)),a+d+p>y&&(h=y-d-p,h<p&&(h=p)),c({x,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let m=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m: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:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(m=>jsxs("div",{children:[m.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var da={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 om({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:p=true}){let g=useRef(false),y=useCallback(w=>{g.current=w;},[]),x=useCallback(w=>{let C=[],N=T=>{for(let k of T)C.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&N(k.subtasks);};return N(w),C},[]),h=useCallback(()=>{let w=x(e);for(let C of w)if(t.has(C.id))return C;return null},[e,t,x]),f=useCallback((w,C)=>{let N=x(e);if(N.length===0)return;let T=h();if(!T){a(N[0].id,false);return}let k=N.findIndex(I=>I.id===T.id);if(k===-1)return;let v=w==="up"?k-1:k+1;if(v<0||v>=N.length)return;let E=N[v];a(E.id,C);},[e,h,x,a]),b=useCallback(w=>{if(!p)return;let C=w.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||g.current){w.key==="Escape"&&(C.blur(),g.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,v=Array.from(t),E=h();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(E&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){E.subtasks&&E.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!E.isExpanded||w.key==="ArrowLeft"&&E.isExpanded)&&m(E.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){v.length>0&&(w.preventDefault(),n(v,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){v.length>0&&(w.preventDefault(),i(v));return}if(w.key==="Tab"&&w.shiftKey){v.length>0&&(w.preventDefault(),c(v));return}if(w.key==="Enter"&&!w.shiftKey&&!k){E&&(w.preventDefault(),r(E.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!k){E&&(w.preventDefault(),r(E.id,"above"));return}if(w.key==="Enter"&&k){E&&(w.preventDefault(),d(E.id));return}if(w.key==="F2"){E&&(w.preventDefault(),l(E.id));return}if(w.key==="Delete"||w.key==="Backspace"&&k){v.length>0&&(w.preventDefault(),o(v));return}if(w.key==="d"&&k&&!w.shiftKey){v.length>0&&(w.preventDefault(),s(v));return}},[p,t,h,f,r,o,s,n,i,c,l,m,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[p,b]),{setIsEditing:y}}function sm(){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),y=p.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=p.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),i=useCallback((d,p,g,y)=>{y?n(d,p):g?s(d):o(d);},[o,s,n]),c=useCallback((d,p)=>{p?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:m}}function Td(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Td(t.subtasks):t.subtasks}))}function An(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function yi(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=yi(a.subtasks,t);if(r)return r}}return null}function Cd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Cd(a.subtasks,t);if(r)return r}return null}function Nd(e,t){if(t.length===0)return e;let a=An(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 y=[];return {tasks:p.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let f=n(h.subtasks,g);h.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},i=(p,g,y)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:i(x.subtasks,g,y)}:x),c=new Set(t),{tasks:l,removed:m}=n(e,c),d=i(l,s.id,m);return Td(d)}function Dd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Cd(a,r);if(!o)continue;let s=Cd(a,o.id),n=(l,m,d)=>{for(let p=0;p<l.length;p++){let g=l[p];if(g.id===m&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,m,d);if(y)return y}}return null},i=(l,m,d)=>{let p=l.findIndex(g=>g.id===m);if(p!==-1)return l.splice(p+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,m,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return Td(a)}function Sd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let m=c==="up"?l-1:l+1;return m<0||m>=n.length?false:([n[l],n[m]]=[n[m],n[l]],n[l]={...n[l],position:l},n[m]={...n[m],position:m},true)};return s(r,o,a),r}function Ed(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 ms(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((m,d)=>({...m,id:`${m.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let m=c[l],d=`${m.id}-copy-${Date.now()}`,p={...m,id:d,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks,d):void 0};return c.splice(l+1,0,p),p},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function im(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"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let m=a==="above"?l:l+1;return c.splice(m,0,n),true};return i(r),{tasks:r,newTask:n}}function Md(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Md(r.subtasks,t,a)}:r)}function Fd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Fd(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 y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,i=r?.endDate||s,c=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},l=c(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=p=>p.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,m],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:m}}function lm(e,t,a,r){if(t===a)return e;let o=yi(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===l||i(m,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(m=>m.id!==t),l=c.length<i.length;return c.map((m,d)=>{let p=l?{...m,position:d}:m;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let m=l.subtasks||[],d=r!==void 0?r:m.length,p=[...m];p.splice(d,0,{...o,parentId:a});let g=p.map((y,x)=>({...y,position:x}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function Rr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Rr(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{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((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function vi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:m,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:b,onTaskCreate:w,onTaskRename:C,onCreateSubtask:N,onOpenTaskModal:T,onDeleteRequest:k,onTaskReparent:v,scrollContainerRef:E,showCriticalPath:I=false}){let D=useContext(Mn),[X,O]=useState(null),[H,F]=useState(null),[q,ee]=useState(""),Se=useRef(null),[R,j]=useState(null),[be,Xe]=useState(0),[z,re]=useState(0),[J,Fe]=useState({isOpen:false,x:0,y:0,type:"header"}),[he,Ue]=useState(null),[Be,nt]=useState(null),[Z,st]=useState(null),oe=useRef(0),rt=5,ht=useRef(false),[Ft,ke]=useState(null),[yt,dt]=useState(false),at=useRef(null),[$,de]=useState(null),[S,Y]=useState(false),le=useRef(null);useEffect(()=>{function se(fe){le.current&&!le.current.contains(fe.target)&&Y(false);}if(S)return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[S]),useEffect(()=>{H&&Se.current&&(Se.current.focus(),Se.current.select());},[H]),useEffect(()=>{if(!R)return;let se=L=>{let _=L.clientX-be,K=z+_;p?.(R,K);},fe=()=>{j(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[R,be,z,p]);let{selectedTaskIds:we,handleTaskClick:W,isTaskSelected:te}=sm(),{setIsEditing:We}=om({tasks:e,selectedTaskIds:we,onTaskSelect:(se,fe)=>{let _=An(e).map(K=>K.id);W(se,_,fe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:se=>{let fe=An(e).find(L=>L.id===se);fe&&mt(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:se=>{let fe=An(e).find(L=>L.id===se);fe&&T&&T(fe);},enableKeyboard:true}),Ce=(se,fe=0,L="")=>{let _=[],K=[...se].sort((ue,Me)=>(ue.position??0)-(Me.position??0));for(let ue=0;ue<K.length;ue++){let Me=K[ue],Ke=ue+1,je=L?`${L}.${Ke}`:`${Ke}.0`;if(Me.wbsCode=je,_.push({task:Me,level:fe}),Me.subtasks&&Me.subtasks.length>0&&Me.isExpanded){let Le=L?`${L}.${Ke}`:`${Ke}`;_.push(...Ce(Me.subtasks,fe+1,Le));}}return _},He=Ce(e),Ne=48,_e=Math.max(He.length*a,600-Ne),kt=se=>!se.startDate||!se.endDate?"-":`${Math.ceil((se.endDate.getTime()-se.startDate.getTime())/(1e3*60*60*24))}d`,mt=se=>{F(se.id),ee(se.name),We(true);},ot=se=>{q.trim()&&q!==e.find(fe=>fe.id===se)?.name&&C?.(se,q.trim()),F(null),ee(""),We(false);},et=()=>{F(null),ee(""),We(false);},Yt=(se,fe)=>{fe.stopPropagation(),N?.(se.id);},Pt=(se,fe)=>{fe.preventDefault(),oe.current=fe.clientY,Ue(se),ht.current=false,dt(false),ke({x:fe.clientX,y:fe.clientY});},vt=se=>{if(!he||(Math.abs(se.clientY-oe.current)>rt&&!ht.current&&(ht.current=true,dt(true)),ke({x:se.clientX,y:se.clientY}),!ht.current))return;if(E?.current){let ue=E.current,Me=ue.getBoundingClientRect(),Ke=60,je=12;at.current&&(cancelAnimationFrame(at.current),at.current=null);let Le=se.clientY-Me.top,ft=Me.bottom-se.clientY;if(Le<Ke&&ue.scrollTop>0){let Ct=Math.round(je*(1-Le/Ke)),zt=()=>{ue.scrollTop-=Ct,ht.current&&ue.scrollTop>0&&(at.current=requestAnimationFrame(zt));};at.current=requestAnimationFrame(zt);}else if(ft<Ke&&ue.scrollTop<ue.scrollHeight-ue.clientHeight){let Ct=Math.round(je*(1-ft/Ke)),zt=()=>{ue.scrollTop+=Ct,ht.current&&ue.scrollTop<ue.scrollHeight-ue.clientHeight&&(at.current=requestAnimationFrame(zt));};at.current=requestAnimationFrame(zt);}}let L=document.querySelectorAll("[data-task-row]"),_=null,K=null;L.forEach(ue=>{let Me=ue.getBoundingClientRect(),Ke=ue.getAttribute("data-task-row");if(Ke&&Ke!==he&&se.clientY>=Me.top&&se.clientY<=Me.bottom){_=Ke;let je=se.clientY-Me.top,Le=Me.height;je<Le*.25?K="above":je>Le*.75?K="below":K="child";}}),nt(_),st(K);},Nt=()=>{if(ht.current&&he&&Be&&Z){if(Z==="child")v?.(he,Be);else if(Z==="above"||Z==="below"){let se=(K,ue,Me=null)=>{for(let Ke of K){if(Ke.id===ue)return Me;if(Ke.subtasks){let je=se(Ke.subtasks,ue,Ke.id);if(je!==void 0)return je}}},fe=se(e,he,null),L=se(e,Be,null),_=(K,ue,Me,Ke)=>{let je=K.findIndex(Ct=>Ct.id===ue),Le=Ke?K.findIndex(Ct=>Ct.id===Me):-1,ft=Z==="below"?je+1:je;return Ke&&Le!==-1&&Le<je&&(ft-=1),Math.max(0,ft)};if(L===null){let ue=_(e,Be,he,fe===null);v?.(he,null,ue);}else {let K=He.find(ue=>ue.task.id===L)?.task;if(K?.subtasks){let ue=fe===L,Me=_(K.subtasks,Be,he,ue);v?.(he,L,Me);}}}}at.current&&(cancelAnimationFrame(at.current),at.current=null),Ue(null),nt(null),st(null),ke(null),ht.current=false,dt(false);};useEffect(()=>{if(he)return document.addEventListener("mousemove",vt),document.addEventListener("mouseup",Nt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",vt),document.removeEventListener("mouseup",Nt),document.body.style.cursor="",document.body.style.userSelect="";}},[he,Be,Z]);let gt=(se,fe,L)=>{let _=fe.subtasks&&fe.subtasks.length>0;switch(se.id){case "name":let K=H===fe.id,ue=X===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${L*20}px`},children:[v&&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:ue?1:.3},onMouseDown:U=>Pt(fe.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),K?jsx("input",{ref:Se,type:"text",value:q,onChange:U=>ee(U.target.value),onKeyDown:U=>{U.key==="Enter"?ot(fe.id):U.key==="Escape"&&et();},onBlur:()=>ot(fe.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:U=>U.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),I&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),I&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),ue&&!K&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>Yt(fe,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(),mt(fe);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Ke=se.id==="startDate"?"startDate":"endDate",je=fe[Ke],Le=$?.taskId===fe.id&&$?.field===Ke,ft=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:_?.5:1,cursor:_?"default":"pointer"},title:_?"Auto-calculated from subtasks":void 0,onClick:U=>{if(!_)if(Le)de(null);else {let ne=U.currentTarget.getBoundingClientRect();de({taskId:fe.id,field:Ke,month:je?typeof je=="string"?new Date(je):je:new Date,position:{top:ne.bottom+4,left:ne.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:ft(je)}),_&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Le&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>de(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,ne=new Date(U);ne.setDate(U.getDate()+1);let Oe=new Date(U);Oe.setDate(U.getDate()+7);let A=new Date(U);return A.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:Oe},{label:"2 semanas",date:A}].map((Ve,tt)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:oa=>oa.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:oa=>oa.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Ke]:Ve.date}),de(null);},children:Ve.label},tt))})(),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?.(fe.id,{[Ke]:void 0}),de(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:()=>de(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:()=>de(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,ne)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},ne))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=$?.month||new Date,ne=U.getFullYear(),Oe=U.getMonth(),A=new Date(ne,Oe,1).getDay(),ge=new Date(ne,Oe+1,0).getDate(),Ve=new Date,tt=[];for(let Gt=A-1;Gt>=0;Gt--)tt.push({day:new Date(ne,Oe,-Gt).getDate(),date:new Date(ne,Oe-1,new Date(ne,Oe,-Gt).getDate()),isCurrentMonth:false});for(let Gt=1;Gt<=ge;Gt++)tt.push({day:Gt,date:new Date(ne,Oe,Gt),isCurrentMonth:true});let oa=42-tt.length;for(let Gt=1;Gt<=oa;Gt++)tt.push({day:Gt,date:new Date(ne,Oe+1,Gt),isCurrentMonth:false});return tt.map((Gt,Ta)=>{let Ea=Gt.date.toDateString()===Ve.toDateString(),ba=(je?typeof je=="string"?new Date(je):je:null)?.toDateString()===Gt.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:Gt.isCurrentMonth?ba?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ba?"#2E94FF":"transparent",boxShadow:Ea&&!ba?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[Ke]:Gt.date}),de(null);},children:Gt.day},Ta)})})()})]})]})]}),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:kt(fe)})});case "assignees":if(_)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 Ct=r.filter(U=>fe.assignees?.some(ne=>ne.name===U.name||ne.initials===U.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Yo,{assignedUsers:Ct,availableUsers:r,onChange:U=>{let ne=U.map(Oe=>({id:Oe.id,name:Oe.name,initials:Oe.initials,color:Oe.color}));g?.(fe.id,{assignees:ne.length>0?ne:void 0});}})});case "status":if(_){let U=fe.progress===100?"\u2713":fe.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:U})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Fu,{status:fe.status||"todo",onChange:U=>{g?.(fe.id,{status:U,progress:U==="completed"?100:fe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:_?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${fe.progress}%`,backgroundColor:fe.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[fe.progress,"%"]})]});case "priority":let zt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ca={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ta=zt[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(jo,{priority:ta,onChange:U=>{U&&g?.(fe.id,{priority:Ca[U]||"medium"});}})});default:return null}},Wt=se=>[{id:"hide",label:"Hide Column",icon:da.Hide,onClick:()=>d(se),disabled:se==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:da.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:da.SortDesc,onClick:()=>{}}],Re=se=>se.subtasks&&se.subtasks.length>0?[{id:"addSubtask",label:D?.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{N?.(se.id);}},{id:"duplicate",label:D?.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{b?.([se.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:D?.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{k?k(se.id,se.name):f?.([se.id]);}}]:[{id:"edit",label:D?.contextMenu?.editTask||"Edit Task",icon:da.Pencil,onClick:()=>{n?.(se);}},{id:"addSubtask",label:D?.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{N?.(se.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:D?.contextMenu?.markIncomplete||"Mark Incomplete",icon:da.MarkIncomplete,onClick:()=>{g?.(se.id,{status:"todo",progress:0});},disabled:se.status==="todo"},{id:"setInProgress",label:D?.contextMenu?.setInProgress||"Set In Progress",icon:da.SetInProgress,onClick:()=>{g?.(se.id,{status:"in-progress"});},disabled:se.status==="in-progress"},{id:"markComplete",label:D?.contextMenu?.markComplete||"Mark Complete",icon:da.MarkComplete,onClick:()=>{g?.(se.id,{status:"completed",progress:100});},disabled:se.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:D?.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{b?.([se.id]);}},{id:"split",label:D?.contextMenu?.splitTask||"Split Task",icon:da.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:D?.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{k?k(se.id,se.name):f?.([se.id]);}}],Ae=m.filter(se=>se.visible),ct=Ae.reduce((se,fe)=>se+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ct},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((se,fe)=>{let L=fe===Ae.length-1,_=se.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_?"":"justify-center"}`,style:{width:`${se.width}px`,minWidth:`${se.minWidth??(_?200:60)}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:_&&Ae.length===1?1:0,flexGrow:_&&Ae.length===1?1:0,borderRight:L?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:K=>{K.preventDefault(),Fe({isOpen:true,x:K.clientX,y:K.clientY,type:"header",columnId:se.id});},onMouseEnter:K=>{K.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:K=>{K.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:se.label,children:se.label}),se.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:R===se.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:K=>{K.preventDefault(),K.stopPropagation(),j(se.id),Xe(K.clientX),re(se.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:R===se.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},se.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(hi,{columns:m,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>Y(!S),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"})}),S&&jsxs("div",{ref:le,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:se=>se.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>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:_e},children:He.map(({task:se,level:fe},L)=>{let _=te(se.id),K=Be===se.id,ue=K&&Z==="above",Me=K&&Z==="below",Ke=K&&Z==="child",je={};return Ke&&(je.backgroundColor=`${t.accent}15`,je.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":se.id,className:`flex items-center cursor-pointer group ${he===se.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_?t.accentLight:Ke?`${t.accent}15`:L%2===0?t.bgPrimary:t.bgGrid,opacity:I?se.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...je},onMouseEnter:()=>O(se.id),onMouseLeave:()=>O(null),onClick:Le=>{let Ct=An(e).map(ta=>ta.id),Ca=navigator.platform.toUpperCase().indexOf("MAC")>=0?Le.metaKey:Le.ctrlKey;W(se.id,Ct,Ca,Le.shiftKey),s?.(se);},onDoubleClick:Le=>{Le.stopPropagation(),n?.(se);},onContextMenu:Le=>{Le.preventDefault(),Fe({isOpen:true,x:Le.clientX,y:Le.clientY,type:"task",task:se}),i?.(se,Le);},whileHover:{backgroundColor:_?t.accentLight:t.hoverBg},children:[ue&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Me&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ae.map((Le,ft)=>{let Ct=ft===Ae.length-1,zt=Le.id==="name";return jsx("div",{className:`px-4 flex items-center ${zt?"justify-start":"justify-center"}`,style:{width:`${Le.width}px`,minWidth:`${Le.minWidth??(zt?200:60)}px`,maxWidth:`${Le.maxWidth??2e3}px`,flexShrink:zt&&Ae.length===1?1:0,flexGrow:zt&&Ae.length===1?1:0,borderRight:Ct?"none":`1px solid ${X===se.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:gt(Le,se,zt?fe:0)},`${se.id}-${Le.id}`)})]},se.id)})}),jsx(Pn,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?Wt(J.columnId):J.type==="task"&&J.task?Re(J.task):[],onClose:()=>Fe({...J,isOpen:false}),theme:t}),yt&&Ft&&he&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Ft.x+12,top:Ft.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=He.find(fe=>fe.task.id===he)?.task;return se?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:se.name})}):null})()}),document.body)]})}function mm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,i]=useState(e),[c,l]=useState(t),[m,d]=useState(null),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(0),[C,N]=useState(0),[T,k]=useState(null),[v,E]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:m,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:b,setDraggedSegmentStartX:w,segmentDragOffsetX:C,setSegmentDragOffsetX:N,hoveredSegmentIndex:T,setHoveredSegmentIndex:k,isHovered:v,setIsHovered:E,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,F)=>{r("none"),d(null),g(null),i(H),l(F),N(0),f(null),w(0);}}}function Ci({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:m,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:w=false}){let C=mm(t,r),N=useRef(null),T=useRef(false),k=useRef(null),v=useRef(null),{dragMode:E,setDragMode:I,dragOffset:D,setDragOffset:X,ghostX:O,setGhostX:H,ghostWidth:F,setGhostWidth:q,connectionLine:ee,setConnectionLine:Se,hoveredTaskId:R,setHoveredTaskId:j,activeZone:be,setActiveZone:Xe,draggedSegmentIndex:z,setDraggedSegmentIndex:re,draggedSegmentStartX:J,setDraggedSegmentStartX:Fe,segmentDragOffsetX:he,setSegmentDragOffsetX:Ue,hoveredSegmentIndex:Be,setHoveredSegmentIndex:nt,isHovered:Z,setIsHovered:st,isDragging:oe,isResizing:rt,isConnecting:ht,resetDragState:Ft}=C,ke=18,yt=!!o.executionBarBg,dt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",at=yt?3:6,$=e.subtasks&&e.subtasks.length>0,de=e.endDate&&(()=>{let L=new Date;L.setHours(0,0,0,0);let _=new Date(e.endDate);return _.setHours(0,0,0,0),_<L})()&&e.progress<100,S=b&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",le=e.status==="completed"||e.progress===100,we={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=b&&e.isCriticalPath||de?"#EF4444":e.color?e.color:e.priority&&we[e.priority]?we[e.priority]:o.taskBarPrimary,We=w?"default":oe?ht?"crosshair":rt?"ew-resize":"grabbing":"grab",Ce=w?"default":"ew-resize",Ne=(L=>L>=80?20:L>=60?15:L>=50?12:10)(r),_e=r<50,kt=r<40;useEffect(()=>{x&&(!Z||oe||e.segments)&&x(null);},[Z,oe,e.segments,x]);let mt=L=>L.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ot=()=>{let L=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${L} day${L!==1?"s":""}`},et=L=>Math.round(L/s)*s,Yt=L=>{let _=Math.round(L/s),K=new Date(n);return K.setDate(K.getDate()+_),K},Pt=(L,_)=>{for(let K of g){if(K.id===e.id)continue;let ue=5;if(L>=K.x-ue&&L<=K.x+K.width+ue&&_>=K.y-ue&&_<=K.y+K.height+ue)return K.id}return null},vt=useCallback((L,_,K)=>{if(w)return;L.preventDefault(),L.stopPropagation();let ue=N.current?.ownerSVGElement;if(!ue)return;let Me=ue.createSVGPoint();Me.x=L.clientX,Me.y=L.clientY;let Ke=Me.matrixTransform(ue.getScreenCTM()?.inverse()),je=K!==void 0?K:t,Le=_;if(!Le){let ft=Ke.x-je;L.shiftKey?(Le="connect",Se({x:t+r,y:a+ke/2})):L.ctrlKey||L.metaKey?Le="move":L.altKey?Le=ft<r/2?"resize-start":"resize-end":kt?ft<r/2?Le="move":Le="resize-end":_e?ft<=Ne/2?Le="resize-start":ft>=r-Ne/2?Le="resize-end":Le="move":ft<=Ne?Le="resize-start":ft>=r-Ne?Le="resize-end":Le="move";}T.current=false,I(Le),st(false),Xe(null),Le==="move"?X(Ke.x-je):Le==="connect"?Se({x:t+r,y:a+ke/2}):X(0),H(je),q(r);},[t,r,a,ke,w]),Nt=useCallback(L=>{let _=N.current?.ownerSVGElement;if(!_)return;let K=_.closest(".gantt-timeline-scroll");if(!K)return;let ue=K.getBoundingClientRect(),Me=60,Ke=15,je=0;if(L.clientX<ue.left+Me){let Le=ue.left+Me-L.clientX;je=-Math.min(Ke,Le/2);}else if(L.clientX>ue.right-Me){let Le=L.clientX-(ue.right-Me);je=Math.min(Ke,Le/2);}return je!==0&&(K.scrollLeft+=je),je!==0},[]),gt=useCallback(L=>{if(E==="none")return;T.current=true,v.current=L;let _=N.current?.ownerSVGElement;if(!_)return;if(E==="move"||E==="resize-start"||E==="resize-end"){let Me=Nt(L);Me&&!k.current?k.current=window.setInterval(()=>{v.current&&(Nt(v.current),gt(v.current));},16):!Me&&k.current&&(window.clearInterval(k.current),k.current=null);}let K=_.createSVGPoint();K.x=L.clientX,K.y=L.clientY;let ue=K.matrixTransform(_.getScreenCTM()?.inverse());if(E==="connect"){Se({x:ue.x,y:ue.y});let Me=Pt(ue.x,ue.y);j(Me);}else if(E==="move"){let Me=ue.x-D,Ke=et(Me);H(Ke),q(r);let je=Math.round((Ke-t)/s);if(y?.(e.id,je,true),e.segments&&e.segments.length>0&&z!==null){let Le=Ke-J;Ue(Le);}}else if(E==="resize-start"){let Me=ue.x,Ke=et(Me),je=t+r-Ke;je>=s&&(H(Ke),q(je));}else if(E==="resize-end"){let Me=ue.x,je=et(Me)-t;je>=s&&q(je);}},[E,t,r,s,D,e,et,z,J,Pt,j,Se,H,q,Ue,y,Nt]),Wt=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),v.current=null,E!=="none"){if(E==="connect")R&&p&&p(e,R),Se(null),j(null);else {let L=e.endDate.getTime()-e.startDate.getTime(),_,K,ue=true;if(E==="move"){if(_=Yt(O),K=new Date(_.getTime()+L),e.segments&&e.segments.length>0&&z!==null){let Me=Math.round(he/s),Ke=e.segments.map((Ct,zt)=>{if(zt===z){let Ca=new Date(Ct.startDate),ta=new Date(Ct.endDate);return Ca.setDate(Ca.getDate()+Me),ta.setDate(ta.getDate()+Me),{startDate:Ca,endDate:ta}}return Ct}),je=Ke.flatMap(Ct=>[Ct.startDate,Ct.endDate]),Le=new Date(Math.min(...je.map(Ct=>Ct.getTime()))),ft=new Date(Math.max(...je.map(Ct=>Ct.getTime())));d?.({...e,segments:Ke},Le,ft),Ft(t,r);return}}else E==="resize-start"?(_=Yt(O),K=e.endDate,_>K&&(console.warn("Invalid date range: start date must be before or equal to end date"),ue=false)):E==="resize-end"?(_=e.startDate,K=Yt(O+F),K.setDate(K.getDate()-1),K<_&&(console.warn("Invalid date range: end date must be after or equal to start date"),ue=false)):ue=false;ue&&_&&K&&(K.getTime()<_.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,_,K));}y?.(e.id,0,false),Ft(t,r);}},[E,O,F,e,d,R,p,t,r,s,Yt,he,z,Ft,y]);useEffect(()=>{if(E==="none")return;let L=K=>{gt(K);},_=()=>{Wt();};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",_),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",_),k.current&&(window.clearInterval(k.current),k.current=null);}},[E,gt,Wt]);let Re=oe&&!ht?O:t,Ae=oe&&!ht?F:r,ct=i.taskClass(e),se=24,fe=b?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:N,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!oe&&!T.current&&c?.(e),T.current=false;},onDoubleClick:L=>{!oe&&!T.current&&(L.stopPropagation(),l?.(e));},onContextMenu:L=>{L.preventDefault(),m?.(e,L);},onMouseEnter:()=>!oe&&st(true),onMouseMove:L=>{x&&Z&&!oe&&!e.segments&&x({task:e,x:t,y:a,width:r,height:ke,showBelow:false,mouseX:L.clientX,mouseY:L.clientY});},onMouseLeave:()=>{oe||(st(false),Xe(null));},children:[jsx("rect",{x:t,y:a,width:r+se,height:ke,fill:"transparent",style:{pointerEvents:"all"}}),Z&&!oe&&!_e&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ne,height:ke,fill:be==="resize-start"?o.accent:"transparent",opacity:be==="resize-start"?.15:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Xe("resize-start"),onMouseDown:L=>vt(L,"resize-start")}),jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:ke,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Xe("move"),onMouseDown:L=>vt(L,"move")}),jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:ke,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.15:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Xe("resize-end"),onMouseDown:L=>vt(L,"resize-end")})]}),Z&&!oe&&kt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ke,fill:be==="move"?o.accent:"transparent",opacity:be==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Xe("move"),onMouseDown:L=>vt(L,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ke,fill:be==="resize-end"?o.accent:"transparent",opacity:be==="resize-end"?.2:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Xe("resize-end"),onMouseDown:L=>vt(L,"resize-end")}),Z&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ke-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),oe&&!ht&&!e.segments&&jsx(motion.rect,{x:O,y:a,width:F,height:ke,rx:at,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"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!oe&&(()=>{let L=e.baselineStartDate.getTime(),_=e.baselineEndDate.getTime(),K=n.getTime(),ue=864e5,Me=(L-K)/ue,Ke=(_-L)/ue,je=Me*s,Le=Math.max(Ke*s,s),ft=Re+Ae,Ct=je+Le,zt=e.endDate?.getTime()??0,Ca=Math.ceil((zt-_)/ue),ta=Ca>0,U=Ca<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:je,y:a,width:Le,height:ke,rx:at,fill:"none",stroke:dt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ta&&ft>Ct&&jsx("rect",{x:Ct,y:a,width:ft-Ct,height:ke,rx:0,fill:"#EF4444",opacity:.2}),ta&&jsxs("text",{x:Math.max(ft,Ct)+6,y:a+ke/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ca,"d"]}),U&&jsxs("text",{x:ft+6,y:a+ke/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ca,"d"]})]})})(),!e.segments&&yt&&$&&(()=>{let _=a+(ke-8)/2,K=4,ue=e.progress||0,Me=new Date;Me.setHours(0,0,0,0);let Ke=e.startDate&&Me>=e.startDate,je=e.endDate&&(()=>{let ta=new Date(e.endDate);return ta.setHours(0,0,0,0),Me>ta})(),Le=e.startDate&&Me<e.startDate,ft=1;if(Ke&&e.startDate&&e.endDate&&!Le){let ta=new Date(e.startDate);ta.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let ne=Math.max(1,(U.getTime()-ta.getTime())/(1e3*60*60*24)),A=Math.min((Me.getTime()-ta.getTime())/(1e3*60*60*24),ne)/ne*100;ft=A>0?ue/A:1;}let Ct;ue>=100?Ct="#00E5CC":Le?Ct="#4B5563":je&&ue<100?Ct="#EF4444":ft>=.95?Ct="#22C55E":ft>=.8?Ct="#F59E0B":Ct="#EF4444";let zt=Math.max(ue/100*Ae,ue>0?K*2:0),Ca=Ae>100&&ue>0;return jsxs("g",{"data-task-class":ct,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Re,y:_,width:Ae,height:8,rx:K,fill:"rgba(255,255,255,0.10)"}),ue>0&&jsx("rect",{x:Re,y:_,width:zt,height:8,rx:K,fill:Ct}),Ca&&jsxs("text",{x:Re+zt+6,y:_+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(ue),"%"]})]})})(),!e.segments&&yt&&!$&&jsx(motion.rect,{x:Re,y:a,width:Ae,height:ke,rx:at,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ct,initial:{opacity:0,scale:.95},animate:{opacity:oe&&!ht?.15:e.parentId?.6:1,scale:Z&&!oe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:L=>vt(L),style:{cursor:We,pointerEvents:"all"}}),!e.segments&&!yt&&jsx(motion.rect,{x:Re,y:a,width:Ae,height:ke,rx:at,fill:te,"data-task-class":ct,initial:{opacity:0,scale:.95},animate:{opacity:oe&&!ht?.15:e.parentId?.6:Z?.9:.8,scale:Z&&!oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:$?void 0:L=>vt(L),style:{cursor:$?"default":We,pointerEvents:"all"}}),yt&&(de||S)&&!e.segments&&jsx("rect",{x:Re,y:a,width:Ae,height:ke,rx:at,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),at*2),height:ke,rx:at,fill:te,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!$&&e.progress<100&&(()=>{let L=e.progress>0?Ae*(e.progress/100):0,_=Re+L,K=Ae-L,ue=e.progress===0?at:0,Me=e.progress===0?Re:_,Ke=e.progress===0?Ae:K;return jsxs(Fragment,{children:[jsx("rect",{x:Me,y:a,width:Ke,height:ke,rx:ue,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Me,y:a,width:Ke,height:ke,rx:ue,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),yt&&!e.segments&&e.progress>0&&e.progress<100&&!$&&!oe&&(()=>{let L=Re+Ae*(e.progress/100),_=8,K=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:L,cy:a+ke/2,r:_,fill:K?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:L,y:a+ke/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:K?.initials||K?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((L,_)=>{let K=(L.startDate.getTime()-n.getTime())/864e5*s,Me=(L.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-K+s,Ke=oe&&E==="move"&&z===_,je=Be===_,Le=Ke?K+he:K;return jsxs("g",{onMouseEnter:()=>!oe&&nt(_),onMouseLeave:()=>!oe&&nt(null),children:[jsx(motion.rect,{x:Le,y:a,width:Me,height:ke,rx:at,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:Ke||e.parentId?.6:je?.9:.8,scale:je&&!oe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ft=>{ft.stopPropagation(),re(_),Fe(K),vt(ft,void 0,K);},style:{cursor:We,pointerEvents:"all"}}),jsx("rect",{x:Le,y:a,width:Me*(e.progress/100),height:ke,rx:at,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${_}`)}),Y&&(de||S)&&!e.segments&&jsxs(Fragment,{children:[S&&!de&&jsx("rect",{x:Re,y:a,width:Ae,height:ke,rx:at,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),de&&jsx("rect",{x:Re,y:a,width:Ae,height:ke,rx:at,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Ae>60&&!e.segments&&!(yt&&$)&&(()=>{let L=i.taskLabel(e),_=typeof L=="string"?L:e.name,K=_.length>Math.floor(Ae/8)?`${_.substring(0,Math.floor(Ae/8))}...`:_;return jsx("text",{x:Re+8,y:a+ke/2,dominantBaseline:"middle",fill:le?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:le?"line-through":"none"},children:K})})(),!oe&&!e.segments&&!$&&e.progress>0&&e.progress<100&&(yt?jsxs("text",{x:Re+Ae+6,y:a+ke/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+ke/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&&!oe&&!e.segments&&!(yt&&$)&&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||rt)&&!ht&&!e.segments&&!$&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Re-2,y:a,width:16,height:ke,fill:"transparent",style:{cursor:Ce},onMouseEnter:()=>Xe("resize-start"),onMouseLeave:()=>Xe(null),onMouseDown:L=>{L.stopPropagation(),vt(L,"resize-start");}}),jsx(motion.rect,{x:Re+4,y:a+8,width:3,height:ke-16,rx:1.5,fill:be==="resize-start"||E==="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:ke,fill:"transparent",style:{cursor:Ce},onMouseEnter:()=>Xe("resize-end"),onMouseLeave:()=>Xe(null),onMouseDown:L=>{L.stopPropagation(),vt(L,"resize-end");}}),jsx(motion.rect,{x:Re+Ae-7,y:a+8,width:3,height:ke-16,rx:1.5,fill:be==="resize-end"||E==="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&&!oe&&!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+ke/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Xe("connect"),onMouseLeave:()=>Xe(null),onMouseDown:L=>{L.stopPropagation(),vt(L,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ke/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:be==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ht&&ee&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ke/2,x2:ee.x,y2:ee.y,stroke:R?o.statusCompleted:o.accent,strokeWidth:R?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:R?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:ee.x,cy:ee.y,r:R?8:6,fill:R?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),R&&jsx(motion.text,{x:ee.x+15,y:ee.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ee.x+10},animate:{opacity:1,x:ee.x+15},transition:{duration:.2},children:"Connect"})]}),(Z||oe)&&!ht&&!e.segments&&jsx(motion.rect,{x:Re-1,y:a-1,width:Ae+2,height:ke+2,rx:at+1,fill:"none",stroke:oe?o.accent:yt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:yt?1:2,opacity:oe||yt?.6:.4,initial:{opacity:0},animate:{opacity:oe||yt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),rt&&jsxs(Fragment,{children:[jsx("line",{x1:O,y1:0,x2:O,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:O+F,y1:0,x2:O+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Z&&!oe&&!e.segments&&!x&&(()=>{let K=a<100,ue=K?a+ke+13:a-82-13,Me=K?`M ${Re+Ae/2-6} ${a+ke+3} L ${Re+Ae/2} ${a+ke+13} L ${Re+Ae/2+6} ${a+ke+3}`:`M ${Re+Ae/2-6} ${a-13} L ${Re+Ae/2} ${a-3} L ${Re+Ae/2+6} ${a-13}`,Ke=ue+22,je=ue+40,Le=ue+55,ft=ue+70,Ct=K?ue+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:K?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:K?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Me,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Re+Ae/2-120,y:ue,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:Ke,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:je,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Re+Ae/2-70,y:je,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.startDate)}),jsx("text",{x:Re+Ae/2-110,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Re+Ae/2-70,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt(e.endDate)}),jsx("text",{x:Re+Ae/2+10,y:je,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Re+Ae/2+65,y:je,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ot()}),jsx("text",{x:Re+Ae/2+10,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Re+Ae/2+65,y:Le,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:ft,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Re+Ae/2-50,y:ft,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(zt=>zt.name).join(", ").substring(0,30),e.assignees.map(zt=>zt.name).join(", ").length>30?"...":""]})]}),!K&&jsx("text",{x:Re+Ae/2,y:Ct,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:kt?"Left: move \u2022 Right: resize":_e?"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 Ad=260,Ln=8,bm=16,Nv=-12;function hm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:b,mouseX:w,mouseY:C}=e,T=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null?155:105,k=w+bm,v=C+Nv-T;k+Ad>window.innerWidth-Ln&&(k=w-Ad-bm),k<Ln&&(k=Ln);let E=v<Ln;E&&(v=C+20),v+T>window.innerHeight-Ln&&(v=window.innerHeight-Ln-T),o({left:k,top:v,showBelow:E});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={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"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let b=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${b} d\xEDa${b!==1?"s":""}`:`${b} day${b!==1?"s":""}`},m=b=>{if(b==null||b===0)return "N/A";let w=Math.floor(b/60),C=b%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Ad,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:x,border:`1px solid ${h}`,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(Ti,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:p}),jsx(Ti,{label:i.duration,value:l(),labelColor:d,valueColor:p}),jsx(Ti,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:p}),jsx(Ti,{label:i.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:[i.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:s.assignees.map(b=>b.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:[i.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsx("span",{style:{color:y,fontWeight:600},children:m(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return createPortal(f,document.body)}function
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=De.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=De.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>De.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=De.findTaskById(e,t);return !a||!a.dependencies?[]:De.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>De.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>De.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=De.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>De.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=De.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],i=s.map(c=>{let l=c.startDate&&c.endDate?De.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?De.formatDate(c.startDate):"N/A",c.endDate?De.formatDate(c.endDate):"N/A",l>0?`${l} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:i,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=De.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,i=h=>{if(!s||!h.assignees||h.assignees.length===0)return n;let f=h.assignees.map(b=>b.id?s[b.id]:void 0).filter(b=>b!=null&&b>0);return f.length===0?n:f.reduce((b,
|
|
130
|
+
`})]});return createPortal(f,document.body)}function Ti({label:e,value:t,labelColor:a,valueColor:r}){return jsxs("div",{children:[jsxs("span",{style:{color:a},children:[e,": "]}),jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function fs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:m,strokeWidthOverride:d,glowFilter:p}){let[,g]=useState(false),[y,x]=useState(null),h=r-t,f=h>0,b=Math.abs(h)<5,w=20,C=!b&&a<=e,N,T,k=a-e,v=e+k/2;T=v;let E=8;if(n==="squared")if(b)N=`M ${e} ${t} L ${a} ${r}`;else if(C){let he=e+15,Ue=a-w,Be=f?t+20:t-20;T=Ue;let nt=f?1:-1;N=`M ${e} ${t} L ${he-E} ${t} Q ${he} ${t} ${he} ${t+nt*E} L ${he} ${Be-nt*E} Q ${he} ${Be} ${he-E} ${Be} L ${Ue+E} ${Be} Q ${Ue} ${Be} ${Ue} ${Be+nt*E} L ${Ue} ${r-nt*E} Q ${Ue} ${r} ${Ue+E} ${r} L ${a} ${r}`;}else {T=a-w;let Fe=f?1:-1;N=`M ${e} ${t} L ${T-E} ${t} Q ${T} ${t} ${T} ${t+Fe*E} L ${T} ${r-Fe*E} Q ${T} ${r} ${T+E} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${v} ${t}, ${v} ${r}, ${a} ${r}`;let I=6,D=5,X=`M ${a} ${r} L ${a-I} ${r-D/2} L ${a-I} ${r+D/2} Z`,O=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),H=m||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),F=d||1,q=o.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),ee="#f87171",Se="rgba(248, 113, 113, 0.15)",R=T,j=(t+r)/2;if(y)if(n==="squared")if(b)R=Math.max(e+10,Math.min(a-10,y.x)),j=t;else if(C){let Fe=e+15,he=a-w,Ue=f?t+20:t-20,Be=[[e,t,Fe,t],[Fe,t,Fe,Ue],[Fe,Ue,he,Ue],[he,Ue,he,r],[he,r,a,r]],nt=1/0,Z={x:R,y:j};for(let st of Be){let oe=be(y.x,y.y,st[0],st[1],st[2],st[3]),rt=Math.hypot(y.x-oe.x,y.y-oe.y);rt<nt&&(nt=rt,Z=oe);}R=Z.x,j=Z.y;}else {let Fe=[[e,t,T,t],[T,t,T,r],[T,r,a,r]],he=1/0,Ue={x:R,y:j};for(let Be of Fe){let nt=be(y.x,y.y,Be[0],Be[1],Be[2],Be[3]),Z=Math.hypot(y.x-nt.x,y.y-nt.y);Z<he&&(he=Z,Ue=nt);}R=Ue.x,j=Ue.y;}else {let Fe=v,he=t,Ue=v,Be=r,nt=1/0,Z=R,st=j;for(let oe=0;oe<=1;oe+=.02){let rt=1-oe,ht=rt*rt*rt*e+3*rt*rt*oe*Fe+3*rt*oe*oe*Ue+oe*oe*oe*a,Ft=rt*rt*rt*t+3*rt*rt*oe*he+3*rt*oe*oe*Be+oe*oe*oe*r,ke=Math.hypot(y.x-ht,y.y-Ft);ke<nt&&(nt=ke,Z=ht,st=Ft);}R=Z,j=st;}function be(Fe,he,Ue,Be,nt,Z){let st=nt-Ue,oe=Z-Be,rt=st*st+oe*oe;if(rt===0)return {x:Ue,y:Be};let ht=((Fe-Ue)*st+(he-Be)*oe)/rt;return ht=Math.max(0,Math.min(1,ht)),{x:Ue+ht*st,y:Be+ht*oe}}let Xe=Fe=>{let he=Fe.currentTarget.ownerSVGElement;if(!he)return;let Ue=he.getScreenCTM();if(!Ue)return;let Be=Ue.inverse();x({x:Be.a*Fe.clientX+Be.c*Fe.clientY+Be.e,y:Be.b*Fe.clientX+Be.d*Fe.clientY+Be.f});},z=()=>{g(false),x(null),c?.(false);},re=()=>{g(true),c?.(true);},J=Fe=>s?jsxs(motion.g,{initial:Fe,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:he=>{he.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:R,cy:j,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:R,cy:j,r:9,fill:Se,stroke:ee,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:R-3,y1:j-3,x2:R+3,y2:j+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:R+3,y1:j-3,x2:R-3,y2:j+3,stroke:ee,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxs("g",{"data-dependency-line":"true",onMouseLeave:z,onMouseMove:Xe,children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:N,fill:"none",stroke:q,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:N,fill:"none",stroke:q,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:X,fill:q,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:q,opacity:.9,style:{pointerEvents:"none"}}),J({opacity:0,scale:.8})]}):l?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Xe,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:N,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:q,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:q,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:X,fill:q,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:q,style:{pointerEvents:"none"}}),J({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Xe,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:N,fill:"none",stroke:H,strokeWidth:F,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:p||"none"}}),jsx(motion.path,{d:X,fill:H,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:H,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Ei({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),i=16,c=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-i/2,y:a+16-i/2,width:i,height:i,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var De={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=l=>{l.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,i=new Set,c=l=>{if(!n.has(l)){n.add(l),i.add(l);let m=r.get(l)||[];for(let d of m){if(!n.has(d)&&c(d))return true;if(i.has(d))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=De.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=De.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=De.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=De.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=De.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=De.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>De.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=De.findTaskById(e,t);return !a||!a.dependencies?[]:De.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>De.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>De.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=De.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>De.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=De.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],i=s.map(c=>{let l=c.startDate&&c.endDate?De.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?De.formatDate(c.startDate):"N/A",c.endDate?De.formatDate(c.endDate):"N/A",l>0?`${l} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:i,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=De.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,i=h=>{if(!s||!h.assignees||h.assignees.length===0)return n;let f=h.assignees.map(b=>b.id?s[b.id]:void 0).filter(b=>b!=null&&b>0);return f.length===0?n:f.reduce((b,w)=>b+w,0)/f.length},c=new Map,l=(h,f="")=>{[...h].sort((w,C)=>(w.position??0)-(C.position??0)).forEach((w,C)=>{let N=f?`${f}.${C+1}`:`${C+1}`;c.set(w.id,N),w.subtasks?.length&&l(w.subtasks,N);});};l(e);let m=s&&Object.keys(s).length>0||o.some(h=>h._costRate>0),d=o.map(h=>{let f=h.startDate&&h.endDate?De.calculateDuration(h.startDate,h.endDate):0,b=h.effortMinutes,w=h.timeLoggedMinutes,C=h.soldEffortMinutes,N=typeof b=="number"?+(b/60).toFixed(1):0,T=typeof w=="number"?+(w/60).toFixed(1):0,k=typeof C=="number"?+(C/60).toFixed(1):0,v=h._costRate>0?h._costRate:i(h),E={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?De.formatDate(h.startDate):"","End Date":h.endDate?De.formatDate(h.endDate):"","Duration (days)":f>0?f:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(I=>I.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":T||"","Quoted (h)":k||""};return m&&(E["$ Estimated"]=N>0&&v>0?Math.round(N*v):"",E["$ Executed"]=T>0&&v>0?Math.round(T*v):"",E["$ Quoted"]=k>0&&v>0?Math.round(k*v):"",E["Rate ($/h)"]=v>0?v:""),E["Is Milestone"]=h.isMilestone?"Yes":"No",E}),p=a?.projectName||"";if(p||d.length>0){let h=0,f=0,b=0,w=0,C=0,N=0,T=0,k=0,v=o.filter(D=>D.startDate).map(D=>D.startDate.getTime()),E=o.filter(D=>D.endDate).map(D=>D.endDate.getTime());for(let D of d)typeof D["Estimated (h)"]=="number"&&(h+=D["Estimated (h)"]),typeof D["Logged (h)"]=="number"&&(f+=D["Logged (h)"]),typeof D["Quoted (h)"]=="number"&&(b+=D["Quoted (h)"]),m&&(typeof D["$ Estimated"]=="number"&&(w+=D["$ Estimated"]),typeof D["$ Executed"]=="number"&&(C+=D["$ Executed"]),typeof D["$ Quoted"]=="number"&&(N+=D["$ Quoted"])),typeof D["Progress (%)"]=="number"&&(T+=D["Progress (%)"],k++);let I={WBS:"0","Task Name":`\u{1F4CB} ${p||"PROJECT TOTAL"}`,"Start Date":v.length>0?De.formatDate(new Date(Math.min(...v))):"","End Date":E.length>0?De.formatDate(new Date(Math.max(...E))):"","Duration (days)":v.length>0&&E.length>0?De.calculateDuration(new Date(Math.min(...v)),new Date(Math.max(...E))):"","Progress (%)":k>0?Math.round(T/k):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+f.toFixed(1)||"","Quoted (h)":+b.toFixed(1)||""};m&&(I["$ Estimated"]=w||"",I["$ Executed"]=C||"",I["$ Quoted"]=N||"",I["Rate ($/h)"]=""),I["Is Milestone"]="No",d.unshift(I);}let g=r.utils.json_to_sheet(d),y=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...m?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];g["!cols"]=y;let x=r.utils.book_new();if(r.utils.book_append_sheet(x,g,"Gantt Tasks"),!t){let h=new Date,f=w=>String(w).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${f(h.getMonth()+1)}-${f(h.getDate())}_${f(h.getHours())}${f(h.getMinutes())}`}.xlsx`;}r.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=De.flattenTasks(e),o=new Map;r.forEach((p,g)=>{o.set(p.id,g+1);});let s=p=>p.toISOString().replace("Z",""),n=De.getEarliestStartDate(e)||new Date,i=De.getLatestEndDate(e)||new Date,c=r.map((p,g)=>{let y=o.get(p.id),x=p.startDate&&p.endDate?De.calculateDuration(p.startDate,p.endDate):0,h=(p.dependencies||[]).filter(f=>o.has(f)).map(f=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${o.get(f)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,m=new Blob([l],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=De.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let m=l.startDate&&l.endDate?De.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let p=d+m;r.set(l.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,i=l=>{if(n.has(l.id))return;let m=l.startDate&&l.endDate?De.calculateDuration(l.startDate,l.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(l.id)),p=s;if(d.length>0)for(let y of d){i(y);let x=n.get(y.id)?.ls||0;p=Math.min(p,x);}let g=p-m;n.set(l.id,{ls:g,lf:p});};a.forEach(i);let c=[];for(let l of a){let m=r.get(l.id),d=n.get(l.id);if(m&&d){let p=d.ls-m.es;Math.abs(p)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=De.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 y=s.get(g);y&&y.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 i=new Map,c=[],l=[];for(let p of r)(n.get(p.id)||0)===0&&l.push(p.id);for(;l.length>0;){let p=l.shift();c.push(p);let g=o.get(p);if(!g||!g.startDate||!g.endDate)continue;let y=De.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=i.get(f);b&&(x=Math.max(x,b.ef));}i.set(p,{es:x,ef:x+y});let h=s.get(p)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&l.push(f);}}if(c.length<r.length)return t;let m=Math.max(...Array.from(i.values()).map(p=>p.ef)),d=new Map;for(let p=c.length-1;p>=0;p--){let g=c[p];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=De.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=m;if(h.length>0)for(let b of h){let v=d.get(b);v&&(f=Math.min(f,v.ls));}d.set(g,{ls:f-x,lf:f});}for(let p of c){let g=i.get(p),y=d.get(p),x=y.ls-g.es,h=s.get(p)||[],f;h.length>0?f=Math.min(...h.map(b=>i.get(b).es))-g.ef:f=m-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=De.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(De.calculateCriticalPath(e).includes(t))return 0;let o=De.getDependentTasks(e,t);if(o.length===0){let i=De.getLatestEndDate(e);if(!i)return null;let c=De.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=o.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let n=De.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>De.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=De.findTaskById(e,t);if(!s||!s.endDate)return e;let n=De.getDependentTasks(e,t);if(n.length===0)return e;let i=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let l=De.calculateDuration(c.startDate,c.endDate),m;if(a!==void 0?(m=new Date(c.startDate),m.setDate(m.getDate()+a)):(m=new Date(s.endDate),m.setDate(m.getDate()+1)),a!==void 0){let g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),m<y&&(m=y);}let d=De.calculateEndDate(m,l),p=g=>g.map(y=>y.id===c.id?{...y,startDate:m,endDate:d}:y.subtasks?{...y,subtasks:p(y.subtasks)}:y);i=p(i),i=De.autoScheduleDependents(i,c.id,a,o);}return i},calculateCascadePreview:(e,t,a,r,o,s,n,i)=>{if(a===0)return [];let c=[],l=o.getTime(),m=1e3*60*60*24,d=De.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=De.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(D=>D.id===f.id);if(b===-1)continue;let v=f.startDate.getTime(),N=(f.endDate.getTime()-v)/m,k=(v-l)/m*s,w=k+y*s,E=Math.max(N*s,s),I=i+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:k,previewX:w,width:E,y:I,rowIndex:b,daysDelta:y,color:f.color}),p(f.id,y,x);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=De.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 i=new Date(o.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:i}],l=m=>m.map(d=>d.id===o.id?{...d,endDate:i,segments:c}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function Mi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:m=true,onTaskClick:d,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:f,showCriticalPath:b=true,showDependencies:v=true,highlightWeekends:C=true,canEditTask:N}){let k=Br(),w=useRef(null),[E,I]=useState([]),[D,X]=useState(null),[O,H]=useState(null),[F,q]=useState(null),ee=useRef(false),[Se,R]=useState(new Set),[j,be]=useState(null),Je=useCallback($=>{if(F&&!ee.current){let de=$.target,S=false;for(;de&&de!==$.currentTarget;){if(de.getAttribute?.("data-dependency-line")==="true"||de.getAttribute?.("data-dependency-hover-overlay")==="true"){S=true;break}de=de.parentElement;}S||q(null);}},[F]),z=useCallback($=>{H($);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,Fe=re*J*n,he=$=>{let de=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),S=de.getUTCDay()||7;de.setUTCDate(de.getUTCDate()+4-S);let Y=new Date(Date.UTC(de.getUTCFullYear(),0,1));return Math.ceil(((de.getTime()-Y.getTime())/864e5+1)/7)},Ue=$=>{let de=$.getDay();return de===0||de===6},Be=useCallback($=>{let de=Math.round($/(J*n)),S=new Date(o);return S.setDate(S.getDate()+de),S},[o,J,n]),nt=useCallback(($,de)=>{if(de.startDate&&de.endDate)return;let S=$.currentTarget.ownerSVGElement;if(!S)return;let Y=S.createSVGPoint();Y.x=$.clientX,Y.y=$.clientY;let le=Y.matrixTransform(S.getScreenCTM()?.inverse()),we=Be(le.x),W=new Date(we);W.setDate(W.getDate()+1),be(null),y?.(de,we,W);},[Be,y]),Z=useCallback(($,de,S)=>{let Y=$.currentTarget.ownerSVGElement;if(!Y)return;let le=Y.createSVGPoint();le.x=$.clientX,le.y=$.clientY;let we=le.matrixTransform(Y.getScreenCTM()?.inverse()),W=Be(we.x),We=Math.round(we.x/(J*n))*J*n;be({taskId:de.id,x:We,y:S*a+a/2,date:W});},[Be,J,n,a]),st=useCallback(()=>{be(null);},[]),oe=useMemo(()=>{let $=le=>le.map(we=>{if(we.subtasks&&we.subtasks.length>0){let W=$(we.subtasks),te=W.filter(We=>We.startDate&&We.endDate);if(te.length>0){let We=te.map(_e=>_e.startDate.getTime()),Ce=te.map(_e=>_e.endDate.getTime()),He=new Date(Math.min(...We)),Ne=new Date(Math.max(...Ce));return {...we,subtasks:W,startDate:He,endDate:Ne}}return {...we,subtasks:W}}return we}),de=(le,we=[])=>{let W=[...le].sort((te,We)=>(te.position??0)-(We.position??0));for(let te of W)we.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&de(te.subtasks,we);return we},S=$(e);return de(S)},[e]),rt=useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let de=$.startDate.getTime(),S=$.endDate.getTime(),Y=o.getTime(),le=(de-Y)/(1e3*60*60*24),we=(S-de)/(1e3*60*60*24)+1,W=le*J*n,te=Math.max(J*n,40),We=Math.max(we*J*n,te);return {x:W,width:We}},[o,J,n]),ht=useMemo(()=>oe.filter($=>$.startDate&&$.endDate).map($=>{let{x:de,width:S}=rt($),le=oe.findIndex(we=>we.id===$.id)*a+(a-18)/2;return {id:$.id,x:de,y:le,width:S,height:18}}),[oe,rt]),Mt=useCallback(($,de,S)=>{if(!S){I([]),X(null);return}if(X({taskId:$,daysDelta:de}),de===0){I([]);return}let Y=De.calculateCascadePreview(e,$,de,oe,o,J*n,a,48);I(Y);},[e,oe,o,J,n,a,48]),ke=useCallback(($,de)=>{if(!D)return de;let S=J*n,Y=D.daysDelta*S;if($===D.taskId)return {x:de.x+Y,width:de.width};let le=E.find(we=>we.taskId===$);return le?{x:le.previewX,width:le.width}:de},[D,E,J,n]),yt=useMemo(()=>{let $=[],de=new Date(o);for(;de<=s;){let le=(de.getTime()-o.getTime())/864e5*J*n;if(r==="day")$.push({date:new Date(de),label:de.toLocaleDateString(i,{day:"numeric",month:"short"}),x:le}),de.setDate(de.getDate()+1);else if(r==="week"){let we=he(de);$.push({date:new Date(de),label:`${k.labels.week} ${we}`,x:le}),de.setDate(de.getDate()+7);}else $.push({date:new Date(de),label:de.toLocaleDateString(i,{month:"short",year:"numeric"}),x:le}),de.setMonth(de.getMonth()+1);}return $},[o,s,r,J,n,i,k.labels.week]),dt=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),at=Math.max(oe.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Fe,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Fe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),yt.map(($,de)=>jsxs("g",{children:[de>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-${de}`)),dt>=0&&dt<=Fe&&jsxs("g",{children:[jsx("circle",{cx:dt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:dt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${dt-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:k.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:w,width:Math.max(Fe,1e3),height:at,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Je,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Fe,1e3),height:at,fill:t.bgPrimary}),oe.map(($,de)=>jsx("rect",{x:0,y:de*a,width:Math.max(Fe,1e3),height:a,fill:de%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${$.id}`)),yt.map(($,de)=>de>0?jsx("line",{x1:$.x,y1:0,x2:$.x,y2:oe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${de}`):null),C&&yt.map(($,de)=>{let S=yt[de+1]?.x||Fe;return Ue($.date)?jsxs("g",{children:[jsx("rect",{x:$.x,y:0,width:S-$.x,height:oe.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:S-$.x,height:oe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${de}`):null}),oe.map(($,de)=>{let S=$.startDate&&$.endDate;return jsx("g",{children:!S&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:de*a,width:Fe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>nt(Y,$),onMouseMove:Y=>Z(Y,$,de),onMouseLeave:()=>{st();}},`clickable-${$.id}`),j&&j.taskId===$.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:j.x,y1:de*a+4,x2:j.x,y2:de*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:j.x,cy:j.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:j.x,cy:j.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${j.x}, ${de*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:j.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!j||j.taskId!==$.id)&&jsx("text",{x:dt>0?dt:100,y:de*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:k.labels.clickToSetDates},`placeholder-${$.id}`)]})},`row-group-${$.id}`)}),oe.map(($,de)=>{if(!$.startDate||!$.endDate)return null;let{x:S,width:Y}=rt($),le=de*a+(a-18)/2,we=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;if($.isMilestone)return jsx(Si,{task:$,x:S+Y/2,y:le+12,theme:t,onClick:d},$.id);if(we){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),te=8,We=le+(a-18)/2+(18-te)/2,Ce=4,He=$.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let _e=$.startDate&&Ne>=$.startDate,wt=$.endDate&&(()=>{let gt=new Date($.endDate);return gt.setHours(0,0,0,0),Ne>gt})(),mt=$.startDate&&Ne<$.startDate,ot=1;if(_e&&$.startDate&&$.endDate&&!mt){let gt=new Date($.startDate);gt.setHours(0,0,0,0);let zt=new Date($.endDate);zt.setHours(0,0,0,0);let Re=Math.max(1,(zt.getTime()-gt.getTime())/(1e3*60*60*24)),ct=Math.min((Ne.getTime()-gt.getTime())/(1e3*60*60*24),Re)/Re*100;ot=ct>0?He/ct:1;}let et;He>=100?et="#00E5CC":mt?et="#4B5563":wt&&He<100?et="#EF4444":ot>=.95?et="#22C55E":ot>=.8?et="#F59E0B":et="#EF4444";let Yt=Math.max(He/100*Y,He>0?Ce*2:0),Ft=Y>100&&He>0,xt=$.isCriticalPath;return jsxs("g",{onClick:()=>d?.($),onContextMenu:gt=>{gt.preventDefault(),gt.stopPropagation(),g?.($,gt);},onMouseMove:gt=>{z({task:$,x:S,y:We,width:Y,height:te,showBelow:We<100,mouseX:gt.clientX,mouseY:gt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:b?xt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:S,y:le,width:Y,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:S,y:We,width:Y,height:te,rx:Ce,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),He>0&&jsx("rect",{x:S,y:We,width:Yt,height:te,rx:Ce,fill:et}),b&&xt&&jsx("rect",{x:S,y:We,width:Y,height:te,rx:Ce,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ft&&jsxs("text",{x:S+Yt+6,y:We+te/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(He),"%"]})]},$.id)}return jsx(ki,{task:$,x:S,y:le,width:Y,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:d,onDoubleClick:p,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:ht,onDragMove:Mt,onHoverChange:z,showBaseline:f,showTaskBarLabels:m,showCriticalPath:b,readOnly:N?!N($):false},$.id)}),v&&oe.map(($,de)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(S=>{let Y=oe.find(et=>et.id===S);if(!Y||!Y.startDate||!Y.endDate)return null;let le=oe.findIndex(et=>et.id===S),we=ke(Y.id,rt(Y)),W=ke($.id,rt($)),te=we.x+we.width,We=le*a+26,Ce=W.x,He=de*a+26,Ne=`dep-${S}-${$.id}`;if(Se.has(Ne))return null;let _e=b&&$.isCriticalPath&&Y.isCriticalPath;return jsx(ms,{x1:te,y1:We,x2:Ce,y2:He,theme:t,lineStyle:l,colorOverride:b?_e?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?_e?2:1:void 0,glowFilter:_e?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.($.id,S),onHoverChange:et=>{ee.current=et,et&&q({key:Ne,fromId:S,toId:$.id,exitX:te,exitY:We,enterX:Ce,enterY:He});}},Ne)})),E.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}`)),v&&F&&jsx(ms,{x1:F.exitX,y1:F.exitY,x2:F.enterX,y2:F.enterY,theme:t,lineStyle:l,onDelete:()=>{let $=F.key;q(null),ee.current=false,R(de=>new Set(de).add($)),h?.(F.toId,F.fromId);},hoverOverlayOnly:true,onHoverChange:$=>{ee.current=$,$||q(null);}},`${F.key}-hover-overlay`),dt>=0&&dt<=Fe&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:dt,y1:0,x2:dt,y2:at,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:dt,y1:0,x2:dt,y2:at,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsx(hm,{tooltipData:O,theme:t,locale:i==="es"?"es":"en"})]})}var Mv=['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"'],vm=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Fv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),Pv=()=>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"})}),Av=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Lv=()=>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 Ai({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:i,onDependencyDelete:c}){let[l,m]=useState(false),[d,p]=useState(false),[g,y]=useState([]),[x,h]=useState(""),[f,b]=useState(false),[v,C]=useState(true),[N,T]=useState(""),[k,w]=useState(-1),[E,I]=useState(false),[D,X]=useState(0),O=useRef(null),H=useRef(null),F=useRef(null),q=useRef(null),{enabled:ee=true,placeholder:Se='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:j,suggestions:be=Mv,maxHistory:Je=50,persistHistory:z,mentionableUsers:re=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Fe=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",he=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ue=J?"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)",Be=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",nt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Z=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",st=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",oe=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",rt=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ht=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Mt=J?"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)",ke=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",yt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",dt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",at=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",$=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",de=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",S=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Y=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",le=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",we="rgba(46, 148, 255, 0.04)",W=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",te=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",We=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ce=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",He=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Ne=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",_e=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",wt=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",mt="rgba(46, 148, 255, 0.06)",ot=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",et=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Yt=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ft=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",xt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Tt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",gt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",zt=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Re=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ae=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ct=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",se=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",fe=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",L=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",_=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",K=z?.storageKey||"gantt-ai-history",ue=z?.maxMessages??5,Me=re.filter(U=>{if(!N)return true;let ne=N.toLowerCase();return U.name.toLowerCase().includes(ne)||U.email&&U.email.toLowerCase().includes(ne)}).slice(0,5),Ke=useCallback(U=>{if(h(U),re.length===0)return;let ne=O.current;if(!ne)return;let Oe=ne.selectionStart||U.length,A=U.slice(0,Oe),ge=A.lastIndexOf("@");if(ge>=0&&((ge>0?A[ge-1]:" ")===" "||ge===0)){let tt=A.slice(ge+1);if(tt.length<=40){T(tt),w(ge),I(true),X(0);return}}I(false),T(""),w(-1);},[re.length]),je=useCallback(U=>{let ne=x.slice(0,k),Oe=x.slice(k+1+N.length),A=`${ne}@${U.name} ${Oe}`;h(A),I(false),T(""),w(-1),setTimeout(()=>O.current?.focus(),0);},[x,k,N]),Le=useCallback(U=>{if(!E||Me.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),X(ne=>ne<Me.length-1?ne+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),X(ne=>ne>0?ne-1:Me.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let ne=Me[D];return ne&&je(ne),true}return U.key==="Escape"?(I(false),true):false},[E,Me,D,je]);useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(K);if(U){let Oe=JSON.parse(U).map(A=>({...A,timestamp:new Date(A.timestamp)}));y(Oe.slice(-ue));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,K,ue]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(ne=>!ne.isLoading).slice(-ue);localStorage.setItem(K,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,K,ue]),useEffect(()=>{H.current&&H.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{l&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[l,d]);let ft=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&&i?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&c?.(U.taskId,U.dependencyFrom);break}},[o,s,n,i,c]),kt=useCallback(async U=>{if(!U.trim()||f)return;let ne={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};y(A=>[...A.slice(-(Je-1)),ne]),h(""),C(false),b(true);let Oe={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(A=>[...A,Oe]);try{if(j){let A=await j(U,e);y(ge=>{let Ve=ge.filter(oa=>!oa.isLoading),tt={id:`assistant-${Date.now()}`,role:"assistant",content:A.message,timestamp:new Date,command:A};return [...Ve,tt]}),ft(A);}else y(A=>[...A.filter(Ve=>!Ve.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(A){y(ge=>[...ge.filter(tt=>!tt.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${A instanceof Error?A.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,Je,j,e,ft]),Ht=U=>{U.preventDefault(),kt(x);},wa=U=>{h(U),O.current?.focus();};if(useEffect(()=>{let U=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="k"&&(ne.preventDefault(),m(Oe=>!Oe),l||p(false)),ne.key==="Escape"&&l&&m(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[l]),useEffect(()=>{if(!l)return;let U=Oe=>{let A=Oe.target;F.current&&!F.current.contains(A)&&m(false);},ne=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(ne),document.removeEventListener("mousedown",U);}},[l]),!ee)return null;let ta={"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(Xt,{children:[jsx(AnimatePresence,{children:!l&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ta[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Fe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${he}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ue,overflow:"visible"},onClick:()=>m(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Be}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${nt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(vm,{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:oe,background:Z,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${st}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
361
|
+
</Project>`,m=new Blob([l],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=De.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let m=l.startDate&&l.endDate?De.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let p=d+m;r.set(l.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,i=l=>{if(n.has(l.id))return;let m=l.startDate&&l.endDate?De.calculateDuration(l.startDate,l.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(l.id)),p=s;if(d.length>0)for(let y of d){i(y);let x=n.get(y.id)?.ls||0;p=Math.min(p,x);}let g=p-m;n.set(l.id,{ls:g,lf:p});};a.forEach(i);let c=[];for(let l of a){let m=r.get(l.id),d=n.get(l.id);if(m&&d){let p=d.ls-m.es;Math.abs(p)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=De.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 y=s.get(g);y&&y.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 i=new Map,c=[],l=[];for(let p of r)(n.get(p.id)||0)===0&&l.push(p.id);for(;l.length>0;){let p=l.shift();c.push(p);let g=o.get(p);if(!g||!g.startDate||!g.endDate)continue;let y=De.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=i.get(f);b&&(x=Math.max(x,b.ef));}i.set(p,{es:x,ef:x+y});let h=s.get(p)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&l.push(f);}}if(c.length<r.length)return t;let m=Math.max(...Array.from(i.values()).map(p=>p.ef)),d=new Map;for(let p=c.length-1;p>=0;p--){let g=c[p];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=De.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=m;if(h.length>0)for(let b of h){let w=d.get(b);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-x,lf:f});}for(let p of c){let g=i.get(p),y=d.get(p),x=y.ls-g.es,h=s.get(p)||[],f;h.length>0?f=Math.min(...h.map(b=>i.get(b).es))-g.ef:f=m-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=De.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(De.calculateCriticalPath(e).includes(t))return 0;let o=De.getDependentTasks(e,t);if(o.length===0){let i=De.getLatestEndDate(e);if(!i)return null;let c=De.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=o.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let n=De.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>De.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=De.findTaskById(e,t);if(!s||!s.endDate)return e;let n=De.getDependentTasks(e,t);if(n.length===0)return e;let i=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let l=De.calculateDuration(c.startDate,c.endDate),m;if(a!==void 0?(m=new Date(c.startDate),m.setDate(m.getDate()+a)):(m=new Date(s.endDate),m.setDate(m.getDate()+1)),a!==void 0){let g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),m<y&&(m=y);}let d=De.calculateEndDate(m,l),p=g=>g.map(y=>y.id===c.id?{...y,startDate:m,endDate:d}:y.subtasks?{...y,subtasks:p(y.subtasks)}:y);i=p(i),i=De.autoScheduleDependents(i,c.id,a,o);}return i},calculateCascadePreview:(e,t,a,r,o,s,n,i)=>{if(a===0)return [];let c=[],l=o.getTime(),m=1e3*60*60*24,d=De.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=De.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(D=>D.id===f.id);if(b===-1)continue;let w=f.startDate.getTime(),N=(f.endDate.getTime()-w)/m,k=(w-l)/m*s,v=k+y*s,E=Math.max(N*s,s),I=i+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:k,previewX:v,width:E,y:I,rowIndex:b,daysDelta:y,color:f.color}),p(f.id,y,x);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=De.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 i=new Date(o.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:i}],l=m=>m.map(d=>d.id===o.id?{...d,endDate:i,segments:c}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function Fi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:m=true,onTaskClick:d,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:f,showCriticalPath:b=true,showDependencies:w=true,highlightWeekends:C=true,canEditTask:N}){let k=Br(),v=useRef(null),[E,I]=useState([]),[D,X]=useState(null),[O,H]=useState(null),[F,q]=useState(null),ee=useRef(false),[Se,R]=useState(new Set),[j,be]=useState(null),Xe=useCallback($=>{if(F&&!ee.current){let de=$.target,S=false;for(;de&&de!==$.currentTarget;){if(de.getAttribute?.("data-dependency-line")==="true"||de.getAttribute?.("data-dependency-hover-overlay")==="true"){S=true;break}de=de.parentElement;}S||q(null);}},[F]),z=useCallback($=>{H($);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,Fe=re*J*n,he=$=>{let de=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),S=de.getUTCDay()||7;de.setUTCDate(de.getUTCDate()+4-S);let Y=new Date(Date.UTC(de.getUTCFullYear(),0,1));return Math.ceil(((de.getTime()-Y.getTime())/864e5+1)/7)},Ue=$=>{let de=$.getDay();return de===0||de===6},Be=useCallback($=>{let de=Math.round($/(J*n)),S=new Date(o);return S.setDate(S.getDate()+de),S},[o,J,n]),nt=useCallback(($,de)=>{if(de.startDate&&de.endDate)return;let S=$.currentTarget.ownerSVGElement;if(!S)return;let Y=S.createSVGPoint();Y.x=$.clientX,Y.y=$.clientY;let le=Y.matrixTransform(S.getScreenCTM()?.inverse()),we=Be(le.x),W=new Date(we);W.setDate(W.getDate()+1),be(null),y?.(de,we,W);},[Be,y]),Z=useCallback(($,de,S)=>{let Y=$.currentTarget.ownerSVGElement;if(!Y)return;let le=Y.createSVGPoint();le.x=$.clientX,le.y=$.clientY;let we=le.matrixTransform(Y.getScreenCTM()?.inverse()),W=Be(we.x),We=Math.round(we.x/(J*n))*J*n;be({taskId:de.id,x:We,y:S*a+a/2,date:W});},[Be,J,n,a]),st=useCallback(()=>{be(null);},[]),oe=useMemo(()=>{let $=le=>le.map(we=>{if(we.subtasks&&we.subtasks.length>0){let W=$(we.subtasks),te=W.filter(We=>We.startDate&&We.endDate);if(te.length>0){let We=te.map(_e=>_e.startDate.getTime()),Ce=te.map(_e=>_e.endDate.getTime()),He=new Date(Math.min(...We)),Ne=new Date(Math.max(...Ce));return {...we,subtasks:W,startDate:He,endDate:Ne}}return {...we,subtasks:W}}return we}),de=(le,we=[])=>{let W=[...le].sort((te,We)=>(te.position??0)-(We.position??0));for(let te of W)we.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&de(te.subtasks,we);return we},S=$(e);return de(S)},[e]),rt=useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let de=$.startDate.getTime(),S=$.endDate.getTime(),Y=o.getTime(),le=(de-Y)/(1e3*60*60*24),we=(S-de)/(1e3*60*60*24)+1,W=le*J*n,te=Math.max(J*n,40),We=Math.max(we*J*n,te);return {x:W,width:We}},[o,J,n]),ht=useMemo(()=>oe.filter($=>$.startDate&&$.endDate).map($=>{let{x:de,width:S}=rt($),le=oe.findIndex(we=>we.id===$.id)*a+(a-18)/2;return {id:$.id,x:de,y:le,width:S,height:18}}),[oe,rt]),Ft=useCallback(($,de,S)=>{if(!S){I([]),X(null);return}if(X({taskId:$,daysDelta:de}),de===0){I([]);return}let Y=De.calculateCascadePreview(e,$,de,oe,o,J*n,a,48);I(Y);},[e,oe,o,J,n,a,48]),ke=useCallback(($,de)=>{if(!D)return de;let S=J*n,Y=D.daysDelta*S;if($===D.taskId)return {x:de.x+Y,width:de.width};let le=E.find(we=>we.taskId===$);return le?{x:le.previewX,width:le.width}:de},[D,E,J,n]),yt=useMemo(()=>{let $=[],de=new Date(o);for(;de<=s;){let le=(de.getTime()-o.getTime())/864e5*J*n;if(r==="day")$.push({date:new Date(de),label:de.toLocaleDateString(i,{day:"numeric",month:"short"}),x:le}),de.setDate(de.getDate()+1);else if(r==="week"){let we=he(de);$.push({date:new Date(de),label:`${k.labels.week} ${we}`,x:le}),de.setDate(de.getDate()+7);}else $.push({date:new Date(de),label:de.toLocaleDateString(i,{month:"short",year:"numeric"}),x:le}),de.setMonth(de.getMonth()+1);}return $},[o,s,r,J,n,i,k.labels.week]),dt=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),at=Math.max(oe.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Fe,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Fe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),yt.map(($,de)=>jsxs("g",{children:[de>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-${de}`)),dt>=0&&dt<=Fe&&jsxs("g",{children:[jsx("circle",{cx:dt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:dt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${dt-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:k.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:v,width:Math.max(Fe,1e3),height:at,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Xe,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#2E94FF",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Fe,1e3),height:at,fill:t.bgPrimary}),oe.map(($,de)=>jsx("rect",{x:0,y:de*a,width:Math.max(Fe,1e3),height:a,fill:de%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${$.id}`)),yt.map(($,de)=>de>0?jsx("line",{x1:$.x,y1:0,x2:$.x,y2:oe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${de}`):null),C&&yt.map(($,de)=>{let S=yt[de+1]?.x||Fe;return Ue($.date)?jsxs("g",{children:[jsx("rect",{x:$.x,y:0,width:S-$.x,height:oe.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:S-$.x,height:oe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${de}`):null}),oe.map(($,de)=>{let S=$.startDate&&$.endDate;return jsx("g",{children:!S&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:de*a,width:Fe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>nt(Y,$),onMouseMove:Y=>Z(Y,$,de),onMouseLeave:()=>{st();}},`clickable-${$.id}`),j&&j.taskId===$.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:j.x,y1:de*a+4,x2:j.x,y2:de*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:j.x,cy:j.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:j.x,cy:j.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${j.x}, ${de*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:j.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!j||j.taskId!==$.id)&&jsx("text",{x:dt>0?dt:100,y:de*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:k.labels.clickToSetDates},`placeholder-${$.id}`)]})},`row-group-${$.id}`)}),oe.map(($,de)=>{if(!$.startDate||!$.endDate)return null;let{x:S,width:Y}=rt($),le=de*a+(a-18)/2,we=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;if($.isMilestone)return jsx(Ei,{task:$,x:S+Y/2,y:le+12,theme:t,onClick:d},$.id);if(we){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),te=8,We=le+(a-18)/2+(18-te)/2,Ce=4,He=$.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let _e=$.startDate&&Ne>=$.startDate,kt=$.endDate&&(()=>{let gt=new Date($.endDate);return gt.setHours(0,0,0,0),Ne>gt})(),mt=$.startDate&&Ne<$.startDate,ot=1;if(_e&&$.startDate&&$.endDate&&!mt){let gt=new Date($.startDate);gt.setHours(0,0,0,0);let Wt=new Date($.endDate);Wt.setHours(0,0,0,0);let Re=Math.max(1,(Wt.getTime()-gt.getTime())/(1e3*60*60*24)),ct=Math.min((Ne.getTime()-gt.getTime())/(1e3*60*60*24),Re)/Re*100;ot=ct>0?He/ct:1;}let et;He>=100?et="#00E5CC":mt?et="#4B5563":kt&&He<100?et="#EF4444":ot>=.95?et="#22C55E":ot>=.8?et="#F59E0B":et="#EF4444";let Yt=Math.max(He/100*Y,He>0?Ce*2:0),Pt=Y>100&&He>0,vt=$.isCriticalPath;return jsxs("g",{onClick:()=>d?.($),onContextMenu:gt=>{gt.preventDefault(),gt.stopPropagation(),g?.($,gt);},onMouseMove:gt=>{z({task:$,x:S,y:We,width:Y,height:te,showBelow:We<100,mouseX:gt.clientX,mouseY:gt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:b?vt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:S,y:le,width:Y,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:S,y:We,width:Y,height:te,rx:Ce,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),He>0&&jsx("rect",{x:S,y:We,width:Yt,height:te,rx:Ce,fill:et}),b&&vt&&jsx("rect",{x:S,y:We,width:Y,height:te,rx:Ce,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Pt&&jsxs("text",{x:S+Yt+6,y:We+te/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(He),"%"]})]},$.id)}return jsx(Ci,{task:$,x:S,y:le,width:Y,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:d,onDoubleClick:p,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:ht,onDragMove:Ft,onHoverChange:z,showBaseline:f,showTaskBarLabels:m,showCriticalPath:b,readOnly:N?!N($):false},$.id)}),w&&oe.map(($,de)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(S=>{let Y=oe.find(et=>et.id===S);if(!Y||!Y.startDate||!Y.endDate)return null;let le=oe.findIndex(et=>et.id===S),we=ke(Y.id,rt(Y)),W=ke($.id,rt($)),te=we.x+we.width,We=le*a+26,Ce=W.x,He=de*a+26,Ne=`dep-${S}-${$.id}`;if(Se.has(Ne))return null;let _e=b&&$.isCriticalPath&&Y.isCriticalPath;return jsx(fs,{x1:te,y1:We,x2:Ce,y2:He,theme:t,lineStyle:l,colorOverride:b?_e?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?_e?2:1:void 0,glowFilter:_e?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.($.id,S),onHoverChange:et=>{ee.current=et,et&&q({key:Ne,fromId:S,toId:$.id,exitX:te,exitY:We,enterX:Ce,enterY:He});}},Ne)})),E.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}`)),w&&F&&jsx(fs,{x1:F.exitX,y1:F.exitY,x2:F.enterX,y2:F.enterY,theme:t,lineStyle:l,onDelete:()=>{let $=F.key;q(null),ee.current=false,R(de=>new Set(de).add($)),h?.(F.toId,F.fromId);},hoverOverlayOnly:true,onHoverChange:$=>{ee.current=$,$||q(null);}},`${F.key}-hover-overlay`),dt>=0&&dt<=Fe&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:dt,y1:0,x2:dt,y2:at,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:dt,y1:0,x2:dt,y2:at,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsx(hm,{tooltipData:O,theme:t,locale:i==="es"?"es":"en"})]})}var Mv=['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"'],vm=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Fv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),Pv=()=>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"})}),Av=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Lv=()=>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 Li({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:i,onDependencyDelete:c}){let[l,m]=useState(false),[d,p]=useState(false),[g,y]=useState([]),[x,h]=useState(""),[f,b]=useState(false),[w,C]=useState(true),[N,T]=useState(""),[k,v]=useState(-1),[E,I]=useState(false),[D,X]=useState(0),O=useRef(null),H=useRef(null),F=useRef(null),q=useRef(null),{enabled:ee=true,placeholder:Se='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:j,suggestions:be=Mv,maxHistory:Xe=50,persistHistory:z,mentionableUsers:re=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Fe=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",he=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ue=J?"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)",Be=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",nt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Z=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",st=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",oe=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",rt=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ht=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ft=J?"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)",ke=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",yt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",dt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",at=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",$=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",de=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",S=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Y=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",le=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",we="rgba(46, 148, 255, 0.04)",W=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",te=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",We=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ce=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",He=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Ne=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",_e=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",kt=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",mt="rgba(46, 148, 255, 0.06)",ot=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",et=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Yt=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Pt=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",vt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Nt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",gt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Wt=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Re=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ae=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ct=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",se=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",fe=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",L=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",_=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",K=z?.storageKey||"gantt-ai-history",ue=z?.maxMessages??5,Me=re.filter(U=>{if(!N)return true;let ne=N.toLowerCase();return U.name.toLowerCase().includes(ne)||U.email&&U.email.toLowerCase().includes(ne)}).slice(0,5),Ke=useCallback(U=>{if(h(U),re.length===0)return;let ne=O.current;if(!ne)return;let Oe=ne.selectionStart||U.length,A=U.slice(0,Oe),ge=A.lastIndexOf("@");if(ge>=0&&((ge>0?A[ge-1]:" ")===" "||ge===0)){let tt=A.slice(ge+1);if(tt.length<=40){T(tt),v(ge),I(true),X(0);return}}I(false),T(""),v(-1);},[re.length]),je=useCallback(U=>{let ne=x.slice(0,k),Oe=x.slice(k+1+N.length),A=`${ne}@${U.name} ${Oe}`;h(A),I(false),T(""),v(-1),setTimeout(()=>O.current?.focus(),0);},[x,k,N]),Le=useCallback(U=>{if(!E||Me.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),X(ne=>ne<Me.length-1?ne+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),X(ne=>ne>0?ne-1:Me.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let ne=Me[D];return ne&&je(ne),true}return U.key==="Escape"?(I(false),true):false},[E,Me,D,je]);useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(K);if(U){let Oe=JSON.parse(U).map(A=>({...A,timestamp:new Date(A.timestamp)}));y(Oe.slice(-ue));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,K,ue]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(ne=>!ne.isLoading).slice(-ue);localStorage.setItem(K,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,K,ue]),useEffect(()=>{H.current&&H.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{l&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[l,d]);let ft=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&&i?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&c?.(U.taskId,U.dependencyFrom);break}},[o,s,n,i,c]),Ct=useCallback(async U=>{if(!U.trim()||f)return;let ne={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};y(A=>[...A.slice(-(Xe-1)),ne]),h(""),C(false),b(true);let Oe={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(A=>[...A,Oe]);try{if(j){let A=await j(U,e);y(ge=>{let Ve=ge.filter(oa=>!oa.isLoading),tt={id:`assistant-${Date.now()}`,role:"assistant",content:A.message,timestamp:new Date,command:A};return [...Ve,tt]}),ft(A);}else y(A=>[...A.filter(Ve=>!Ve.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(A){y(ge=>[...ge.filter(tt=>!tt.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${A instanceof Error?A.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,Xe,j,e,ft]),zt=U=>{U.preventDefault(),Ct(x);},Ca=U=>{h(U),O.current?.focus();};if(useEffect(()=>{let U=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="k"&&(ne.preventDefault(),m(Oe=>!Oe),l||p(false)),ne.key==="Escape"&&l&&m(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[l]),useEffect(()=>{if(!l)return;let U=Oe=>{let A=Oe.target;F.current&&!F.current.contains(A)&&m(false);},ne=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(ne),document.removeEventListener("mousedown",U);}},[l]),!ee)return null;let ta={"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(Xt,{children:[jsx(AnimatePresence,{children:!l&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ta[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Fe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${he}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ue,overflow:"visible"},onClick:()=>m(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Be}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${nt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(vm,{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:oe,background:Z,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${st}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ta[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:rt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ht}`,boxShadow:Mt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ke,borderBottom:`1px solid ${yt}`},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:dt,border:`1px solid ${at}`,color:"#2E94FF"},children:jsx(vm,{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:de},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsx(Av,{})}),jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsx(Pv,{})})]})]}),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&&v&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:le,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:be.slice(0,4).map((U,ne)=>jsx("button",{onClick:()=>wa(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:we,color:te,border:`1px solid ${W}`},onMouseEnter:Oe=>{Oe.currentTarget.style.borderColor=We,Oe.currentTarget.style.color="#2E94FF";},onMouseLeave:Oe=>{Oe.currentTarget.style.borderColor=W,Oe.currentTarget.style.color=te;},children:U.length>30?U.slice(0,30)+"...":U},ne))})]}),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"?Ce:Ne,color:U.role==="user"?"#2E94FF":wt,border:U.role==="user"?`1px solid ${He}`:`1px solid ${_e}`},children:[U.isLoading?jsx(Lv,{}):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:H})]}),jsxs("form",{onSubmit:U=>{if(E&&Me.length>0){U.preventDefault();return}Ht(U);},className:"p-3 relative",style:{borderTop:`1px solid ${mt}`},children:[jsx(AnimatePresence,{children:E&&Me.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:zt,border:`1px solid ${Re}`,boxShadow:Ae,backdropFilter:"blur(12px)"},children:Me.map((U,ne)=>jsxs("button",{type:"button",onClick:()=>je(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ne===D?ct:"transparent",color:se},onMouseEnter:()=>X(ne),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:L,border:`1px solid ${_}`,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:fe},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:ot,border:`1px solid ${et}`},children:[jsx("input",{ref:O,type:"text",value:x,onChange:U=>Ke(U.target.value),onKeyDown:U=>{Le(U);},placeholder:Se,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Yt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Ft:"transparent",color:x.trim()?"#2E94FF":Tt,border:x.trim()?`1px solid ${xt}`:"1px solid transparent"},children:jsx(Fv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:gt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function wm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((l,m=true)=>{r(d=>{let p=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:p};if(!m)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let m=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[l.present,...l.future]}});},[]),i=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let m=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:m,future:d}});},[]),c=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function km({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Ov={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${De.formatDate(e.startDate)} - ${De.formatDate(e.endDate)}`);let a=De.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>De.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Cm(e){return {...Ov,...e}}var _v=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Dm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:m,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:x,clearFiltersKey:h,aiAssistant:f,locale:b="en",customTranslations:v,showCreateTaskButton:C=false,createTaskLabel:N,onCreateTask:T,taskFilter:k,onTaskFilterChange:w,toolbarRightContent:E,showBaseline:I,viewMode:D,onViewModeChange:X,projectForecast:O,onThemeChange:H,onTaskClick:F,onTaskDblClick:q,onTaskContextMenu:ee,onTaskUpdate:Se,onDependentTasksScheduled:R,onProgressChange:j,onTaskEdit:be,onTaskAddSubtask:Je,onTaskMarkIncomplete:z,onTaskSetInProgress:re,onDependencyCreate:J,onDependencyDelete:Fe,onBeforeTaskAdd:he,onAfterTaskAdd:Ue,onBeforeTaskUpdate:Be,onAfterTaskUpdate:nt,onBeforeTaskDelete:Z,onAfterTaskDelete:st,permissions:oe,onCopySnapshotLink:rt}=a,Mt=useContext(mi)?.theme,[ke,yt]=useState(Mt||s||"dark"),[dt,at]=useState(n),[$,de]=useState(i),[S,Y]=useState(1),[le,we]=useState("all"),[W,te]=useState(D||"execution"),We=D??W,Ce=useCallback(M=>{te(M),X?.(M);},[X]),He=I??We==="oracle",[Ne,_e]=useState(a.showCriticalPath!==false),[wt,mt]=useState(a.showDependencies!==false),[ot,et]=useState(a.highlightWeekends!==false),Yt=useCallback(M=>{_e(M),a.onShowCriticalPathChange?.(M);},[a.onShowCriticalPathChange]),Ft=useCallback(M=>{mt(M),a.onShowDependenciesChange?.(M);},[a.onShowDependenciesChange]),xt=useCallback(M=>{et(M),a.onHighlightWeekendsChange?.(M);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(dt);},[dt]),useEffect(()=>{a.onZoomChange?.(S);},[S]);let Tt=useRef(a.onDateRangeChange);Tt.current=a.onDateRangeChange;let gt=useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[zt,Re]=useState(()=>{if(!x)return "all";try{let M=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(M);if(B){let V=JSON.parse(B);if(V.taskFilter)return V.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),Ae=k??zt,ct=w??Re,[se,fe]=useState(()=>{if(!x)return false;try{let M=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(M);if(B){let V=JSON.parse(B);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=gt();if(M)try{let B={taskFilter:Ae,hideCompleted:se};localStorage.setItem(M,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving filter state to localStorage:",B);}},[Ae,se,gt]);let L=useRef(h);useEffect(()=>{if(L.current!==h&&h!==void 0){Re("all"),fe(false);let M=gt();if(M)try{localStorage.removeItem(M);}catch(B){console.warn("[GanttBoard] Error clearing filter state from localStorage:",B);}}L.current=h;},[h,gt]);let[_,K]=useState(0),[ue,Me]=useState(false),[Ke,je]=useState(null),[Le,ft]=useState({isOpen:false,x:0,y:0,task:null}),[kt,Ht]=useState(null),[wa,ta]=useState(null);useEffect(()=>{Mt&&Mt!==ke&&yt(Mt);},[Mt]),useEffect(()=>{s&&s!==ke&&yt(s);},[s]);let U=useCallback(M=>{yt(M),H?.(M);},[H]),{state:ne,setState:Oe,undo:A,redo:ge,canUndo:Ve,canRedo:tt,clearHistory:oa}=wm(t,50),Wt=useMemo(()=>{let M=(B,V=0)=>{let Q=V;for(let xe of B)xe.subtasks?.length&&(Q=Math.max(Q,M(xe.subtasks,V+1)));return Q};return M(ne)+1},[ne]),ka=useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),Ca=useRef(new Map),Wa=useRef(false);if(!Wa.current&&y){Wa.current=true;let M=typeof y=="string"?y:"gantt-expanded-tasks";try{let B=localStorage.getItem(M);if(B){let V=JSON.parse(B);Array.isArray(V)&&(Ca.current=new Map(V));}}catch(B){console.warn("[GanttBoard] Error loading expanded state from localStorage:",B);}}let fa=useCallback(()=>{let M=ka();if(M)try{let B=Array.from(Ca.current.entries());localStorage.setItem(M,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving expanded state to localStorage:",B);}},[ka]),nr=useRef(0),P=useRef(ne);useEffect(()=>{P.current=ne;},[ne]);let ce=useRef(false),Te=useCallback(M=>{we(M),nr.current+=1,Oe(B=>{let V=(xe,Pe=0)=>xe.map(Nt=>{let it=M==="all"||Pe<M-1;return Nt.subtasks?.length&&Ca.current.set(Nt.id,it),{...Nt,isExpanded:it,subtasks:Nt.subtasks?V(Nt.subtasks,Pe+1):void 0}}),Q=V(B);return fa(),Q});},[Oe,fa]);useEffect(()=>{if(nr.current>0){nr.current-=1;return}let M=V=>{let Q=new Map;for(let xe of V){let Pe=xe.id;Q.get(Pe)||Q.set(Pe,xe);}return Array.from(Q.values())},B=V=>V.map(Q=>{let xe=Ca.current.get(Q.id),Pe=xe!==void 0?{...Q,isExpanded:xe}:Q;if(Pe.subtasks?.length){let Nt=M(Pe.subtasks);return {...Pe,subtasks:B(Nt)}}return Pe});if(Ca.current.size>0)Oe(Rr(B(t)));else {let V=Q=>Q.map(xe=>xe.subtasks?.length?{...xe,subtasks:M(V(xe.subtasks))}:xe);Oe(Rr(V(t)));}},[t,Oe]);let ze=useRef(t),Ze=useRef(true);useEffect(()=>{if(Ze.current){Ze.current=false,ze.current=ne;return}if(ce.current){ce.current=false,ze.current=ne;return}if(!r)return;let M=JSON.stringify(ze.current),B=JSON.stringify(ne);M!==B&&(ze.current=ne,r(ne));},[ne,r]);let Xe=useMemo(()=>yd(b,v),[b,v]),ye=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ge,Ct]=useState(()=>ye(Xe));useEffect(()=>{Ct(M=>M.map(B=>({...B,label:Xe.columns[B.id==="name"?"taskName":B.id]||B.label})));},[Xe]);let Dt=useMemo(()=>Ge.filter(B=>B.visible).reduce((B,V)=>B+V.width,0),[Ge]),Rt=useRef(Ge.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=Ge.filter(Q=>Q.visible),B=M.map(Q=>Q.id).join(","),V=Rt.current;if(B!==V){let Q=M.some(Pe=>Pe.id!=="name"),xe=V.includes(",");Q?!xe&&Q&&je(null):je(null),Rt.current=B;}},[Ge]);let Ot=60,Ut=.6,pa=useMemo(()=>{let B=Dt+Ot,V=typeof window<"u"?window.innerWidth*Ut:800,Q=Math.max(B,V);return Ke!==null?Math.max(200,Math.min(Ke,Q)):Math.max(200,B)},[Ke,Dt]),Ba=useRef(null),Ga=useRef(null),Sa=useRef(null),qa=useRef(null),_t=useMemo(()=>zp(ke),[ke]),Is=useMemo(()=>({theme:_t,themeName:ke}),[_t,ke]),_c=useMemo(()=>Cm(p),[p]),il=useMemo(()=>{if(!g)return ne;let M=De.calculateCriticalPathFull(ne),B=V=>V.map(Q=>{let xe=M.get(Q.id),Pe=Q.subtasks?B(Q.subtasks):void 0,Nt=Pe?.some(Ea=>Ea.isCriticalPath||Ea.subtasks&&Ea.subtasks.some(qt=>qt.isCriticalPath))||false,it=xe?xe.isCritical:Nt;return {...Q,isCriticalPath:it,cpmData:xe||void 0,subtasks:Pe}});return B(ne)},[ne,g]),of=useMemo(()=>De.flattenTasks(ne).some(B=>B.dependencies&&B.dependencies.length>0),[ne]),jc=useMemo(()=>{if(Ae==="all"&&!se)return il;let M=B=>{let V=[];for(let Q of B){let xe=Q.subtasks?.length?M(Q.subtasks):void 0,Pe=false;if(se)Pe=Q.progress<100;else switch(Ae){case "all":Pe=true;break;case "incomplete":Pe=Q.progress<100;break;case "in_progress":Pe=Q.progress>0&&Q.progress<100;break;case "completed":Pe=Q.progress===100;break}(Pe||xe&&xe.length>0)&&V.push({...Q,subtasks:xe});}return V};return M(il)},[il,Ae,se]),Bs=_v($);km({undo:A,redo:ge,canUndo:Ve,canRedo:tt,enabled:true}),useImperativeHandle(o,()=>({getTask:M=>De.findTaskById(ne,M),addTask:(M,B)=>{Oe(V=>{if(!B)return [...V,{...M,level:0}];let Q=xe=>xe.map(Pe=>Pe.id===B?{...Pe,subtasks:[...Pe.subtasks||[],{...M,parentId:B,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(V)});},updateTask:(M,B)=>{Oe(V=>{let Q=xe=>xe.map(Pe=>Pe.id===M?{...Pe,...B}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(V)});},deleteTask:M=>{Oe(B=>{let V=Q=>Q.filter(xe=>xe.id===M?false:(xe.subtasks&&(xe.subtasks=V(xe.subtasks)),true));return V(B)});},deleteTasks:M=>{Oe(B=>Sd(B,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let B=De.findTaskById(ne,M);B&&a.onTaskDuplicate(B);}else Oe(B=>us(B,[M]).tasks);},splitTask:(M,B,V=3)=>{Oe(Q=>De.splitTask(Q,M,B,V));},calculateEndDate:De.calculateEndDate,calculateDuration:De.calculateDuration,validateDependency:(M,B)=>!De.validateDependencies(ne,M,B),getAllTasks:()=>De.flattenTasks(ne),getTasksByStatus:M=>De.flattenTasks(ne).filter(B=>B.status===M),getTasksByParent:M=>M?De.findTaskById(ne,M)?.subtasks||[]:ne.filter(V=>!V.parentId),getCriticalPath:()=>De.flattenTasks(ne).filter(M=>M.isCriticalPath),indentTask:M=>{Oe(B=>Rr(Td(B,[M])));},outdentTask:M=>{Oe(B=>Rr(Nd(B,[M])));},moveTask:(M,B)=>{Oe(V=>Dd(V,[M],B));},createSubtask:async M=>{let{tasks:B,newTask:V}=Fd(ne,M);if(he){let Q=he({...V,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}Oe(Rr(B)),Ue&&Ue({...V,parentId:M});},scrollToTask:M=>{let V=De.flattenTasks(ne).findIndex(Q=>Q.id===M);if(V!==-1&&Ba.current){let Q=V*Bs;Ba.current.scrollTo({top:Q,behavior:"smooth"}),Sa.current&&Sa.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,B=2e3)=>{},expandTask:M=>{Oe(B=>{let V=Q=>Q.map(xe=>xe.id===M?{...xe,isExpanded:true}:xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe);return V(B)});},collapseTask:M=>{Oe(B=>{let V=Q=>Q.map(xe=>xe.id===M?{...xe,isExpanded:false}:xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe);return V(B)});},expandAll:()=>{Oe(M=>{let B=V=>V.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(M)});},collapseAll:()=>{Oe(M=>{let B=V=>V.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(M)});},collapseToLevel:M=>{Te(M);},undo:A,redo:ge,canUndo:()=>Ve,canRedo:()=>tt,clearHistory:oa,exportToPNG:async()=>{if(!qa.current||!Ba.current||!Sa.current)throw new Error("Gantt container not found");let M=qa.current,B=Ba.current,V=Ga.current||B.querySelector(".gantt-grid-scroll"),Q=Sa.current,xe=V?.scrollTop||0,Pe=Q.scrollTop,Nt=M.style.overflow,it=M.style.height,Ea=B.style.overflow;try{let qt=V?.querySelector(".gantt-taskgrid-content"),ca=Q.querySelector("svg"),cr=qt?.scrollHeight||V?.scrollHeight||600,Dr=ca?.getBoundingClientRect().height||Q.scrollHeight,Wo=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(cr,Dr)+20;V&&(V.scrollTop=0),Q.scrollTop=0,M.style.overflow="visible",M.style.height=`${Wo}px`,B.style.overflow="visible",await new Promise(gn=>setTimeout(gn,100));let eo=await toPng(M,{backgroundColor:_t.bgPrimary,pixelRatio:2,filter:gn=>{if(!(gn instanceof Element))return !0;let Rs=window.getComputedStyle(gn),_n=parseInt(Rs.zIndex,10);return (isNaN(_n)||_n<50)&&Rs.position!=="fixed"}});return await(await fetch(eo)).blob()}finally{M.style.overflow=Nt,M.style.height=it,B.style.overflow=Ea,V&&(V.scrollTop=xe),Q.scrollTop=Pe;}},exportToPDF:async M=>{await De.exportToPDF(ne,M);},exportToExcel:async M=>{await De.exportToExcel(ne,M,ul.current);},exportToJSON:()=>De.exportToJSON(ne),exportToCSV:()=>De.exportToCSV(ne),importFromJSON:M=>{let B=De.importFromJSON(M);Oe(B);},getTasks:()=>ne,refresh:()=>{Oe(M=>[...M]);},clearAll:()=>{Oe([]);}}),[ne,A,ge,Ve,tt,oa,_t,Bs]);let nf=useCallback(M=>{Ct(B=>B.map(V=>V.id===M?{...V,visible:!V.visible}:V));},[]),sf=useCallback((M,B)=>{Ct(V=>V.map(Q=>{if(Q.id!==M)return Q;let xe=Q.minWidth??100,Pe=Q.maxWidth??800,Nt=Math.max(xe,Math.min(Pe,B));return {...Q,width:Nt}}));},[]),lf=useCallback(M=>{Oe(B=>{let V=Md(B,M),Q=xe=>{for(let Pe of xe){if(Pe.id===M){Ca.current.set(M,Pe.isExpanded??true);return}Pe.subtasks?.length&&Q(Pe.subtasks);}};return Q(V),fa(),V}),a.onTaskToggleExpand?.(M);},[a,fa]),cn=useCallback((M,B)=>{if(Be&&Be(M,B)===false)return;let Q=De.findTaskById(ne,M)?.progress,xe=Nt=>Nt.map(it=>it.id===M?{...it,...B}:it.subtasks?{...it,subtasks:xe(it.subtasks)}:it);Oe(xe(ne));let Pe=De.findTaskById(xe(ne),M);Pe&&(Se?.(Pe),nt?.(Pe),B.progress!==void 0&&Q!==void 0&&B.progress!==Q&&j?.(M,Q,B.progress));},[ne,Se,Be,nt,j]),df=useCallback(M=>{M.length!==0&&(nr.current+=1,ce.current=true,Oe(B=>Rr(Td(B,M))),a.onTaskIndent?.(M[0]));},[a]),cf=useCallback(M=>{M.length!==0&&(nr.current+=1,ce.current=true,Oe(B=>Rr(Nd(B,M))),a.onTaskOutdent?.(M[0]));},[a]),uf=useCallback((M,B,V)=>{nr.current+=1,ce.current=true,Oe(Q=>Rr(lm(Q,M,B,V))),a.onTaskReparent?.(M,B,V);},[a]),pf=useCallback((M,B)=>{M.length!==0&&(nr.current+=1,ce.current=true,Oe(V=>Dd(V,M,B)),a.onTaskMove?.(M[0],B));},[a]),ll=useCallback(async M=>{let B=[];for(let V of M)Z&&await Promise.resolve(Z(V))===false||B.push(V);B.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(B):(Oe(V=>Rr(Sd(V,B))),B.forEach(V=>a.onTaskDelete?.(V))),st&&B.forEach(V=>st(V)));},[a,Z,st]),mf=useCallback(M=>{a.onTaskDuplicate?M.forEach(B=>{let V=De.findTaskById(ne,B);V&&a.onTaskDuplicate(V);}):Oe(B=>us(B,M).tasks);},[a,ne]),gf=useCallback((M,B)=>{Oe(V=>{let{tasks:Q,newTask:xe}=im(V,M,B);return he&&he(xe)===false?V:(a.onTaskCreate?.(xe.parentId,xe.position||0),Ue?.(xe),Q)});},[a,he,Ue]),ff=useCallback((M,B)=>{Oe(V=>Ed(V,M,B)),a.onTaskRename?.(M,B);},[a]),dl=useCallback(M=>{let{onTaskAddSubtask:B}=a;if(B){let V=hi(ne,M);if(V){B(V);return}}Oe(V=>{let{tasks:Q}=Fd(V,M);return a.onTaskCreate?.(M,0),Q});},[a,ne]),bf=useCallback((M,B,V)=>{let Q=!M.startDate&&!M.endDate,xe=M.startDate?Math.round((B.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,Pe=qt=>qt.map(ca=>ca.id===M.id?{...ca,startDate:B,endDate:V,...M.segments&&{segments:M.segments}}:ca.subtasks?{...ca,subtasks:Pe(ca.subtasks)}:ca),Nt=Pe(ne),it=Nt;Nt=De.autoScheduleDependents(Nt,M.id,xe),Nt=Rr(Nt),Oe(Nt);let Ea={...M,startDate:B,endDate:V};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(M,B,V):Se?.(Ea),R&&xe!==0){let qt=De.flattenTasks(it),ca=De.flattenTasks(Nt),cr=[];for(let Dr of ca){if(Dr.id===M.id)continue;let wo=qt.find(eo=>eo.id===Dr.id);if(!wo)continue;let mn=Dr.startDate?.getTime()!==wo.startDate?.getTime(),Wo=Dr.endDate?.getTime()!==wo.endDate?.getTime();(mn||Wo)&&cr.push(Dr);}cr.length>0&&R(cr);}},[ne,Se,R,a]),hf=useCallback((M,B)=>{ee?.(M,B),ft({isOpen:true,x:B.clientX,y:B.clientY,task:M});},[ee]),yf=useCallback((M,B)=>{let V=De.splitTask(ne,M.id,B);Oe(V),ft({isOpen:false,x:0,y:0,task:null});},[ne]),Kc=useCallback(M=>{let B=De.findTaskById(ne,M.id)||M;q?.(B),be||Ht(B);},[ne,q,be]),Yc=useCallback((M,B,V)=>{let Q=new Map,xe=qt=>{qt.forEach(ca=>{ca.dependencies&&Q.set(ca.id,ca.dependencies),ca.subtasks&&xe(ca.subtasks);});};xe(V);let Pe=Q.get(B)||[];Q.set(B,[...Pe,M]);let Nt=new Set,it=new Set,Ea=qt=>{if(!Nt.has(qt)){Nt.add(qt),it.add(qt);let ca=Q.get(qt)||[];for(let cr of ca){if(!Nt.has(cr)&&Ea(cr))return true;if(it.has(cr))return true}}return it.delete(qt),false};return Ea(B)},[]),qc=useCallback((M,B)=>{if(Yc(M.id,B,P.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ta[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:rt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ht}`,boxShadow:Ft},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ke,borderBottom:`1px solid ${yt}`},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:dt,border:`1px solid ${at}`,color:"#2E94FF"},children:jsx(vm,{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:de},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsx(Av,{})}),jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsx(Pv,{})})]})]}),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&&w&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:le,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:be.slice(0,4).map((U,ne)=>jsx("button",{onClick:()=>Ca(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:we,color:te,border:`1px solid ${W}`},onMouseEnter:Oe=>{Oe.currentTarget.style.borderColor=We,Oe.currentTarget.style.color="#2E94FF";},onMouseLeave:Oe=>{Oe.currentTarget.style.borderColor=W,Oe.currentTarget.style.color=te;},children:U.length>30?U.slice(0,30)+"...":U},ne))})]}),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"?Ce:Ne,color:U.role==="user"?"#2E94FF":kt,border:U.role==="user"?`1px solid ${He}`:`1px solid ${_e}`},children:[U.isLoading?jsx(Lv,{}):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:H})]}),jsxs("form",{onSubmit:U=>{if(E&&Me.length>0){U.preventDefault();return}zt(U);},className:"p-3 relative",style:{borderTop:`1px solid ${mt}`},children:[jsx(AnimatePresence,{children:E&&Me.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:Wt,border:`1px solid ${Re}`,boxShadow:Ae,backdropFilter:"blur(12px)"},children:Me.map((U,ne)=>jsxs("button",{type:"button",onClick:()=>je(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ne===D?ct:"transparent",color:se},onMouseEnter:()=>X(ne),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:L,border:`1px solid ${_}`,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:fe},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:ot,border:`1px solid ${et}`},children:[jsx("input",{ref:O,type:"text",value:x,onChange:U=>Ke(U.target.value),onKeyDown:U=>{Le(U);},placeholder:Se,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Yt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Pt:"transparent",color:x.trim()?"#2E94FF":Nt,border:x.trim()?`1px solid ${vt}`:"1px solid transparent"},children:jsx(Fv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:gt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function wm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((l,m=true)=>{r(d=>{let p=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:p};if(!m)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let m=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[l.present,...l.future]}});},[]),i=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let m=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:m,future:d}});},[]),c=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function km({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Ov={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${De.formatDate(e.startDate)} - ${De.formatDate(e.endDate)}`);let a=De.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>De.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Cm(e){return {...Ov,...e}}var _v=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Dm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:m,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:x,clearFiltersKey:h,aiAssistant:f,locale:b="en",customTranslations:w,showCreateTaskButton:C=false,createTaskLabel:N,onCreateTask:T,taskFilter:k,onTaskFilterChange:v,toolbarRightContent:E,showBaseline:I,viewMode:D,onViewModeChange:X,projectForecast:O,onThemeChange:H,onTaskClick:F,onTaskDblClick:q,onTaskContextMenu:ee,onTaskUpdate:Se,onDependentTasksScheduled:R,onProgressChange:j,onTaskEdit:be,onTaskAddSubtask:Xe,onTaskMarkIncomplete:z,onTaskSetInProgress:re,onDependencyCreate:J,onDependencyDelete:Fe,onBeforeTaskAdd:he,onAfterTaskAdd:Ue,onBeforeTaskUpdate:Be,onAfterTaskUpdate:nt,onBeforeTaskDelete:Z,onAfterTaskDelete:st,permissions:oe,onCopySnapshotLink:rt}=a,Ft=useContext(gi)?.theme,[ke,yt]=useState(Ft||s||"dark"),[dt,at]=useState(n),[$,de]=useState(i),[S,Y]=useState(1),[le,we]=useState("all"),[W,te]=useState(D||"execution"),We=D??W,Ce=useCallback(M=>{te(M),X?.(M);},[X]),He=I??We==="oracle",[Ne,_e]=useState(a.showCriticalPath!==false),[kt,mt]=useState(a.showDependencies!==false),[ot,et]=useState(a.highlightWeekends!==false),Yt=useCallback(M=>{_e(M),a.onShowCriticalPathChange?.(M);},[a.onShowCriticalPathChange]),Pt=useCallback(M=>{mt(M),a.onShowDependenciesChange?.(M);},[a.onShowDependenciesChange]),vt=useCallback(M=>{et(M),a.onHighlightWeekendsChange?.(M);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(dt);},[dt]),useEffect(()=>{a.onZoomChange?.(S);},[S]);let Nt=useRef(a.onDateRangeChange);Nt.current=a.onDateRangeChange;let gt=useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Wt,Re]=useState(()=>{if(!x)return "all";try{let M=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(M);if(B){let V=JSON.parse(B);if(V.taskFilter)return V.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),Ae=k??Wt,ct=v??Re,[se,fe]=useState(()=>{if(!x)return false;try{let M=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(M);if(B){let V=JSON.parse(B);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=gt();if(M)try{let B={taskFilter:Ae,hideCompleted:se};localStorage.setItem(M,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving filter state to localStorage:",B);}},[Ae,se,gt]);let L=useRef(h);useEffect(()=>{if(L.current!==h&&h!==void 0){Re("all"),fe(false);let M=gt();if(M)try{localStorage.removeItem(M);}catch(B){console.warn("[GanttBoard] Error clearing filter state from localStorage:",B);}}L.current=h;},[h,gt]);let[_,K]=useState(0),[ue,Me]=useState(false),[Ke,je]=useState(null),[Le,ft]=useState({isOpen:false,x:0,y:0,task:null}),[Ct,zt]=useState(null),[Ca,ta]=useState(null);useEffect(()=>{Ft&&Ft!==ke&&yt(Ft);},[Ft]),useEffect(()=>{s&&s!==ke&&yt(s);},[s]);let U=useCallback(M=>{yt(M),H?.(M);},[H]),{state:ne,setState:Oe,undo:A,redo:ge,canUndo:Ve,canRedo:tt,clearHistory:oa}=wm(t,50),Gt=useMemo(()=>{let M=(B,V=0)=>{let Q=V;for(let xe of B)xe.subtasks?.length&&(Q=Math.max(Q,M(xe.subtasks,V+1)));return Q};return M(ne)+1},[ne]),Ta=useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),Ea=useRef(new Map),Ga=useRef(false);if(!Ga.current&&y){Ga.current=true;let M=typeof y=="string"?y:"gantt-expanded-tasks";try{let B=localStorage.getItem(M);if(B){let V=JSON.parse(B);Array.isArray(V)&&(Ea.current=new Map(V));}}catch(B){console.warn("[GanttBoard] Error loading expanded state from localStorage:",B);}}let ba=useCallback(()=>{let M=Ta();if(M)try{let B=Array.from(Ea.current.entries());localStorage.setItem(M,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving expanded state to localStorage:",B);}},[Ta]),or=useRef(0),P=useRef(ne);useEffect(()=>{P.current=ne;},[ne]);let ce=useRef(false),Te=useCallback(M=>{we(M),or.current+=1,Oe(B=>{let V=(xe,Pe=0)=>xe.map(St=>{let it=M==="all"||Pe<M-1;return St.subtasks?.length&&Ea.current.set(St.id,it),{...St,isExpanded:it,subtasks:St.subtasks?V(St.subtasks,Pe+1):void 0}}),Q=V(B);return ba(),Q});},[Oe,ba]);useEffect(()=>{if(or.current>0){or.current-=1;return}let M=V=>{let Q=new Map;for(let xe of V){let Pe=xe.id;Q.get(Pe)||Q.set(Pe,xe);}return Array.from(Q.values())},B=V=>V.map(Q=>{let xe=Ea.current.get(Q.id),Pe=xe!==void 0?{...Q,isExpanded:xe}:Q;if(Pe.subtasks?.length){let St=M(Pe.subtasks);return {...Pe,subtasks:B(St)}}return Pe});if(Ea.current.size>0)Oe(Rr(B(t)));else {let V=Q=>Q.map(xe=>xe.subtasks?.length?{...xe,subtasks:M(V(xe.subtasks))}:xe);Oe(Rr(V(t)));}},[t,Oe]);let ze=useRef(t),Ze=useRef(true);useEffect(()=>{if(Ze.current){Ze.current=false,ze.current=ne;return}if(ce.current){ce.current=false,ze.current=ne;return}if(!r)return;let M=JSON.stringify(ze.current),B=JSON.stringify(ne);M!==B&&(ze.current=ne,r(ne));},[ne,r]);let Qe=useMemo(()=>xd(b,w),[b,w]),ye=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ge,xt]=useState(()=>ye(Qe));useEffect(()=>{xt(M=>M.map(B=>({...B,label:Qe.columns[B.id==="name"?"taskName":B.id]||B.label})));},[Qe]);let Et=useMemo(()=>Ge.filter(B=>B.visible).reduce((B,V)=>B+V.width,0),[Ge]),$t=useRef(Ge.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=Ge.filter(Q=>Q.visible),B=M.map(Q=>Q.id).join(","),V=$t.current;if(B!==V){let Q=M.some(Pe=>Pe.id!=="name"),xe=V.includes(",");Q?!xe&&Q&&je(null):je(null),$t.current=B;}},[Ge]);let At=60,Ut=.6,ha=useMemo(()=>{let B=Et+At,V=typeof window<"u"?window.innerWidth*Ut:800,Q=Math.max(B,V);return Ke!==null?Math.max(200,Math.min(Ke,Q)):Math.max(200,B)},[Ke,Et]),ga=useRef(null),yr=useRef(null),Ma=useRef(null),pa=useRef(null),Dt=useMemo(()=>zp(ke),[ke]),Go=useMemo(()=>({theme:Dt,themeName:ke}),[Dt,ke]),po=useMemo(()=>Cm(p),[p]),ll=useMemo(()=>{if(!g)return ne;let M=De.calculateCriticalPathFull(ne),B=V=>V.map(Q=>{let xe=M.get(Q.id),Pe=Q.subtasks?B(Q.subtasks):void 0,St=Pe?.some(Fa=>Fa.isCriticalPath||Fa.subtasks&&Fa.subtasks.some(qt=>qt.isCriticalPath))||false,it=xe?xe.isCritical:St;return {...Q,isCriticalPath:it,cpmData:xe||void 0,subtasks:Pe}});return B(ne)},[ne,g]),of=useMemo(()=>De.flattenTasks(ne).some(B=>B.dependencies&&B.dependencies.length>0),[ne]),jc=useMemo(()=>{if(Ae==="all"&&!se)return ll;let M=B=>{let V=[];for(let Q of B){let xe=Q.subtasks?.length?M(Q.subtasks):void 0,Pe=false;if(se)Pe=Q.progress<100;else switch(Ae){case "all":Pe=true;break;case "incomplete":Pe=Q.progress<100;break;case "in_progress":Pe=Q.progress>0&&Q.progress<100;break;case "completed":Pe=Q.progress===100;break}(Pe||xe&&xe.length>0)&&V.push({...Q,subtasks:xe});}return V};return M(ll)},[ll,Ae,se]),Rs=_v($);km({undo:A,redo:ge,canUndo:Ve,canRedo:tt,enabled:true}),useImperativeHandle(o,()=>({getTask:M=>De.findTaskById(ne,M),addTask:(M,B)=>{Oe(V=>{if(!B)return [...V,{...M,level:0}];let Q=xe=>xe.map(Pe=>Pe.id===B?{...Pe,subtasks:[...Pe.subtasks||[],{...M,parentId:B,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(V)});},updateTask:(M,B)=>{Oe(V=>{let Q=xe=>xe.map(Pe=>Pe.id===M?{...Pe,...B}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(V)});},deleteTask:M=>{Oe(B=>{let V=Q=>Q.filter(xe=>xe.id===M?false:(xe.subtasks&&(xe.subtasks=V(xe.subtasks)),true));return V(B)});},deleteTasks:M=>{Oe(B=>Ed(B,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let B=De.findTaskById(ne,M);B&&a.onTaskDuplicate(B);}else Oe(B=>ms(B,[M]).tasks);},splitTask:(M,B,V=3)=>{Oe(Q=>De.splitTask(Q,M,B,V));},calculateEndDate:De.calculateEndDate,calculateDuration:De.calculateDuration,validateDependency:(M,B)=>!De.validateDependencies(ne,M,B),getAllTasks:()=>De.flattenTasks(ne),getTasksByStatus:M=>De.flattenTasks(ne).filter(B=>B.status===M),getTasksByParent:M=>M?De.findTaskById(ne,M)?.subtasks||[]:ne.filter(V=>!V.parentId),getCriticalPath:()=>De.flattenTasks(ne).filter(M=>M.isCriticalPath),indentTask:M=>{Oe(B=>Rr(Nd(B,[M])));},outdentTask:M=>{Oe(B=>Rr(Dd(B,[M])));},moveTask:(M,B)=>{Oe(V=>Sd(V,[M],B));},createSubtask:async M=>{let{tasks:B,newTask:V}=Pd(ne,M);if(he){let Q=he({...V,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}Oe(Rr(B)),Ue&&Ue({...V,parentId:M});},scrollToTask:M=>{let V=De.flattenTasks(ne).findIndex(Q=>Q.id===M);if(V!==-1&&ga.current){let Q=V*Rs;ga.current.scrollTo({top:Q,behavior:"smooth"}),Ma.current&&Ma.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,B=2e3)=>{},expandTask:M=>{Oe(B=>{let V=Q=>Q.map(xe=>xe.id===M?{...xe,isExpanded:true}:xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe);return V(B)});},collapseTask:M=>{Oe(B=>{let V=Q=>Q.map(xe=>xe.id===M?{...xe,isExpanded:false}:xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe);return V(B)});},expandAll:()=>{Oe(M=>{let B=V=>V.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(M)});},collapseAll:()=>{Oe(M=>{let B=V=>V.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(M)});},collapseToLevel:M=>{Te(M);},undo:A,redo:ge,canUndo:()=>Ve,canRedo:()=>tt,clearHistory:oa,exportToPNG:async()=>{if(!pa.current||!ga.current||!Ma.current)throw new Error("Gantt container not found");let M=pa.current,B=ga.current,V=yr.current||B.querySelector(".gantt-grid-scroll"),Q=Ma.current,xe=V?.scrollTop||0,Pe=Q.scrollTop,St=M.style.overflow,it=M.style.height,Fa=B.style.overflow;try{let qt=V?.querySelector(".gantt-taskgrid-content"),ca=Q.querySelector("svg"),dr=qt?.scrollHeight||V?.scrollHeight||600,Dr=ca?.getBoundingClientRect().height||Q.scrollHeight,Vo=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(dr,Dr)+20;V&&(V.scrollTop=0),Q.scrollTop=0,M.style.overflow="visible",M.style.height=`${Vo}px`,B.style.overflow="visible",await new Promise(bn=>setTimeout(bn,100));let eo=await toPng(M,{backgroundColor:Dt.bgPrimary,pixelRatio:2,filter:bn=>{if(!(bn instanceof Element))return !0;let Os=window.getComputedStyle(bn),Kn=parseInt(Os.zIndex,10);return (isNaN(Kn)||Kn<50)&&Os.position!=="fixed"}});return await(await fetch(eo)).blob()}finally{M.style.overflow=St,M.style.height=it,B.style.overflow=Fa,V&&(V.scrollTop=xe),Q.scrollTop=Pe;}},exportToPDF:async M=>{await De.exportToPDF(ne,M);},exportToExcel:async M=>{await De.exportToExcel(ne,M,pl.current);},exportToJSON:()=>De.exportToJSON(ne),exportToCSV:()=>De.exportToCSV(ne),importFromJSON:M=>{let B=De.importFromJSON(M);Oe(B);},getTasks:()=>ne,refresh:()=>{Oe(M=>[...M]);},clearAll:()=>{Oe([]);}}),[ne,A,ge,Ve,tt,oa,Dt,Rs]);let nf=useCallback(M=>{xt(B=>B.map(V=>V.id===M?{...V,visible:!V.visible}:V));},[]),sf=useCallback((M,B)=>{xt(V=>V.map(Q=>{if(Q.id!==M)return Q;let xe=Q.minWidth??100,Pe=Q.maxWidth??800,St=Math.max(xe,Math.min(Pe,B));return {...Q,width:St}}));},[]),lf=useCallback(M=>{Oe(B=>{let V=Fd(B,M),Q=xe=>{for(let Pe of xe){if(Pe.id===M){Ea.current.set(M,Pe.isExpanded??true);return}Pe.subtasks?.length&&Q(Pe.subtasks);}};return Q(V),ba(),V}),a.onTaskToggleExpand?.(M);},[a,ba]),pn=useCallback((M,B)=>{if(Be&&Be(M,B)===false)return;let Q=De.findTaskById(ne,M)?.progress,xe=St=>St.map(it=>it.id===M?{...it,...B}:it.subtasks?{...it,subtasks:xe(it.subtasks)}:it);Oe(xe(ne));let Pe=De.findTaskById(xe(ne),M);Pe&&(Se?.(Pe),nt?.(Pe),B.progress!==void 0&&Q!==void 0&&B.progress!==Q&&j?.(M,Q,B.progress));},[ne,Se,Be,nt,j]),df=useCallback(M=>{M.length!==0&&(or.current+=1,ce.current=true,Oe(B=>Rr(Nd(B,M))),a.onTaskIndent?.(M[0]));},[a]),cf=useCallback(M=>{M.length!==0&&(or.current+=1,ce.current=true,Oe(B=>Rr(Dd(B,M))),a.onTaskOutdent?.(M[0]));},[a]),uf=useCallback((M,B,V)=>{or.current+=1,ce.current=true,Oe(Q=>Rr(lm(Q,M,B,V))),a.onTaskReparent?.(M,B,V);},[a]),pf=useCallback((M,B)=>{M.length!==0&&(or.current+=1,ce.current=true,Oe(V=>Sd(V,M,B)),a.onTaskMove?.(M[0],B));},[a]),dl=useCallback(async M=>{let B=[];for(let V of M)Z&&await Promise.resolve(Z(V))===false||B.push(V);B.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(B):(Oe(V=>Rr(Ed(V,B))),B.forEach(V=>a.onTaskDelete?.(V))),st&&B.forEach(V=>st(V)));},[a,Z,st]),mf=useCallback(M=>{a.onTaskDuplicate?M.forEach(B=>{let V=De.findTaskById(ne,B);V&&a.onTaskDuplicate(V);}):Oe(B=>ms(B,M).tasks);},[a,ne]),gf=useCallback((M,B)=>{Oe(V=>{let{tasks:Q,newTask:xe}=im(V,M,B);return he&&he(xe)===false?V:(a.onTaskCreate?.(xe.parentId,xe.position||0),Ue?.(xe),Q)});},[a,he,Ue]),ff=useCallback((M,B)=>{Oe(V=>Md(V,M,B)),a.onTaskRename?.(M,B);},[a]),cl=useCallback(M=>{let{onTaskAddSubtask:B}=a;if(B){let V=yi(ne,M);if(V){B(V);return}}Oe(V=>{let{tasks:Q}=Pd(V,M);return a.onTaskCreate?.(M,0),Q});},[a,ne]),bf=useCallback((M,B,V)=>{let Q=!M.startDate&&!M.endDate,xe=M.startDate?Math.round((B.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,Pe=qt=>qt.map(ca=>ca.id===M.id?{...ca,startDate:B,endDate:V,...M.segments&&{segments:M.segments}}:ca.subtasks?{...ca,subtasks:Pe(ca.subtasks)}:ca),St=Pe(ne),it=St;St=De.autoScheduleDependents(St,M.id,xe),St=Rr(St),Oe(St);let Fa={...M,startDate:B,endDate:V};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(M,B,V):Se?.(Fa),R&&xe!==0){let qt=De.flattenTasks(it),ca=De.flattenTasks(St),dr=[];for(let Dr of ca){if(Dr.id===M.id)continue;let ko=qt.find(eo=>eo.id===Dr.id);if(!ko)continue;let fn=Dr.startDate?.getTime()!==ko.startDate?.getTime(),Vo=Dr.endDate?.getTime()!==ko.endDate?.getTime();(fn||Vo)&&dr.push(Dr);}dr.length>0&&R(dr);}},[ne,Se,R,a]),hf=useCallback((M,B)=>{ee?.(M,B),ft({isOpen:true,x:B.clientX,y:B.clientY,task:M});},[ee]),yf=useCallback((M,B)=>{let V=De.splitTask(ne,M.id,B);Oe(V),ft({isOpen:false,x:0,y:0,task:null});},[ne]),Kc=useCallback(M=>{let B=De.findTaskById(ne,M.id)||M;q?.(B),be||zt(B);},[ne,q,be]),Yc=useCallback((M,B,V)=>{let Q=new Map,xe=qt=>{qt.forEach(ca=>{ca.dependencies&&Q.set(ca.id,ca.dependencies),ca.subtasks&&xe(ca.subtasks);});};xe(V);let Pe=Q.get(B)||[];Q.set(B,[...Pe,M]);let St=new Set,it=new Set,Fa=qt=>{if(!St.has(qt)){St.add(qt),it.add(qt);let ca=Q.get(qt)||[];for(let dr of ca){if(!St.has(dr)&&Fa(dr))return true;if(it.has(dr))return true}}return it.delete(qt),false};return Fa(B)},[]),qc=useCallback((M,B)=>{if(Yc(M.id,B,P.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let V=Q=>Q.map(xe=>{if(xe.id===B){let Pe=xe.dependencies||[];if(!Pe.includes(M.id))return {...xe,dependencies:[...Pe,M.id]}}return xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe});nr.current+=1,Oe(Q=>V(Q)),J?.(M.id,B);},[J,Yc]),Xc=useCallback((M,B)=>{let V=Q=>Q.map(xe=>{if(xe.id===M&&xe.dependencies){let Pe=xe.dependencies.filter(Nt=>Nt!==B);return {...xe,dependencies:Pe}}return xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe});nr.current+=1,Oe(Q=>V(Q)),Fe?.(M,B);},[Fe]),{startDate:un,endDate:cl}=useMemo(()=>{let M=ne.filter(Pe=>Pe.startDate&&Pe.endDate);if(M.length===0){let Pe=new Date,Nt=new Date(Pe);Nt.setDate(Nt.getDate()-30);let it=new Date(Pe);return it.setDate(it.getDate()+60),{startDate:Nt,endDate:it}}let B=M.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),V=new Date(Math.min(...B.map(Pe=>Pe.getTime()))),Q=new Date(Math.max(...B.map(Pe=>Pe.getTime()))),xe=dt==="day"?7:dt==="week"?14:30;return V.setDate(V.getDate()-xe),Q.setDate(Q.getDate()+xe),{startDate:V,endDate:Q}},[ne,dt]);useEffect(()=>{Tt.current?.(un,cl);},[un,cl]);let xf=useCallback(async()=>{if(!qa.current||!Ba.current||!Sa.current)return;await new Promise(Wo=>setTimeout(Wo,200));let M=qa.current,B=Ba.current,V=Ga.current||B.querySelector(".gantt-grid-scroll"),Q=Sa.current,xe=V?.scrollTop||0,Pe=V?.scrollLeft||0,Nt=Q.scrollTop,it=Q.scrollLeft,Ea=M.style.overflow,qt=M.style.height,ca=V?.style.overflow||"",cr=Q.style.overflow,Dr=B.style.overflow,wo=M.style.width,mn=Q.style.width;try{let Wo=V?.querySelector(".gantt-taskgrid-content"),eo=Q.querySelector("svg"),ml=eo?.getAttribute("height")?parseInt(eo.getAttribute("height"),10):eo?.getBoundingClientRect().height||0,gn=Wo?.scrollHeight||V?.scrollHeight||600,Rs=Math.max(ml,Q.scrollHeight),_n=eo?.getAttribute("width")?parseInt(eo.getAttribute("width"),10):eo?.getBoundingClientRect().width||Q.scrollWidth,Sf=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,gl=Math.max(gn,Rs,ml),Zc=Sf+gl+50,eu=(V?.offsetWidth||B.offsetWidth||300)+_n+10;V&&(V.scrollTop=0,V.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Zc}px`,M.style.width=`${eu}px`,B.style.overflow="visible",V&&(V.style.overflow="visible",V.style.height=`${gl+50}px`),Q.style.overflow="visible",Q.style.height=`${gl+50}px`,Q.style.width=`${_n+10}px`,await new Promise(Os=>setTimeout(Os,150));let Ef=await toPng(M,{backgroundColor:_t.bgPrimary,pixelRatio:2,width:eu,height:Zc,skipFonts:!1,filter:Os=>{if(!(Os instanceof Element))return !0;let tu=window.getComputedStyle(Os),au=parseInt(tu.zIndex,10);return !(!isNaN(au)&&au>=50||tu.position==="fixed")}}),fl=document.createElement("a");fl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,fl.href=Ef,fl.click();}finally{M.style.overflow=Ea,M.style.height=qt,M.style.width=wo,B.style.overflow=Dr,V&&(V.style.overflow=ca,V.style.height="",V.scrollTop=xe,V.scrollLeft=Pe),Q.style.overflow=cr,Q.style.height="",Q.style.width=mn,Q.scrollTop=Nt,Q.scrollLeft=it;}},[_t]),vf=useCallback(async()=>{await De.exportToPDF(ne);},[ne]),ul=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});ul.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let wf=useCallback(async()=>{let M=new Date,B=xe=>String(xe).padStart(2,"0"),V=`${M.getFullYear()}-${B(M.getMonth()+1)}-${B(M.getDate())}_${B(M.getHours())}${B(M.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await De.exportToExcel(ne,`${Q}_${V}.xlsx`,ul.current);},[ne,m]),kf=useCallback(()=>{let M=De.exportToCSV(ne),B=new Blob([M],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[ne]),Cf=useCallback(()=>{let M=De.exportToJSON(ne),B=new Blob([M],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[ne]),Tf=useCallback(()=>{De.exportToMSProject(ne,"Gantt Project","project.xml");},[ne]),Nf=M=>{M.preventDefault(),Me(true);},pn=useRef(false),[pl,Jc]=useState(false),Vn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=Sa.current,B=Ba.current?.querySelector(".gantt-grid-scroll");if(!M||!B)return;let V=()=>{if(pn.current)return;pn.current=true;let it=M.scrollTop;K(it),B.scrollTop=it,requestAnimationFrame(()=>{pn.current=false;});},Q=()=>{if(pn.current)return;pn.current=true;let it=B.scrollTop;K(it),M.scrollTop=it,requestAnimationFrame(()=>{pn.current=false;});},xe=it=>{if(ue&&B){let qt=B.parentElement?.getBoundingClientRect()?.left||0,ca=it.clientX-qt,cr=200,Dr=Dt+Ot,wo=window.innerWidth*Ut,mn=Math.max(Dr,wo);ca>=cr&&ca<=mn&&je(ca);}if(pl&&M){let Ea=it.clientX-Vn.current.x,qt=it.clientY-Vn.current.y;M.scrollLeft=Vn.current.scrollLeft-Ea,M.scrollTop=Vn.current.scrollTop-qt;}},Pe=()=>{Me(false),Jc(false);},Nt=it=>{if(it.button!==0)return;let Ea=it.target;Ea.closest("[data-task-bar]")||Ea.closest("[data-dependency-line]")||Ea.closest("button")||Ea.closest('[role="button"]')||Ea.tagName==="rect"&&Ea.getAttribute("data-clickable")==="true"||(Jc(true),Vn.current={x:it.clientX,y:it.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},it.preventDefault());};return M.addEventListener("scroll",V),B.addEventListener("scroll",Q),M.addEventListener("mousedown",Nt),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",Pe),()=>{M.removeEventListener("scroll",V),B.removeEventListener("scroll",Q),M.removeEventListener("mousedown",Nt),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",Pe);}},[ue,pl,Dt]);let Qc=useRef(false),Df=useRef(null);return useLayoutEffect(()=>{if(Qc.current||ne.length===0||!Sa.current)return;Qc.current=true,Df.current=un;let M=Sa.current,B=new Date,V=dt==="day"?60:dt==="week"?20:8,Q=(B.getTime()-un.getTime())/(1e3*60*60*24),xe=M.clientWidth,Nt=Q*V*S-xe/2;Q>=0&&xe>0&&(M.scrollLeft=Math.max(0,Nt));},[ne.length,un,dt,S]),jsx(Sn.Provider,{value:Xe,children:jsx(vl.Provider,{value:Is,children:jsxs("div",{ref:qa,className:"flex flex-col h-full w-full",style:{backgroundColor:_t.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,..._t.dotGrid&&{backgroundImage:`radial-gradient(circle, ${_t.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(fi,{theme:_t,timeScale:dt,onTimeScaleChange:at,zoom:S,onZoomChange:Y,currentTheme:ke,onThemeChange:U,rowDensity:$,onRowDensityChange:de,showThemeSelector:c,showCreateTaskButton:C&&oe?.canCreateTask!==false&&!oe?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:T,taskFilter:Ae,onTaskFilterChange:ct,hideCompleted:se,onHideCompletedChange:fe,toolbarRightContent:E,wbsLevel:le,onWbsLevelChange:Te,maxWbsDepth:Wt,viewMode:We,onViewModeChange:Ce,projectForecast:O,onExportPNG:l?xf:void 0,onExportPDF:l?vf:void 0,onExportExcel:l?wf:void 0,onExportCSV:l?kf:void 0,onExportJSON:l?Cf:void 0,onExportMSProject:l?Tf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:Yt,showDependencies:wt,onShowDependenciesChange:Ft,highlightWeekends:ot,onHighlightWeekendsChange:xt,showBaseline:He,onShowBaselineChange:M=>{M&&We!=="oracle"&&Ce("oracle"),!M&&We==="oracle"&&Ce("execution");},onCopySnapshotLink:rt,hasDependencies:of})}),jsxs("div",{ref:Ba,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Ga,className:"gantt-grid-scroll flex-shrink-0",style:{width:pa,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(xi,{tasks:jc,theme:_t,rowHeight:Bs,availableUsers:d,templates:_c,showCriticalPath:Ne,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:ee,onTaskToggle:lf,scrollTop:_,columns:Ge,onToggleColumn:nf,onColumnResize:sf,onTaskUpdate:cn,onTaskIndent:df,onTaskOutdent:cf,onTaskMove:pf,onMultiTaskDelete:ll,onTaskDuplicate:mf,onTaskCreate:gf,onTaskRename:ff,onCreateSubtask:dl,onOpenTaskModal:F?M=>F(M):void 0,onDeleteRequest:(M,B)=>ta({taskId:M,taskName:B}),onTaskReparent:uf,scrollContainerRef:Ga})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:_t.border,zIndex:15},onMouseDown:Nf}),jsx("div",{ref:Sa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:pl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Mi,{tasks:jc,theme:_t,rowHeight:Bs,timeScale:dt,startDate:un,endDate:cl,zoom:S,locale:b,templates:_c,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:hf,onTaskDateChange:bf,onDependencyCreate:qc,onDependencyDelete:Xc,showBaseline:He,showCriticalPath:Ne,showDependencies:wt,highlightWeekends:ot,canEditTask:oe?.canEditTask})})]}),Le.task&&jsx(Mn,{isOpen:Le.isOpen,x:Le.x,y:Le.y,theme:_t,onClose:()=>ft({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=Le.task;if(!M)return [];let B=De.findTaskById(ne,M.id)||M,V=B.subtasks&&B.subtasks.length>0,Q=oe?.canCreateTask!==false,xe=oe?.canDeleteTask!==false;if(V){let qt=[],ca=oe?.canDuplicateTask!==false;return Q&&qt.push({id:"addSubtask",label:Xe.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{Je?Je(B):dl(B.id);}}),ca&&qt.push({id:"duplicate",label:Xe.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):Oe(cr=>us(cr,[B.id]).tasks),ft({isOpen:false,x:0,y:0,task:null});}}),xe&&(qt.length>0&&qt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),qt.push({id:"delete",label:Xe.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),qt}let Pe=oe?.canUpdateTask!==false,Nt=oe?.canDuplicateTask!==false,it=[];return Pe&&it.push({id:"edit",label:Xe.contextMenu?.editTask||"Edit Task",icon:da.Pencil,onClick:()=>{be?be(B):Ht(B);}}),Q&&it.push({id:"addSubtask",label:Xe.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{Je?Je(B):dl(B.id);}}),it.length>0&&Pe&&it.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(it.push({id:"markIncomplete",label:Xe.contextMenu?.markIncomplete||"Mark Incomplete",icon:da.MarkIncomplete,onClick:()=>{z?z(B):cn(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"}),it.push({id:"setInProgress",label:Xe.contextMenu?.setInProgress||"Set In Progress",icon:da.SetInProgress,onClick:()=>{re?re(B):cn(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"}),it.push({id:"markComplete",label:Xe.contextMenu?.markComplete||"Mark Complete",icon:da.MarkComplete,onClick:()=>{cn(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"})),(Nt||Pe&&B.startDate&&B.endDate)&&it.length>0&&it.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Nt&&it.push({id:"duplicate",label:Xe.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):Oe(qt=>us(qt,[B.id]).tasks),ft({isOpen:false,x:0,y:0,task:null});}}),Pe&&B.startDate&&B.endDate&&it.push({id:"split",label:Xe.contextMenu?.splitTask||"Split Task",icon:da.Split,onClick:()=>{let qt=B.startDate.getTime(),ca=B.endDate.getTime(),cr=qt+(ca-qt)/2,Dr=new Date(cr);yf(B,Dr);}}),xe&&(it.length>0&&it.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),it.push({id:"delete",label:Xe.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),it})()}),jsx(go,{task:kt,isOpen:!!kt,onClose:()=>Ht(null),onTaskUpdate:M=>{kt&&(cn(kt.id,M),Ht(null));},theme:ke==="light"?"light":"dark",locale:b==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:wa&&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:()=>ta(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:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:_t.bgSecondary,border:`1px solid ${_t.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${_t.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:_t.textPrimary,fontFamily:"Inter, sans-serif"},children:[Xe.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:_t.textSecondary,fontFamily:"Inter, sans-serif"},children:b==="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:_t.textSecondary,fontFamily:"Inter, sans-serif"},children:[b==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:_t.textPrimary},children:['"',wa.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:_t.bgPrimary,borderTop:`1px solid ${_t.border}`},children:[jsx("button",{onClick:()=>ta(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:_t.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=_t.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:b==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{ll([wa.taskId]),ta(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),b==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(Ai,{tasks:ne,theme:_t,config:f,onTasksUpdate:Oe,onTaskUpdate:cn,onTaskCreate:M=>{Oe(B=>[...B,M]);},onTaskDelete:M=>{ll([M]);},onDependencyCreate:(M,B)=>{let V=De.findTaskById(ne,M);V&&qc(V,B);},onDependencyDelete:Xc})]})})})});function a2(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 r2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Ld=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Id=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Fm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Ld,...l.filter(S=>!Ld.some(Y=>Y.id===S.id))],f=ut[c]||ut.dark,[b,v]=useState(false),[C,N]=useState(false),[T,k]=useState(false),[w,E]=useState(false),[I,D]=useState({top:0,left:0}),[X$1,O]=useState(null),[H,F]=useState(new Date),[q,ee]=useState({top:0,left:0}),[Se,R]=useState(false),[j,be]=useState([]),[Je,z]=useState(false),[re,J]=useState(""),Fe=useRef(null),he=useRef(null),Ue=useRef(null),Be=useRef(null),nt=useRef(null),[Z,st]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[oe,rt]=useState({});useEffect(()=>{a?(st({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)&&R(true)):(st({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),R(false),be([]));},[a,e,x]),useEffect(()=>{let S=Y=>{Fe.current&&!Fe.current.contains(Y.target)&&v(false),he.current&&!he.current.contains(Y.target)&&N(false),Ue.current&&!Ue.current.contains(Y.target)&&k(false),Be.current&&!Be.current.contains(Y.target)&&E(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let ht=()=>{let S={};return Z.name.trim()||(S.name="El nombre es requerido"),Z.startDate&&Z.endDate&&Z.startDate>Z.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),rt(S),Object.keys(S).length===0},Mt=async S=>{if(S.preventDefault(),!!ht())try{let Y=i==="create"&&j.length>0?{...Z,pendingFiles:j}:Z;await s(Y),be([]),t();}catch(Y){console.error("Error submitting task:",Y);}},ke=(S,Y)=>{st(le=>{let we={...le,[S]:Y};if(S==="status"){let W=Y;W==="todo"?we.progress=0:W==="in-progress"?(le.progress===0||le.progress===100)&&(we.progress=50):W==="completed"||W==="closed"?we.progress=100:(W==="in-review"||W==="review")&&(we.progress=75);}if(S==="progress"){let W=typeof Y=="number"?Y:parseInt(Y,10);W===100&&le.status!=="completed"?we.status="completed":W>0&&W<100&&le.status==="todo"?we.status="in-progress":W===0&&le.status!=="todo"&&(we.status="todo");}return we}),oe[S]&&rt(le=>{let we={...le};return delete we[S],we});},yt=h.find(S=>S.id===Z.status)??Ld[0],dt=Id.find(S=>S.id===Z.priority)??Id[1],at=Yo.find(S=>S.value===Z.color)??Yo[0],$=c==="dark",de={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":c,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:S=>S.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:yt.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=f.hoverBg,S.currentTarget.style.color=f.textPrimary;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Mt,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:S=>ke("name",S.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}),oe.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),oe.name]})]}),jsx("div",{children:jsx("textarea",{value:Z.description||"",onChange:S=>ke("description",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&v(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...de,borderColor:yt.color,backgroundColor:`${yt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:yt.color}}),jsx("span",{style:{color:yt.color},children:yt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:yt.color}})]}),jsx(AnimatePresence,{children:b&&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:h.map(S=>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:()=>{ke("status",S.id),v(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,Z.status===S.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxs("div",{ref:he,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&N(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:dt.color}}),jsx("span",{children:dt.label}),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-[130px] rounded-lg overflow-hidden",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Id.map(S=>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:()=>{ke("priority",S.id),N(false);},children:[jsx("span",{children:S.icon}),S.label,Z.priority===S.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxs("div",{ref:Ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[Z.assignees&&Z.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:Z.assignees.slice(0,3).map((S,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:S.color||f.accent,borderColor:f.bgSecondary},children:S.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:T&&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(S=>{let Y=Z.assignees?.some(le=>le.name===S.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:le=>le.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{let le=Y?(Z.assignees||[]).filter(we=>we.name!==S.name):[...Z.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(we=>we[0]).join("").toUpperCase().slice(0,2),color:f.accent}];ke("assignees",le);},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:S.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:S.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}})})]},S.id)})})})]}),jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(w)E(false);else {if(Be.current){let S=Be.current.getBoundingClientRect(),Y=window.innerHeight,le=120,W=Y-S.bottom<le?S.top-le-8:S.bottom+8;D({top:W,left:S.left});}E(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Z.color}}),jsx("span",{children:at.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Yo.slice(0,18).map(S=>{let Y=Z.color===S.value;return jsx("button",{type:"button",onClick:le=>{le.preventDefault(),le.stopPropagation(),ke("color",S.value),E(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:Y?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),m.length>0||d?jsx(No,{selectedTags:Z.tags||[],availableTags:m,onChange:S=>ke("tags",S),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:nt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(X$1==="start")O(null);else {if(nt.current){let S=nt.current.getBoundingClientRect(),Y=window.innerHeight,le=320,W=Y-S.bottom<le?S.top-le-8:S.bottom+8;ee({top:W,left:S.left});}O("start"),F(Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,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(X$1==="end")O(null);else {if(nt.current){let S=nt.current.getBoundingClientRect(),Y=window.innerHeight,le=320,W=Y-S.bottom<le?S.top-le-8:S.bottom+8;ee({top:W,left:S.left});}O("end"),F(Z.endDate||Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,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:X$1&&jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${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:S=>S.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${$?"#262626":f.border}`},children:[(()=>{let S=new Date,Y=new Date(S);Y.setDate(S.getDate()+1);let le=new Date(S);le.setDate(S.getDate()+7);let we=new Date(S);return we.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:Y},{label:"Pr\xF3xima semana",date:le},{label:"2 semanas",date:we}].map((te,We)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ce=>Ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ce=>Ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{X$1==="start"?(ke("startDate",te.date),(!Z.endDate||te.date>Z.endDate)&&ke("endDate",te.date),O("end")):(ke("endDate",te.date),(!Z.startDate||te.date<Z.startDate)&&ke("startDate",te.date),O(null));},children:te.label},We))})(),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:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("startDate",void 0),ke("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children: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:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children: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((S,Y)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},Y))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=H.getFullYear(),Y=H.getMonth(),le=new Date(S,Y,1).getDay(),we=new Date(S,Y+1,0).getDate(),W=new Date,te=[];for(let Ce=le-1;Ce>=0;Ce--)te.push({day:new Date(S,Y,-Ce).getDate(),date:new Date(S,Y-1,new Date(S,Y,-Ce).getDate()),isCurrentMonth:false});for(let Ce=1;Ce<=we;Ce++)te.push({day:Ce,date:new Date(S,Y,Ce),isCurrentMonth:true});let We=42-te.length;for(let Ce=1;Ce<=We;Ce++)te.push({day:Ce,date:new Date(S,Y+1,Ce),isCurrentMonth:false});return te.map((Ce,He)=>{let Ne=Ce.date.toDateString()===W.toDateString(),_e=Z.startDate?.toDateString()===Ce.date.toDateString(),wt=Z.endDate?.toDateString()===Ce.date.toDateString(),mt=Z.startDate&&Z.endDate&&Ce.date>=Z.startDate&&Ce.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:Ce.isCurrentMonth?_e||wt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:_e?f.accent:wt?"#7C3AED":mt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!_e&&!wt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{X$1==="start"?(ke("startDate",Ce.date),Z.endDate&&Ce.date>Z.endDate&&ke("endDate",Ce.date),O("end")):(ke("endDate",Ce.date),Z.startDate&&Ce.date<Z.startDate&&ke("startDate",Ce.date),O(null));},children:Ce.day},He)})})()})]})]})]})})]}),oe.endDate&&jsx("span",{className:"text-xs text-red-400",children:oe.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:S=>ke("progress",parseInt(S.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:()=>R(!Se),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 ${Se?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:Se&&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?a2(Z.effortMinutes):"",onChange:S=>{let Y=r2(S.target.value);ke("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||i==="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 ",i==="create"?j.length>0&&`(${j.length})`:p.length>0&&`(${p.length})`]})]}),i==="create"?jsx(no,{cardId:"pending",attachments:j.map((S,Y)=>({id:`pending-${Y}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>be(Y=>[...Y,...S]),onDelete:S=>{let Y=parseInt(S.replace("pending-",""),10);be(le=>le.filter((we,W)=>W!==Y));},maxSizeMB:10,maxFiles:20}):jsx(no,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),i==="create"&&j.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[j.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:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:Z.isMilestone,onChange:S=>ke("isMilestone",S.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(S=>{let Y=r.find(le=>le.id===S);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||S.slice(0,8),jsx("button",{type:"button",onClick:()=>{let le=(Z.dependencies||[]).filter(we=>we!==S);ke("dependencies",le);},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"})})]},S)})}),jsxs("button",{type:"button",onClick:()=>{z(!Je),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(false),J("");}}),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:re,onChange:S=>J(S.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>re===""||S.name.toLowerCase().includes(re.toLowerCase())).map(S=>{let Y=Z.dependencies?.includes(S.id);return jsxs("button",{type:"button",onClick:()=>{let le=Z.dependencies||[],we;Y?we=le.filter(W=>W!==S.id):we=[...le,S.id],ke("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:le=>{Y||(le.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:le=>{le.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:S.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&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:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.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:S=>!n&&(S.currentTarget.style.opacity="0.9"),onMouseLeave:S=>!n&&(S.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:i==="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 V=Q=>Q.map(xe=>{if(xe.id===B){let Pe=xe.dependencies||[];if(!Pe.includes(M.id))return {...xe,dependencies:[...Pe,M.id]}}return xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe});or.current+=1,Oe(Q=>V(Q)),J?.(M.id,B);},[J,Yc]),Xc=useCallback((M,B)=>{let V=Q=>Q.map(xe=>{if(xe.id===M&&xe.dependencies){let Pe=xe.dependencies.filter(St=>St!==B);return {...xe,dependencies:Pe}}return xe.subtasks?{...xe,subtasks:V(xe.subtasks)}:xe});or.current+=1,Oe(Q=>V(Q)),Fe?.(M,B);},[Fe]),{startDate:mn,endDate:ul}=useMemo(()=>{let M=ne.filter(Pe=>Pe.startDate&&Pe.endDate);if(M.length===0){let Pe=new Date,St=new Date(Pe);St.setDate(St.getDate()-30);let it=new Date(Pe);return it.setDate(it.getDate()+60),{startDate:St,endDate:it}}let B=M.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),V=new Date(Math.min(...B.map(Pe=>Pe.getTime()))),Q=new Date(Math.max(...B.map(Pe=>Pe.getTime()))),xe=dt==="day"?7:dt==="week"?14:30;return V.setDate(V.getDate()-xe),Q.setDate(Q.getDate()+xe),{startDate:V,endDate:Q}},[ne,dt]);useEffect(()=>{Nt.current?.(mn,ul);},[mn,ul]);let xf=useCallback(async()=>{if(!pa.current||!ga.current||!Ma.current)return;await new Promise(Vo=>setTimeout(Vo,200));let M=pa.current,B=ga.current,V=yr.current||B.querySelector(".gantt-grid-scroll"),Q=Ma.current,xe=V?.scrollTop||0,Pe=V?.scrollLeft||0,St=Q.scrollTop,it=Q.scrollLeft,Fa=M.style.overflow,qt=M.style.height,ca=V?.style.overflow||"",dr=Q.style.overflow,Dr=B.style.overflow,ko=M.style.width,fn=Q.style.width;try{let Vo=V?.querySelector(".gantt-taskgrid-content"),eo=Q.querySelector("svg"),gl=eo?.getAttribute("height")?parseInt(eo.getAttribute("height"),10):eo?.getBoundingClientRect().height||0,bn=Vo?.scrollHeight||V?.scrollHeight||600,Os=Math.max(gl,Q.scrollHeight),Kn=eo?.getAttribute("width")?parseInt(eo.getAttribute("width"),10):eo?.getBoundingClientRect().width||Q.scrollWidth,Sf=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,fl=Math.max(bn,Os,gl),Zc=Sf+fl+50,eu=(V?.offsetWidth||B.offsetWidth||300)+Kn+10;V&&(V.scrollTop=0,V.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Zc}px`,M.style.width=`${eu}px`,B.style.overflow="visible",V&&(V.style.overflow="visible",V.style.height=`${fl+50}px`),Q.style.overflow="visible",Q.style.height=`${fl+50}px`,Q.style.width=`${Kn+10}px`,await new Promise($s=>setTimeout($s,150));let Ef=await toPng(M,{backgroundColor:Dt.bgPrimary,pixelRatio:2,width:eu,height:Zc,skipFonts:!1,filter:$s=>{if(!($s instanceof Element))return !0;let tu=window.getComputedStyle($s),au=parseInt(tu.zIndex,10);return !(!isNaN(au)&&au>=50||tu.position==="fixed")}}),bl=document.createElement("a");bl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,bl.href=Ef,bl.click();}finally{M.style.overflow=Fa,M.style.height=qt,M.style.width=ko,B.style.overflow=Dr,V&&(V.style.overflow=ca,V.style.height="",V.scrollTop=xe,V.scrollLeft=Pe),Q.style.overflow=dr,Q.style.height="",Q.style.width=fn,Q.scrollTop=St,Q.scrollLeft=it;}},[Dt]),vf=useCallback(async()=>{await De.exportToPDF(ne);},[ne]),pl=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});pl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let wf=useCallback(async()=>{let M=new Date,B=xe=>String(xe).padStart(2,"0"),V=`${M.getFullYear()}-${B(M.getMonth()+1)}-${B(M.getDate())}_${B(M.getHours())}${B(M.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await De.exportToExcel(ne,`${Q}_${V}.xlsx`,pl.current);},[ne,m]),kf=useCallback(()=>{let M=De.exportToCSV(ne),B=new Blob([M],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[ne]),Cf=useCallback(()=>{let M=De.exportToJSON(ne),B=new Blob([M],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[ne]),Tf=useCallback(()=>{De.exportToMSProject(ne,"Gantt Project","project.xml");},[ne]),Nf=M=>{M.preventDefault(),Me(true);},gn=useRef(false),[ml,Jc]=useState(false),jn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=Ma.current,B=ga.current?.querySelector(".gantt-grid-scroll");if(!M||!B)return;let V=()=>{if(gn.current)return;gn.current=true;let it=M.scrollTop;K(it),B.scrollTop=it,requestAnimationFrame(()=>{gn.current=false;});},Q=()=>{if(gn.current)return;gn.current=true;let it=B.scrollTop;K(it),M.scrollTop=it,requestAnimationFrame(()=>{gn.current=false;});},xe=it=>{if(ue&&B){let qt=B.parentElement?.getBoundingClientRect()?.left||0,ca=it.clientX-qt,dr=200,Dr=Et+At,ko=window.innerWidth*Ut,fn=Math.max(Dr,ko);ca>=dr&&ca<=fn&&je(ca);}if(ml&&M){let Fa=it.clientX-jn.current.x,qt=it.clientY-jn.current.y;M.scrollLeft=jn.current.scrollLeft-Fa,M.scrollTop=jn.current.scrollTop-qt;}},Pe=()=>{Me(false),Jc(false);},St=it=>{if(it.button!==0)return;let Fa=it.target;Fa.closest("[data-task-bar]")||Fa.closest("[data-dependency-line]")||Fa.closest("button")||Fa.closest('[role="button"]')||Fa.tagName==="rect"&&Fa.getAttribute("data-clickable")==="true"||(Jc(true),jn.current={x:it.clientX,y:it.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},it.preventDefault());};return M.addEventListener("scroll",V),B.addEventListener("scroll",Q),M.addEventListener("mousedown",St),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",Pe),()=>{M.removeEventListener("scroll",V),B.removeEventListener("scroll",Q),M.removeEventListener("mousedown",St),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",Pe);}},[ue,ml,Et]);let Qc=useRef(false),Df=useRef(null);return useLayoutEffect(()=>{if(Qc.current||ne.length===0||!Ma.current)return;Qc.current=true,Df.current=mn;let M=Ma.current,B=new Date,V=dt==="day"?60:dt==="week"?20:8,Q=(B.getTime()-mn.getTime())/(1e3*60*60*24),xe=M.clientWidth,St=Q*V*S-xe/2;Q>=0&&xe>0&&(M.scrollLeft=Math.max(0,St));},[ne.length,mn,dt,S]),jsx(Mn.Provider,{value:Qe,children:jsx(wl.Provider,{value:Go,children:jsxs("div",{ref:pa,className:"flex flex-col h-full w-full",style:{backgroundColor:Dt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Dt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Dt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(bi,{theme:Dt,timeScale:dt,onTimeScaleChange:at,zoom:S,onZoomChange:Y,currentTheme:ke,onThemeChange:U,rowDensity:$,onRowDensityChange:de,showThemeSelector:c,showCreateTaskButton:C&&oe?.canCreateTask!==false&&!oe?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:T,taskFilter:Ae,onTaskFilterChange:ct,hideCompleted:se,onHideCompletedChange:fe,toolbarRightContent:E,wbsLevel:le,onWbsLevelChange:Te,maxWbsDepth:Gt,viewMode:We,onViewModeChange:Ce,projectForecast:O,onExportPNG:l?xf:void 0,onExportPDF:l?vf:void 0,onExportExcel:l?wf:void 0,onExportCSV:l?kf:void 0,onExportJSON:l?Cf:void 0,onExportMSProject:l?Tf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:Yt,showDependencies:kt,onShowDependenciesChange:Pt,highlightWeekends:ot,onHighlightWeekendsChange:vt,showBaseline:He,onShowBaselineChange:M=>{M&&We!=="oracle"&&Ce("oracle"),!M&&We==="oracle"&&Ce("execution");},onCopySnapshotLink:rt,hasDependencies:of})}),jsxs("div",{ref:ga,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:yr,className:"gantt-grid-scroll flex-shrink-0",style:{width:ha,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(vi,{tasks:jc,theme:Dt,rowHeight:Rs,availableUsers:d,templates:po,showCriticalPath:Ne,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:ee,onTaskToggle:lf,scrollTop:_,columns:Ge,onToggleColumn:nf,onColumnResize:sf,onTaskUpdate:pn,onTaskIndent:df,onTaskOutdent:cf,onTaskMove:pf,onMultiTaskDelete:dl,onTaskDuplicate:mf,onTaskCreate:gf,onTaskRename:ff,onCreateSubtask:cl,onOpenTaskModal:F?M=>F(M):void 0,onDeleteRequest:(M,B)=>ta({taskId:M,taskName:B}),onTaskReparent:uf,scrollContainerRef:yr})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Dt.border,zIndex:15},onMouseDown:Nf}),jsx("div",{ref:Ma,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ml?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Fi,{tasks:jc,theme:Dt,rowHeight:Rs,timeScale:dt,startDate:mn,endDate:ul,zoom:S,locale:b,templates:po,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:hf,onTaskDateChange:bf,onDependencyCreate:qc,onDependencyDelete:Xc,showBaseline:He,showCriticalPath:Ne,showDependencies:kt,highlightWeekends:ot,canEditTask:oe?.canEditTask})})]}),Le.task&&jsx(Pn,{isOpen:Le.isOpen,x:Le.x,y:Le.y,theme:Dt,onClose:()=>ft({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=Le.task;if(!M)return [];let B=De.findTaskById(ne,M.id)||M,V=B.subtasks&&B.subtasks.length>0,Q=oe?.canCreateTask!==false,xe=oe?.canDeleteTask!==false;if(V){let qt=[],ca=oe?.canDuplicateTask!==false;return Q&&qt.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{Xe?Xe(B):cl(B.id);}}),ca&&qt.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):Oe(dr=>ms(dr,[B.id]).tasks),ft({isOpen:false,x:0,y:0,task:null});}}),xe&&(qt.length>0&&qt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),qt.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),qt}let Pe=oe?.canUpdateTask!==false,St=oe?.canDuplicateTask!==false,it=[];return Pe&&it.push({id:"edit",label:Qe.contextMenu?.editTask||"Edit Task",icon:da.Pencil,onClick:()=>{be?be(B):zt(B);}}),Q&&it.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:da.Add,onClick:()=>{Xe?Xe(B):cl(B.id);}}),it.length>0&&Pe&&it.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(it.push({id:"markIncomplete",label:Qe.contextMenu?.markIncomplete||"Mark Incomplete",icon:da.MarkIncomplete,onClick:()=>{z?z(B):pn(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"}),it.push({id:"setInProgress",label:Qe.contextMenu?.setInProgress||"Set In Progress",icon:da.SetInProgress,onClick:()=>{re?re(B):pn(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"}),it.push({id:"markComplete",label:Qe.contextMenu?.markComplete||"Mark Complete",icon:da.MarkComplete,onClick:()=>{pn(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"})),(St||Pe&&B.startDate&&B.endDate)&&it.length>0&&it.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),St&&it.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:da.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):Oe(qt=>ms(qt,[B.id]).tasks),ft({isOpen:false,x:0,y:0,task:null});}}),Pe&&B.startDate&&B.endDate&&it.push({id:"split",label:Qe.contextMenu?.splitTask||"Split Task",icon:da.Split,onClick:()=>{let qt=B.startDate.getTime(),ca=B.endDate.getTime(),dr=qt+(ca-qt)/2,Dr=new Date(dr);yf(B,Dr);}}),xe&&(it.length>0&&it.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),it.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:da.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),it})()}),jsx(fo,{task:Ct,isOpen:!!Ct,onClose:()=>zt(null),onTaskUpdate:M=>{Ct&&(pn(Ct.id,M),zt(null));},theme:ke==="light"?"light":"dark",locale:b==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Ca&&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:()=>ta(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:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Dt.bgSecondary,border:`1px solid ${Dt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Dt.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:Dt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Qe.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},children:b==="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:Dt.textSecondary,fontFamily:"Inter, sans-serif"},children:[b==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Dt.textPrimary},children:['"',Ca.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Dt.bgPrimary,borderTop:`1px solid ${Dt.border}`},children:[jsx("button",{onClick:()=>ta(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Dt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=Dt.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:b==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{dl([Ca.taskId]),ta(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),b==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(Li,{tasks:ne,theme:Dt,config:f,onTasksUpdate:Oe,onTaskUpdate:pn,onTaskCreate:M=>{Oe(B=>[...B,M]);},onTaskDelete:M=>{dl([M]);},onDependencyCreate:(M,B)=>{let V=De.findTaskById(ne,M);V&&qc(V,B);},onDependencyDelete:Xc})]})})})});function a2(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 r2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Id=[{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 Fm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Id,...l.filter(S=>!Id.some(Y=>Y.id===S.id))],f=ut[c]||ut.dark,[b,w]=useState(false),[C,N]=useState(false),[T,k]=useState(false),[v,E]=useState(false),[I,D]=useState({top:0,left:0}),[X$1,O]=useState(null),[H,F]=useState(new Date),[q,ee]=useState({top:0,left:0}),[Se,R]=useState(false),[j,be]=useState([]),[Xe,z]=useState(false),[re,J]=useState(""),Fe=useRef(null),he=useRef(null),Ue=useRef(null),Be=useRef(null),nt=useRef(null),[Z,st]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[oe,rt]=useState({});useEffect(()=>{a?(st({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)&&R(true)):(st({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),R(false),be([]));},[a,e,x]),useEffect(()=>{let S=Y=>{Fe.current&&!Fe.current.contains(Y.target)&&w(false),he.current&&!he.current.contains(Y.target)&&N(false),Ue.current&&!Ue.current.contains(Y.target)&&k(false),Be.current&&!Be.current.contains(Y.target)&&E(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let ht=()=>{let S={};return Z.name.trim()||(S.name="El nombre es requerido"),Z.startDate&&Z.endDate&&Z.startDate>Z.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),rt(S),Object.keys(S).length===0},Ft=async S=>{if(S.preventDefault(),!!ht())try{let Y=i==="create"&&j.length>0?{...Z,pendingFiles:j}:Z;await s(Y),be([]),t();}catch(Y){console.error("Error submitting task:",Y);}},ke=(S,Y)=>{st(le=>{let we={...le,[S]:Y};if(S==="status"){let W=Y;W==="todo"?we.progress=0:W==="in-progress"?(le.progress===0||le.progress===100)&&(we.progress=50):W==="completed"||W==="closed"?we.progress=100:(W==="in-review"||W==="review")&&(we.progress=75);}if(S==="progress"){let W=typeof Y=="number"?Y:parseInt(Y,10);W===100&&le.status!=="completed"?we.status="completed":W>0&&W<100&&le.status==="todo"?we.status="in-progress":W===0&&le.status!=="todo"&&(we.status="todo");}return we}),oe[S]&&rt(le=>{let we={...le};return delete we[S],we});},yt=h.find(S=>S.id===Z.status)??Id[0],dt=Bd.find(S=>S.id===Z.priority)??Bd[1],at=Xo.find(S=>S.value===Z.color)??Xo[0],$=c==="dark",de={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":c,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:S=>S.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:yt.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:i==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=f.hoverBg,S.currentTarget.style.color=f.textPrimary;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent",S.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Ft,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:S=>ke("name",S.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}),oe.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),oe.name]})]}),jsx("div",{children:jsx("textarea",{value:Z.description||"",onChange:S=>ke("description",S.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...de,borderColor:yt.color,backgroundColor:`${yt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:yt.color}}),jsx("span",{style:{color:yt.color},children:yt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:yt.color}})]}),jsx(AnimatePresence,{children:b&&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:h.map(S=>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:()=>{ke("status",S.id),w(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,Z.status===S.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxs("div",{ref:he,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&N(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:dt.color}}),jsx("span",{children:dt.label}),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-[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(S=>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:()=>{ke("priority",S.id),N(false);},children:[jsx("span",{children:S.icon}),S.label,Z.priority===S.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxs("div",{ref:Ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[Z.assignees&&Z.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:Z.assignees.slice(0,3).map((S,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:S.color||f.accent,borderColor:f.bgSecondary},children:S.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:T&&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(S=>{let Y=Z.assignees?.some(le=>le.name===S.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:le=>le.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{let le=Y?(Z.assignees||[]).filter(we=>we.name!==S.name):[...Z.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(we=>we[0]).join("").toUpperCase().slice(0,2),color:f.accent}];ke("assignees",le);},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:S.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:S.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}})})]},S.id)})})})]}),jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(v)E(false);else {if(Be.current){let S=Be.current.getBoundingClientRect(),Y=window.innerHeight,le=120,W=Y-S.bottom<le?S.top-le-8:S.bottom+8;D({top:W,left:S.left});}E(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Z.color}}),jsx("span",{children:at.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:v&&jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Xo.slice(0,18).map(S=>{let Y=Z.color===S.value;return jsx("button",{type:"button",onClick:le=>{le.preventDefault(),le.stopPropagation(),ke("color",S.value),E(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:Y?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),m.length>0||d?jsx(Do,{selectedTags:Z.tags||[],availableTags:m,onChange:S=>ke("tags",S),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:nt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!Z.isMilestone)if(X$1==="start")O(null);else {if(nt.current){let S=nt.current.getBoundingClientRect(),Y=window.innerHeight,le=320,W=Y-S.bottom<le?S.top-le-8:S.bottom+8;ee({top:W,left:S.left});}O("start"),F(Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,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(X$1==="end")O(null);else {if(nt.current){let S=nt.current.getBoundingClientRect(),Y=window.innerHeight,le=320,W=Y-S.bottom<le?S.top-le-8:S.bottom+8;ee({top:W,left:S.left});}O("end"),F(Z.endDate||Z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,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:X$1&&jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${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:S=>S.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${$?"#262626":f.border}`},children:[(()=>{let S=new Date,Y=new Date(S);Y.setDate(S.getDate()+1);let le=new Date(S);le.setDate(S.getDate()+7);let we=new Date(S);return we.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:Y},{label:"Pr\xF3xima semana",date:le},{label:"2 semanas",date:we}].map((te,We)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ce=>Ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ce=>Ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{X$1==="start"?(ke("startDate",te.date),(!Z.endDate||te.date>Z.endDate)&&ke("endDate",te.date),O("end")):(ke("endDate",te.date),(!Z.startDate||te.date<Z.startDate)&&ke("startDate",te.date),O(null));},children:te.label},We))})(),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:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("startDate",void 0),ke("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children: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:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children: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((S,Y)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},Y))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=H.getFullYear(),Y=H.getMonth(),le=new Date(S,Y,1).getDay(),we=new Date(S,Y+1,0).getDate(),W=new Date,te=[];for(let Ce=le-1;Ce>=0;Ce--)te.push({day:new Date(S,Y,-Ce).getDate(),date:new Date(S,Y-1,new Date(S,Y,-Ce).getDate()),isCurrentMonth:false});for(let Ce=1;Ce<=we;Ce++)te.push({day:Ce,date:new Date(S,Y,Ce),isCurrentMonth:true});let We=42-te.length;for(let Ce=1;Ce<=We;Ce++)te.push({day:Ce,date:new Date(S,Y+1,Ce),isCurrentMonth:false});return te.map((Ce,He)=>{let Ne=Ce.date.toDateString()===W.toDateString(),_e=Z.startDate?.toDateString()===Ce.date.toDateString(),kt=Z.endDate?.toDateString()===Ce.date.toDateString(),mt=Z.startDate&&Z.endDate&&Ce.date>=Z.startDate&&Ce.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:Ce.isCurrentMonth?_e||kt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:_e?f.accent:kt?"#7C3AED":mt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!_e&&!kt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{X$1==="start"?(ke("startDate",Ce.date),Z.endDate&&Ce.date>Z.endDate&&ke("endDate",Ce.date),O("end")):(ke("endDate",Ce.date),Z.startDate&&Ce.date<Z.startDate&&ke("startDate",Ce.date),O(null));},children:Ce.day},He)})})()})]})]})]})})]}),oe.endDate&&jsx("span",{className:"text-xs text-red-400",children:oe.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:S=>ke("progress",parseInt(S.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:()=>R(!Se),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 ${Se?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:Se&&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?a2(Z.effortMinutes):"",onChange:S=>{let Y=r2(S.target.value);ke("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||i==="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 ",i==="create"?j.length>0&&`(${j.length})`:p.length>0&&`(${p.length})`]})]}),i==="create"?jsx(no,{cardId:"pending",attachments:j.map((S,Y)=>({id:`pending-${Y}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>be(Y=>[...Y,...S]),onDelete:S=>{let Y=parseInt(S.replace("pending-",""),10);be(le=>le.filter((we,W)=>W!==Y));},maxSizeMB:10,maxFiles:20}):jsx(no,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),i==="create"&&j.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[j.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:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:Z.isMilestone,onChange:S=>ke("isMilestone",S.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(S=>{let Y=r.find(le=>le.id===S);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||S.slice(0,8),jsx("button",{type:"button",onClick:()=>{let le=(Z.dependencies||[]).filter(we=>we!==S);ke("dependencies",le);},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"})})]},S)})}),jsxs("button",{type:"button",onClick:()=>{z(!Xe),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(false),J("");}}),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:re,onChange:S=>J(S.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>re===""||S.name.toLowerCase().includes(re.toLowerCase())).map(S=>{let Y=Z.dependencies?.includes(S.id);return jsxs("button",{type:"button",onClick:()=>{let le=Z.dependencies||[],we;Y?we=le.filter(W=>W!==S.id):we=[...le,S.id],ke("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:le=>{Y||(le.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:le=>{le.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:S.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&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:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.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:S=>!n&&(S.currentTarget.style.opacity="0.9"),onMouseLeave:S=>!n&&(S.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:i==="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,13 +410,13 @@ If ambiguous, ask for clarification in the message field.`;function Am(e){return
|
|
|
410
410
|
${Lm(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 Lm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function xo(e,t){let a=Lm(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function Bd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+p):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let p=parseInt(i[1],10),g=parseInt(i[2],10)-1,y=parseInt(i[3],10);return new Date(y,g,p)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=parseInt(l[1],10),g=c[l[2].toLowerCase()],y=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,p)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=m[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,g)}return null}function Rd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Od(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Im(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Bm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),m=r[2].trim(),d=xo(t,l),p=Bd(m);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:y},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),m=o[2].trim(),d=xo(t,l),p=Rd(m);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),m=s[2].trim(),d=xo(t,l),p=Od(m);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),m=n[2].trim(),d=xo(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),m=i[2].trim(),d=xo(t,l),p=xo(t,m);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),m=xo(t,l);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Rm(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 o2(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 n2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Bi(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(p=>p.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Bi(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let n=m=>{if(m)return typeof m=="string"?new Date(m):m},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:o2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Om(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:n2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function $m(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Bi(r,e,t))}var $d={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Hd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Ri={en:$d,es:Hd};function zd(e){return Ri[e]||Ri.en}function Oi(e,t){let a=zd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Ud=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Hm(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 zm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Hm(e),l=Ud[0],m=Ud.find(g=>g.value===c)??l,d=m.icon,p=g=>{switch(Hm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ud.map(g=>{let y=g.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(y,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Wd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Wm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let m=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Wd.find(m=>m.value===e)??Wd[4],l=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Wd.map(m=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(m.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[l]})]},m.value))})]})}function hs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Gd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Vd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),d=useRef(null);useEffect(()=>{let x=h=>{m.current&&!m.current.contains(h.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:hs(x.name),color:x.color||Gd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Gd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||hs(x.name)},`${x.name}-${h}`)),e.length>3&&jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:m,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Gd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||hs(x.name)},`${x.name}-${h}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:d,type:"text",value:c,onChange:x=>l(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||hs(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):hs(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Ym({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,m]=useState(false),[d,p]=useState(o),[g,y]=useState(()=>{let k=o==="start"?e:t;if(k){let w=k instanceof Date?k:new Date(k);return new Date(w.getFullYear(),w.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let k=w=>{x.current&&!x.current.contains(w.target)&&m(false);};return l&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{l&&p(r?o:"start");},[l,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",v=useCallback(()=>{let k=g.getFullYear(),w=g.getMonth(),E=new Date(k,w,1),D=new Date(k,w+1,0).getDate(),X=E.getDay(),O=[],F=new Date(k,w,0).getDate();for(let ee=X-1;ee>=0;ee--)O.push({date:new Date(k,w-1,F-ee),isCurrentMonth:false});for(let ee=1;ee<=D;ee++)O.push({date:new Date(k,w,ee),isCurrentMonth:true});let q=42-O.length;for(let ee=1;ee<=q;ee++)O.push({date:new Date(k,w+1,ee),isCurrentMonth:false});return O},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),m(false);else if(d==="start"){let w=f&&k>f?k:f;a(k,w||void 0),p("end");}else {let w=h&&k<h?k:h;a(w||void 0,k),m(false);}},N=()=>{let k=new Date,w=new Date(k);w.setDate(k.getDate()+1);let E=new Date(k);E.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let I=new Date(k);I.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let D=new Date(k);D.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let X=new Date(k);X.setDate(k.getDate()+14);let O=new Date(k);return O.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:E,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let k=r&&o==="start"?h:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let T=r&&o==="start"?h:f;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{onClick:k=>{k.stopPropagation(),m(!l);let w=o==="start"?h:f;w&&y(new Date(w.getFullYear(),w.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),l&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((k,w)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>C(k.date),children:[jsx("span",{children:k.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},w)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),m(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:v().map((k,w)=>{let E=k.date.toDateString()===new Date().toDateString(),I=h?.toDateString()===k.date.toDateString(),D=f?.toDateString()===k.date.toDateString(),X=I||D,O=!r&&h&&f&&k.date>=h&&k.date<=f;return jsx("button",{onClick:()=>C(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),E&&"ring-2 ring-[#007BFF]",I&&"bg-[#007BFF] text-white",D&&!I&&"bg-[#7C3AED] text-white",O&&!X&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!X&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},w)})})]})]})]})]})}function zi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Ym,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Rn(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 Ui(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[i,c]=useState(false),l=useRef(e),m=useRef([]);return useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,p=e,g=p-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),v=Math.round(d+g*b);n(v),x===o&&(c(false),n(p));},y*x);m.current.push(h);}return l.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function qm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,i]=useState(0),c=useRef(null),l=useRef(null),m=useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let y=Date.now();l.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);i(h);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function Jm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),{isFlashing:d,triggerFlash:p}=Rn(),{displayValue:g,isAnimating:y}=Ui(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let N=C.currentTarget.getBoundingClientRect(),T=C.clientX-N.left,k=Math.round(T/N.width*100),w=Math.max(0,Math.min(100,k));w!==e&&(t(w),s&&p());},h=useCallback(C=>{r||!t||(C.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=useCallback(()=>{i(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&p());}},[c,t,e,s,p]),b=useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&i(false);},[f]),v=g??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${v}%`}})}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsx("input",{ref:m,value:c,onChange:C=>l(C.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[v,"%"]})]})}function eg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{c(e);},[e]);let m=()=>{i!==e&&t?.(i),n(false);},d=p=>{p.key==="Enter"?m():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:i,onChange:p=>c(p.target.value),onBlur:m,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function rg({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,m]=useState(false),[d,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:x}=Rn(),{displayValue:h,isAnimating:f}=Ui(e,{enabled:i&&!l});useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let C=parseFloat(d);if(!isNaN(C)){let N=C;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&x());}m(false);},v=C=>{C.key==="Enter"?b():C.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):l?jsx("input",{ref:g,type:"number",value:d,onChange:C=>p(C.target.value),onBlur:b,onKeyDown:v,onClick:C=>C.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:C=>{C.stopPropagation(),m(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function og({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=useState(false),c=useRef(null);return useEffect(()=>{let l=m=>{c.current&&!c.current.contains(m.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxs("button",{onClick:m=>{m.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function sg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:m}=qm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?m():l(!e):t(!e));},p=i?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&p&&"ring-green-500/50",i&&!p&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsx("button",{onClick:g=>{g.stopPropagation(),m();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function dg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function G2(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 V2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Nr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[m,d]=useState(false),[p,g]=useState(""),y=useRef(null),{isFlashing:x,triggerFlash:h}=Rn(),f=c==="financial"&&l>0,b=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:G2(e,r);useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),k=e%60;T>0&&k>0?g(`${T}h ${k}m`):T>0?g(`${T}h`):g(`${k}m`);}else g("");},[e,m]);let v=()=>{let T=V2(p);T!==e&&(t?.(T),n&&h()),d(false);},C=T=>{T.key==="Enter"?v():T.key==="Escape"&&d(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let N=f?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:b})]}):m?jsx("input",{ref:y,type:"text",value:p,onChange:T=>g(T.target.value),onBlur:v,onKeyDown:C,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:b})]})}function mg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function fg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",m=i==="financial"&&c>0,d=ee=>m?`$${Math.round(ee*c).toLocaleString("en-US")}`:`${ee}h`,[p,g]=useState(false),[y,x]=useState(false),[h,f]=useState(null),b=useRef(null),v=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,T=Math.round(v/60*10)/10,k=Math.round(C/60*10)/10,w=C>0?v/C*100:0,E=w>100?Math.round((v-C)/60*10)/10:0,I=w>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!y&&!h)return;let ee=Se=>{b.current&&!b.current.contains(Se.target)&&(x(false),f(null));};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[y,h]);let D=ee=>{if(ee.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Se=>!Se),f(null);return}n&&n(e);},X=ee=>{x(false),f(ee);},O=async(ee,Se)=>{h==="log"&&r&&ee?r(e,ee,Se):h==="estimate"&&o?o(e,ee):h==="quoted"&&s&&s(e,ee),f(null);},H=r||o||s||n,F=[{mode:"log",icon:Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(ee=>ee.show),q=h==="estimate"?C:h==="quoted"?N:void 0;return C===0&&v===0&&N===0?jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&H&&jsx("button",{onClick:D,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:F.map(ee=>jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(ee.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(ao,{mode:h,locale:a,isDark:t,currentValue:q||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(T)}),C>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),E>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(E)," Over"]})]}),C>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(w,100)}%`,backgroundColor:I,borderRadius:2,transition:"width 0.3s"}})})]}),H&&jsx("button",{onClick:D,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:F.map(ee=>jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(ee.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(ao,{mode:h,locale:a,isDark:t,currentValue:q||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function J2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function Q2(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function bg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function hg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let m=J2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsx(bg,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:m.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?Q2(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(bg,{assignee:s,size:28,isDark:t}),jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var Z2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function xg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Z2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function g1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function f1(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:i,onColumnHide:c,onColumnSort:l,availableUsers:m=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=useRef(null),b=r==="es"?kg.es:kg.en;if(useEffect(()=>{let k=E=>{f.current&&!f.current.contains(E.target)&&t();},w=E=>{E.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",w);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),i&&(k.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),m.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(w=>({id:`assign-${w.id}`,label:w.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:w.name.charAt(0).toUpperCase()}),onClick:()=>{let E=e.task.assignees||[],D=E.some(X=>X.name===w.name)?E.filter(X=>X.name!==w.name):[...E,{name:w.name,initials:g1(w.name),color:w.color||f1(w.name),avatar:w.avatarUrl}];i({...e.task,assignees:D}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},C=()=>{if(!e.columnId)return [];let k=[];return l&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},N=e.type==="task"?v():C(),T={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:f,style:T,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(k=>k.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsx(b1,{item:k,isDark:a},k.id):jsxs("button",{onClick:k.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function b1({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxs("button",{onClick:i.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var kg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var Lg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},L1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Bg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=useState(""),[m,d]=useState(null),[p,g]=useState(null),y=useRef(null),x=i==="es"?Ig.es:Ig.en;useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let w=y.current.parentElement;if(w){let X=w.getBoundingClientRect();g({top:X.bottom+4,right:window.innerWidth-X.right});}let E=y.current.getBoundingClientRect(),D=window.innerHeight-E.top-20;d(Math.max(300,D));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let w=I=>{y.current&&!y.current.contains(I.target)&&t();},E=I=>{I.key==="Escape"&&t();};document.addEventListener("mousedown",w),document.addEventListener("keydown",E),y._cleanup=()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",E);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=useMemo(()=>{let k=new Set([...L1]);return a.forEach(w=>{w.type&&w.type!=="assignees"&&k.add(w.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let w=x.columns[k];if(w)return w;let E=a.find(I=>I.type===k);return E?.label?E.label:k},b=k=>{if(k==="name")return;let w=a.map(E=>E.id===k?{...E,visible:!E.visible}:E);o(w);},v=(k,w)=>{let E=a.find(D=>D.type===k&&(!w||D.customFieldId===w));if(E){b(E.id);return}let I={id:w||k,type:k,label:w?r.find(D=>D.id===w)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:w};o([...a,I]);},C=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),N=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),T=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:y,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[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:x.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:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:k=>l(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:k=>{k&&k.style.setProperty("--focus-border",T);},onFocus:k=>{k.currentTarget.style.borderColor=T,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:k=>k.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:x.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:C.map(k=>{let w=a.find(D=>D.type===k&&!D.customFieldId),E=w?.visible??false,I=k==="name";return jsxs("button",{onClick:()=>{I||(w?b(w.id):v(k));},disabled:I,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:I?.4:1,cursor:I?"not-allowed":"pointer"},onMouseEnter:D=>{I||(D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&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:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Lg[k]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),N.length>0&&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:x.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:N.map(k=>{let E=a.find(I=>I.customFieldId===k.id)?.visible??false;return jsxs("button",{onClick:()=>v(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:I=>{I.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&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:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Lg[k.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Ig={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var W1=[{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 $g({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[i,c]=useState("text"),[l,m]=useState([""]),d=o==="es"?Og.es:Og.en;useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let p=()=>{if(!s.trim())return;let h={name:s.trim(),type:i};i==="dropdown"&&(h.options=l.filter(f=>f.trim())),a(h),t();},g=()=>{m([...l,""]);},y=(h,f)=>{let b=[...l];b[h]=f,m(b);},x=h=>{l.length>1&&m(l.filter((f,b)=>b!==h));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:W1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:u("text-xs",i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),i==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[l.map((h,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>x(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},f)),jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Og={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 Ug={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Wg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=useState(false),c=useRef(null),l=useRef(0),m=s==="es"?Ug.es:Ug.en;useEffect(()=>{if(!n)return;let g=x=>{Date.now()-l.current<100||c.current&&!c.current.contains(x.target)&&i(false);},y=x=>{x.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:m.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),m.filters,p&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Gg(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 ws(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${Math.round(e).toLocaleString("en-US")}`}function Vg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:s?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),n&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let i=e.totalOffered??0,c=e.totalEstimated??0,l=e.totalExecuted??0,m=i-c,d=i>0?Math.round(m/i*100):0,p=i>0?Math.min(Math.round(c/i*100),120):0,g=c>i&&i>0,y=g?"#FF2D20":"#00E5CC";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:ws(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:ws(c)})]}),l>0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:ws(l)})]}),i>0&&jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(p,100)}%`,backgroundColor:y}})}),jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#FF2D20]/10 text-[#FF2D20]":"bg-red-50 text-red-600"),children:[m>=0?`+${ws(m)} ${s?"Disp.":"Avail."}`:`${ws(Math.abs(m))} ${s?"P\xE9rdida":"Loss"}`,i>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let i=e.totalHoursSpentMinutes??0,c=e.totalHoursAllocatedMinutes??0,l=c>0?Math.min(Math.round(i/c*100),100):0,m=i>c&&c>0,d=m?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",m?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Gg(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Gg(c)})]}),c>0&&jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let i=e.scheduleVarianceDays??0,c=i>0,l=i<0,m=e.scheduleVarianceLabel||(c?`+${i} ${s?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${i} ${s?"D\xEDas ATR\xC1S":"Days BEHIND"}`:s?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",c&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#FF2D20":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var ow=[{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 Xg(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(...Xg(r.subtasks,t+1));return a}function nw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let m=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(m<=0)continue;let d=(s.progress||0)/m;r+=d,o++;}return o>0?r/o:null}function sw(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Un(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=Un(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 zn(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 iw({value:e,onChange:t,isDark:a}){let[r,o]=useState(false),[s,n]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Jg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:m="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:v=false,onCreateTask:C,persistFilter:N=false,financialBlur:T,healthSidebar:k,lens:w="hours",hourlyRate:E=0,rateMap:I,aggregateParentHours:D=false,showProjectTotals:X=false}=t,O=Oi(d,p),H=m==="dark",F=P=>{if(!I||!P.assignees||P.assignees.length===0)return E;let ce=P.assignees.map(Te=>Te.id?I[Te.id]:void 0).filter(Te=>Te!=null&&Te>0);return ce.length===0?E:ce.reduce((Te,ze)=>Te+ze,0)/ce.length},q=P=>{let ce=0,Te=0,ze=0,Ze=Xe=>{let ye=Ca.find(Ge=>Ge.id===Xe.id)||Xe;if(ye.subtasks?.length)for(let Ge of ye.subtasks)Ze(Ge);else {let Ge=ye._costRate>0?ye._costRate:F(ye);ce+=(ye.timeLoggedMinutes??0)/60*Ge,Te+=(ye.effortMinutes??0)/60*Ge,ze+=(ye.soldEffortMinutes??0)/60*Ge;}};if(P.subtasks)for(let Xe of P.subtasks)Ze(Xe);return {dollarSpent:ce,dollarAllocated:Te,dollarQuoted:ze}},ee=useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let P=localStorage.getItem(N);if(P){let ce=JSON.parse(P);return {statusFilter:ce.statusFilter||"all",hideCompleted:ce.hideCompleted||!1}}}catch(P){console.error("Error loading persisted filter:",P);}return {statusFilter:"all",hideCompleted:false}},[N]),Se=useMemo(()=>{function P(ce){let Te=0,ze=0,Ze=0,Xe=0,ye=0,Ge=0;for(let Ct of ce)if(Ct.subtasks&&Ct.subtasks.length>0){let Dt=P(Ct.subtasks);Te+=Dt.spent,ze+=Dt.allocated,Ze+=Dt.quoted,Xe+=Dt.dollarSpent,ye+=Dt.dollarAllocated,Ge+=Dt.dollarQuoted;}else {let Dt=Ct.timeLoggedMinutes??0,Rt=Ct.effortMinutes??0,Ot=Ct.soldEffortMinutes??0;Te+=Dt,ze+=Rt,Ze+=Ot;let Ut=F(Ct);Xe+=Dt/60*Ut,ye+=Rt/60*Ut,Ge+=Ot/60*Ut;}return {spent:Te,allocated:ze,quoted:Ze,dollarSpent:Xe,dollarAllocated:ye,dollarQuoted:Ge}}return P(e)},[e]),R=useMemo(()=>{let P=new Map;function ce(Te){let ze=0;for(let Ze of Te)if(Ze.subtasks&&Ze.subtasks.length>0){let Xe=ce(Ze.subtasks);P.set(Ze.id,Xe),ze+=Xe;}else ze+=Ze.weight||0;return ze}return ce(e),P},[e]),j=useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:Se.spent,totalHoursAllocatedMinutes:Se.allocated}},[k,Se]),[be,Je]=useState(true),[z,re]=useState("position"),[J,Fe]=useState("asc"),[he,Ue]=useState(""),[Be,nt]=useState(()=>ee().statusFilter),[Z,st]=useState(()=>ee().hideCompleted),[oe,rt]=useState(x||ow),[ht,Mt]=useState(false),[ke,yt]=useState(false),[dt,at]=useState({isOpen:false,x:0,y:0,type:"task"}),[$,de]=useState(null),[S,Y]=useState(false),[le,we]=useState(null),[W,te]=useState(null),[We,Ce]=useState(null),He=useRef(0),Ne=useRef(false),_e=!!(a.onTaskMove||a.onTaskReparent),wt=useCallback((P,ce)=>{_e&&(ce.preventDefault(),He.current=ce.clientY,de(P),Ne.current=false,Y(false),Ce({x:ce.clientX,y:ce.clientY}));},[_e]),mt=useCallback(P=>{if(!$||(Math.abs(P.clientY-He.current)>5&&!Ne.current&&(Ne.current=true,Y(true)),Ce({x:P.clientX,y:P.clientY}),!Ne.current))return;let Te=document.querySelectorAll("[data-listview-row]"),ze=null,Ze=null;Te.forEach(Xe=>{let ye=Xe.getBoundingClientRect(),Ge=Xe.getAttribute("data-listview-row");if(Ge&&Ge!==$&&P.clientY>=ye.top&&P.clientY<=ye.bottom){ze=Ge;let Ct=P.clientY-ye.top,Dt=ye.height;Ze=Ct<Dt*.25?"above":Ct>Dt*.75?"below":"child";}}),we(ze),te(Ze);},[$]),ot=useCallback(()=>{if(Ne.current&&$&&le&&W){if(W==="child"&&a.onTaskReparent)a.onTaskReparent($,le);else if(W==="above"||W==="below"){let P=(ze,Ze,Xe=null)=>{for(let ye of ze){if(ye.id===Ze)return Xe;if(ye.subtasks){let Ge=P(ye.subtasks,Ze,ye.id);if(Ge!==void 0)return Ge}}},ce=P(e,$,null),Te=P(e,le,null);if(a.onTaskReparent){let ze=(Dt,Rt)=>{if(Rt===null)return Dt;for(let Ot of Dt){if(Ot.id===Rt)return Ot.subtasks||[];if(Ot.subtasks){let Ut=ze(Ot.subtasks,Rt);if(Ut.length>0||Ot.subtasks.some(pa=>pa.id===Rt))return Ut}}return []},Ze=ze(e,Te??null),Xe=Ze.findIndex(Dt=>Dt.id===le),ye=ce===Te,Ge=ye?Ze.findIndex(Dt=>Dt.id===$):-1,Ct=W==="below"?Xe+1:Xe;ye&&Ge!==-1&&Ge<Xe&&(Ct-=1),a.onTaskReparent($,Te??null,Math.max(0,Ct));}}}de(null),we(null),te(null),Ce(null),Ne.current=false,Y(false);},[$,le,W,e,a]);useEffect(()=>{if($)return document.addEventListener("mousemove",mt),document.addEventListener("mouseup",ot),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",mt),document.removeEventListener("mouseup",ot),document.body.style.cursor="",document.body.style.userSelect="";}},[$,mt,ot]);let[et,Yt]=useState("all"),[Ft,xt]=useState(false),Tt=useRef(null),gt=useRef(null),zt=useMemo(()=>{let P=0;function ce(Te,ze){for(let Ze of Te)ze>P&&(P=ze),Ze.subtasks?.length&&ce(Ze.subtasks,ze+1);}return ce(e,1),P},[e]);useEffect(()=>{if(!Ft)return;let P=ce=>{Tt.current?.contains(ce.target)||gt.current?.contains(ce.target)||xt(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[Ft]),useEffect(()=>{if(et==="all"){let Te=function(ze){for(let Ze of ze)Ze.subtasks?.length&&(Ze.isExpanded===false&&a.onTaskToggleExpand?.(Ze.id),Te(Ze.subtasks));};Te(e);}else {let Te=function(ze,Ze){for(let Xe of ze)if(Xe.subtasks?.length){let ye=Ze<et,Ge=Xe.isExpanded!==false;ye!==Ge&&a.onTaskToggleExpand?.(Xe.id),Te(Xe.subtasks,Ze+1);}};Te(e,1);}},[et]);let[Re,Ae]=useState(null),[ct,se]=useState(0),[fe,L]=useState(0),_=useRef(null),[K,ue]=useState(null),[Me,Ke]=useState(null);useEffect(()=>{x&&rt(x);},[x]),useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:Be,hideCompleted:Z}));}catch(P){console.error("Error persisting filter state:",P);}},[N,Be,Z]);let je=useMemo(()=>{let P=new Set;function ce(Te){for(let ze of Te)ze.subtasks?.length&&(ze.isExpanded!==false&&P.add(ze.id),ce(ze.subtasks));}return ce(e),P},[e]),Le=useMemo(()=>oe.filter(P=>P.visible),[oe]),ft=useCallback(P=>{a.onTaskToggleExpand?.(P);},[a]),kt=useCallback(P=>{z===P?Fe(ce=>ce==="asc"?"desc":"asc"):(re(P),Fe("asc")),a.onSortChange?.({column:P,direction:J==="asc"?"desc":"asc"});},[z,J,a]),Ht=useCallback(P=>{rt(P),a.onColumnsChange?.(P);},[a]),wa=useCallback(P=>{let ce=oe.map(Te=>Te.id===P?{...Te,visible:false}:Te);Ht(ce);},[oe,Ht]),ta=useCallback((P,ce)=>{re(P),Fe(ce);},[]),U=useCallback((P,ce,Te)=>{b&&(P.preventDefault(),at({isOpen:true,x:P.clientX,y:P.clientY,type:ce?"task":"header",task:ce,columnId:Te}));},[b]),ne=useCallback(()=>{at(P=>({...P,isOpen:false}));},[]),Oe=useCallback((P,ce)=>{if(!f)return;P.preventDefault(),P.stopPropagation();let Te=oe.find(ze=>ze.id===ce);Te&&(Ae(ce),se(P.clientX),L(Te.width));},[oe,f]);useEffect(()=>{if(!Re)return;let P=Te=>{let ze=Te.clientX-ct,Ze=Math.max(50,fe+ze),Xe=oe.map(ye=>ye.id===Re?{...ye,width:Ze}:ye);rt(Xe);},ce=()=>{Re&&a.onColumnsChange?.(oe),Ae(null);};return document.addEventListener("mousemove",P),document.addEventListener("mouseup",ce),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",ce);}},[Re,ct,fe,oe,a]);let A=useCallback((P,ce)=>{if(ce==="name"){P.preventDefault();return}ue(ce),P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",ce),P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="0.5");},[]),ge=useCallback(P=>{P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="1"),ue(null),Ke(null);},[]),Ve=useCallback((P,ce)=>{P.preventDefault(),ce!=="name"&&(P.dataTransfer.dropEffect="move",Ke(ce));},[]),tt=useCallback(()=>{Ke(null);},[]),oa=useCallback((P,ce)=>{if(P.preventDefault(),!K||K===ce||ce==="name")return;let Te=[...oe],ze=Te.findIndex(ye=>ye.id===K),Ze=Te.findIndex(ye=>ye.id===ce);if(ze===-1||Ze===-1)return;let Xe=Te.splice(ze,1);Xe[0]&&(Te.splice(Ze,0,Xe[0]),Ht(Te),ue(null),Ke(null));},[K,oe,Ht]),Wt=useCallback(async P=>{if(a.onCreateCustomField){let ce={...P,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(ce);}yt(false);},[a]),ka=useCallback(P=>P.progress===100||P.status==="completed"?"completed":P.progress&&P.progress>0||P.status==="in-progress"?"in-progress":"todo",[]),Ca=useMemo(()=>{let P=Xg(e);if(he.trim()){let ce=he.toLowerCase();P=P.filter(Te=>Te.name.toLowerCase().includes(ce));}return Be!=="all"&&(P=P.filter(ce=>ka(ce)===Be)),Z&&(P=P.filter(ce=>ka(ce)!=="completed")),P.sort((ce,Te)=>{let ze,Ze;switch(z){case "name":ze=ce.name.toLowerCase(),Ze=Te.name.toLowerCase();break;case "startDate":ze=ce.startDate?.getTime()||0,Ze=Te.startDate?.getTime()||0;break;case "endDate":ze=ce.endDate?.getTime()||0,Ze=Te.endDate?.getTime()||0;break;case "progress":ze=ce.progress||0,Ze=Te.progress||0;break;case "status":ze=ce.status||"todo",Ze=Te.status||"todo";break;case "priority":let Xe={urgent:0,high:1,medium:2,low:3,none:4};ze=Xe[ce.priority]??4,Ze=Xe[Te.priority]??4;break;case "position":return 0;default:return 0}return ze<Ze?J==="asc"?-1:1:ze>Ze?J==="asc"?1:-1:0}),P},[e,he,Be,Z,z,J,ka]),Wa=useCallback((P,ce)=>{let Te=Xe=>{a.onTaskUpdate?.({...P,...Xe});},ze=Xe=>Xe?P.customFields?.find(Ge=>Ge.fieldId===Xe)?.value:void 0,Ze=(Xe,ye)=>{if(!Xe)return;let Ct=[...P.customFields||[]],Dt=Ct.findIndex(Rt=>Rt.fieldId===Xe);Dt>=0?Ct[Dt]={fieldId:Xe,value:ye}:Ct.push({fieldId:Xe,value:ye}),Te({customFields:Ct});};switch(ce.type){case "name":return null;case "status":return jsx(zm,{value:P.status||(P.progress===100?"completed":P.progress&&P.progress>0?"in-progress":"todo"),onChange:ye=>{Te({status:ye,progress:ye==="completed"?100:ye==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsx(Wm,{value:P.priority,onChange:ye=>Te({priority:ye}),isDark:H,locale:d});case "assignees":{let ye=P.hasChildren,Ge=P.assignees||[];if(ye&&P.subtasks?.length){let Ct=new Map;(P.assignees||[]).forEach(Rt=>Ct.set(Rt.name,Rt));let Dt=Rt=>{(Rt||[]).forEach(Ot=>{(Ot.assignees||[]).forEach(Ut=>{Ct.has(Ut.name)||Ct.set(Ut.name,Ut);}),Ot.subtasks?.length&&Dt(Ot.subtasks);});};Dt(P.subtasks),Ge=Array.from(Ct.values());}return jsx(Vd,{value:Ge,availableUsers:i,onChange:Ct=>Te({assignees:Ct}),isDark:H,locale:d,disabled:ye})}case "startDate":return jsx(zi,{value:P.startDate,onChange:ye=>Te({startDate:ye}),isDark:H,locale:d,dateField:"start",startDate:P.startDate,endDate:P.endDate});case "endDate":return jsx(zi,{value:P.endDate,onChange:ye=>Te({endDate:ye}),isDark:H,locale:d,dateField:"end",startDate:P.startDate,endDate:P.endDate});case "progress":return jsx(Jm,{value:P.progress||0,onChange:ye=>{let Ge=ye===100?"completed":ye>0?"in-progress":"todo";Te({progress:ye,status:Ge});},isDark:H});case "tags":return jsx(dg,{value:P.tags||[],isDark:H});case "text":return jsx(eg,{value:ze(ce.customFieldId)||"",onChange:ye=>Ze(ce.customFieldId,ye),isDark:H});case "number":return jsx(rg,{value:ze(ce.customFieldId)||0,onChange:ye=>Ze(ce.customFieldId,ye),isDark:H});case "date":let Xe=ze(ce.customFieldId);return jsx(zi,{value:Xe?new Date(Xe):void 0,onChange:ye=>Ze(ce.customFieldId,ye),isDark:H,locale:d});case "dropdown":return jsx(og,{value:ze(ce.customFieldId)||"",options:ce.options||[],onChange:ye=>Ze(ce.customFieldId,ye),isDark:H});case "checkbox":return jsx(sg,{value:ze(ce.customFieldId)||false,onChange:ye=>Ze(ce.customFieldId,ye),isDark:H});case "estimatedTime":{let ye=P.status==="completed"||P.progress===100;return jsx(Nr,{value:P.estimatedTime,onChange:Ge=>Te({estimatedTime:Ge}),isDark:H,locale:d,disabled:ye,lens:w,hourlyRate:F(P)})}case "quotedTime":{let ye=P.status==="completed"||P.progress===100,Ge=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(Nr,{value:P.quotedTime,onChange:Ct=>Te({quotedTime:Ct}),isDark:H,locale:d,disabled:ye,isBlurred:Ge,lens:w,hourlyRate:F(P)})}case "elapsedTime":{let ye=P.status==="completed"||P.progress===100;return jsx(Nr,{value:P.elapsedTime,onChange:Ge=>Te({elapsedTime:Ge}),isDark:H,locale:d,disabled:ye,lens:w,hourlyRate:F(P)})}case "effortMinutes":{if(D&&P.subtasks&&P.subtasks.length>0){let{allocated:Rt,quoted:Ot}=Un(P);if(w==="financial"){let Ut=q(P),pa=Math.round(Ut.dollarAllocated),Ba=Math.round(Ut.dollarQuoted),Ga=Ba-pa;return jsxs("div",{className:"flex items-center gap-1.5",children:[pa>0?jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",pa.toLocaleString("en-US")]}):null,Ga!==0&&pa>0&&Ba>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Ga>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ga>0?"+":"",Math.abs(Ga)>=1e3?`$${(Ga/1e3).toFixed(1)}K`:`$${Ga}`]})]})}return jsx(Nr,{value:Rt>0?Rt:void 0,isDark:H,locale:d,disabled:true,lens:w,hourlyRate:E})}let ye=P.status==="completed"||P.progress===100,Ge=P.effortMinutes||0,Ct=P.soldEffortMinutes||0,Dt=F(P);if(w==="financial"&&Dt&&Ge>0&&Ct>0){let Rt=Math.round(Ge/60*Dt),Ut=Math.round(Ct/60*Dt)-Rt;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Nr,{value:Ge,onChange:pa=>Te({effortMinutes:pa}),isDark:H,locale:d,disabled:ye,lens:w,hourlyRate:F(P)}),Ut!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Ut>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ut>0?"+":"",Math.abs(Ut)>=1e3?`$${(Ut/1e3).toFixed(1)}K`:`$${Ut}`]})]})}return jsx(Nr,{value:Ge,onChange:Rt=>Te({effortMinutes:Rt}),isDark:H,locale:d,disabled:ye,lens:w,hourlyRate:F(P)})}case "timeLoggedMinutes":{if(D&&P.subtasks&&P.subtasks.length>0){let{spent:Ge}=Un(P);return jsx(Nr,{value:Ge>0?Ge:void 0,isDark:H,locale:d,disabled:true,lens:w,hourlyRate:F(P)})}let ye=P.status==="completed"||P.progress===100;return jsx(Nr,{value:P.timeLoggedMinutes,onChange:a.onLogTime?Ge=>{a.onLogTime?.(P,Ge);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:ye,lens:w,hourlyRate:F(P)})}case "soldEffortMinutes":{if(D&&P.subtasks&&P.subtasks.length>0){let{quoted:Ct}=Un(P),Dt=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Nr,{value:Ct>0?Ct:void 0,isDark:H,locale:d,disabled:true,isBlurred:Dt,lens:w,hourlyRate:F(P)})}let ye=P.status==="completed"||P.progress===100,Ge=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Nr,{value:P.soldEffortMinutes,onChange:Ct=>Te({soldEffortMinutes:Ct}),isDark:H,locale:d,disabled:ye,isBlurred:Ge,lens:w,hourlyRate:F(P)})}case "scheduleVariance":{let ye=P.effortMinutes||0,Ge=P.soldEffortMinutes||0,Ct=P.timeLoggedMinutes||0,Dt=ye>0||Ge>0||Ct>0;return jsx(mg,{startDate:P.startDate,endDate:P.endDate,scheduleVariance:P.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:Dt})}case "hoursBar":{if(D&&P.hasChildren){let{spent:ye,allocated:Ge,quoted:Ct}=Un(P),Dt=ye>Ge&&Ge>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",Dt?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:zn(ye)}),Ge>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-white/60":"text-gray-600",children:zn(Ge)})]}),Ct>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:zn(Ct)})]})]})}return jsx(fg,{task:P,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:w,hourlyRate:F(P)})}case "teamLoad":return P.hasChildren||P.subtasks&&P.subtasks.length>0?jsx(hg,{task:P,isDark:H,locale:d}):jsx(Vd,{value:P.assignees||[],availableUsers:i,onChange:Ge=>{a.onTaskUpdate?.({...P,assignees:Ge});},isDark:H,locale:d});case "blockers":return jsx(xg,{blockers:P.blockers,isDark:H,locale:d});case "weight":{let ye=R.get(P.id);if(ye!==void 0)return jsx("span",{className:u("text-xs font-mono",ye>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?`${Number(ye.toFixed(2))}%`:"\u2014"});let Ge=P.weight||0;return jsx(iw,{value:Ge,onChange:Ct=>Te({weight:Ct}),isDark:H})}default:return jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,D,R]),fa=useCallback(P=>{let Te={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[P.type]||P.label;return typeof Te=="string"?Te:String(Te||P.type)},[O,d]),nr=useMemo(()=>{let Te=Le.reduce((Ze,Xe)=>Ze+Xe.width,0)+(h?48:0),ze={};for(let Ze of Le)ze[Ze.id]=`${Ze.width/Te*100}%`;return ze},[Le,h]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxs("div",{ref:_,className:u(H?"bg-[#0D0D0D]":"bg-white",Re&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ca.length," ",O.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:he,onChange:P=>Ue(P.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",H?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),y&&zt>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:Tt,onClick:()=>xt(!Ft),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?Ft?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":Ft?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),et==="all"?d==="es"?"Todos":"All":`L${et}`]}),Ft&&jsx("div",{ref:gt,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",H?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(zt,5)},(P,ce)=>({value:ce+1,label:`L${ce+1}`}))].map(P=>jsxs("button",{onClick:()=>{Yt(P.value),xt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?et===P.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":et===P.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:P.label}),et===P.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(P.value)))})]}),jsx(Wg,{value:Be,hideCompleted:Z,onChange:nt,onHideCompletedChange:st,isDark:H,locale:d}),j?.enabled&&j.data&&!be&&jsx("button",{onClick:()=>Je(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",H?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,v&&C&&jsxs(motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:O.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Le.map(P=>{let ce=P.id!=="name",Te=Me===P.id&&K!==P.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",H?"text-white/60":"text-gray-500",ce&&"cursor-grab",K===P.id&&"opacity-50",Te&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:nr[P.id],minWidth:P.minWidth},draggable:ce,onDragStart:ce?ze=>A(ze,P.id):void 0,onDragEnd:ce?ge:void 0,onDragOver:ce?ze=>Ve(ze,P.id):void 0,onDragLeave:ce?tt:void 0,onDrop:ce?ze=>oa(ze,P.id):void 0,onContextMenu:ze=>U(ze,void 0,P.id),children:[ce&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",H?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),P.sortable?jsxs("button",{draggable:false,onClick:()=>kt(P.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[fa(P),jsx(ArrowUpDown,{className:u("w-3 h-3",z===P.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:fa(P)}),f&&P.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",Re===P.id&&"bg-[#007BFF]"),onMouseDown:ze=>Oe(ze,P.id)})]},P.id)}),h&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:P=>{P.stopPropagation(),Mt(ce=>!ce);},className:u("p-0.5 rounded transition-colors",H?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ht&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(Bg,{isOpen:ht,onClose:()=>Mt(false),columns:oe,customFields:c,onColumnsChange:Ht,onCreateCustomField:()=>{Mt(false),yt(true);},isDark:H,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ca.map((P,ce)=>{let Te=je.has(P.id),ze=Math.min(ce*.01,.2),Ze=P.hasChildren&&P.level===0,Xe=P.subtasks?.length||0;if(Ze){let{spent:Ot,allocated:Ut,quoted:pa}=Un(P),Ba=nw(P),Ga=sw(P);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ze},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(P),children:Le.map(Sa=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:nr[Sa.id],minWidth:Sa.minWidth},children:Sa.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:qa=>{qa.stopPropagation(),ft(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Te?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:qa=>{qa.stopPropagation(),ft(P.id);},className:"flex-shrink-0 cursor-pointer",children:Te?jsx(FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),P.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:H?"#FFD60A":"#B45309"},children:P.wbsCode}),jsx("span",{title:P.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",H?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:P.name}),jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",H?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",Xe," ",d==="es"?Xe===1?"Tarea":"Tareas":Xe===1?"Item":"Items",")"]}),Ba!==null&&jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",Ba>=1?"text-[#32D74B]":Ba>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",Ba.toFixed(2)]}),Ga>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",Ga]})]}):Sa.type==="timeLoggedMinutes"?jsx(Nr,{value:Ot>0?Ot:void 0,isDark:H,locale:d,disabled:true,lens:w,hourlyRate:F(P)}):Sa.type==="soldEffortMinutes"?jsx(Nr,{value:pa>0?pa:void 0,isDark:H,locale:d,disabled:true,lens:w,hourlyRate:F(P)}):Sa.type==="effortMinutes"?jsx(Nr,{value:Ut>0?Ut:void 0,isDark:H,locale:d,disabled:true,lens:w,hourlyRate:F(P)}):Wa(P,Sa)},Sa.id))},P.id)}let ye=$===P.id,Ge=le===P.id,Ct=Ge&&W==="above",Dt=Ge&&W==="below",Rt=Ge&&W==="child";return jsxs(motion.div,{"data-listview-row":P.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ze},className:u("flex items-center border-b transition-colors relative group",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),style:{opacity:ye?.4:1,backgroundColor:Rt?H?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:Rt?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(P),onDoubleClick:()=>a.onTaskDoubleClick?.(P),onContextMenu:Ot=>U(Ot,P),children:[Ct&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),Dt&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),_e&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:Ot=>wt(P.id,Ot),style:{color:H?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Le.map(Ot=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:nr[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&P.level>0&&jsx("div",{style:{width:`${P.level*24}px`},className:"flex-shrink-0"}),y&&P.hasChildren&&jsx("button",{onClick:Ut=>{Ut.stopPropagation(),ft(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Te?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),y&&!P.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(P.wbsCode||P.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[P.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:P.wbsCode}),P.taskCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:P.taskCode})]}),jsx("span",{className:u("truncate font-bold text-[13px]",P.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:P.name}),P.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${P.tags[0].color}20`,color:P.tags[0].color},children:P.tags[0].name})]})]}):Wa(P,Ot)},Ot.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},P.id)})}),X&&Ca.length>0&&(()=>{let{spent:P,allocated:ce,quoted:Te}=Se,ze=ce-P,Ze=ze<0,Xe=Ze?`+${zn(Math.abs(ze))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${zn(ze)} ${d==="es"?"AHORRADO":"SAVED"}`,ye=w==="financial"&&E>0,Ge=(Rt,Ot)=>{if(ye){let Ut=Ot??Rt/60*E;return `$${Math.round(Ut).toLocaleString("en-US")}`}return zn(Rt)},Ct=ye?Math.abs(Se.dollarAllocated-Se.dollarSpent):0,Dt=ye?`${Ze?"+":"-"}$${Ct.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ze?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:Xe;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",H?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:H?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Le.map(Rt=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:nr[Rt.id],minWidth:Rt.minWidth},children:Rt.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Rt.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ge(P,ye?Se.dollarSpent:void 0)}),jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ge(ce,ye?Se.dollarAllocated:void 0)}),ce>0&&jsx("span",{className:u("text-[10px] font-semibold ml-1",Ze?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye?Dt:Xe})]}):Rt.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Te>0?Ge(Te,ye?Se.dollarQuoted:void 0):"\u2013"}):Rt.type==="effortMinutes"?(()=>{if(ye&&Te>0&&ce>0){let Ot=Math.round(Se.dollarQuoted),Ut=Math.round(Se.dollarAllocated),pa=Ot-Ut,Ba=Ot>0?Math.round(pa/Ot*100):0;return jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ge(ce,Se.dollarAllocated)}),jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",pa>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[pa>=0?"+":"",Math.abs(pa)>=1e3?`$${(pa/1e3).toFixed(1)}K`:`$${pa}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Ba,"%)"]})]})]})}return jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ce>0?Ge(ce,ye?Se.dollarAllocated:void 0):"\u2013"})})():Rt.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:P>0?Ge(P,ye?Se.dollarSpent:void 0):"\u2013"}):Rt.type==="progress"?(()=>{let Ot=e||[],Ut=0,pa=0,Ba=0,Ga=0;for(let qa of Ot){let _t=qa.weight||R.get(qa.id)||0,Is=qa.progress||0;_t>0&&(Ut+=Is*_t,pa+=_t),Ba+=Is,Ga++;}let Sa=pa>0?Math.round(Ut/pa*10)/10:Ga>0?Math.round(Ba/Ga):0;return jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Sa,"%"]})})():Rt.type==="weight"?(()=>{let Ot=e||[],Ut=[],pa=qa=>{for(let _t of qa)Ut.push(_t),_t.subtasks?.length&&pa(_t.subtasks);};pa(Ot);let Ga=Ut.filter(qa=>!qa.subtasks?.length||qa.subtasks.length===0).reduce((qa,_t)=>qa+(_t.weight||0),0),Sa=Math.abs(Ga-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",Sa?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ga.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},Rt.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ca.length===0&&he&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),j?.enabled&&j.data&&be&&jsx(Vg,{data:j.data,isDark:H,locale:d,onClose:()=>Je(false),lens:t?.lens})]}),jsx(Ng,{state:dt,onClose:ne,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:wa,onColumnSort:ta,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),S&&We&&$&&createPortal(jsx("div",{style:{position:"fixed",left:We.x+12,top:We.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ce=De.flattenTasks(e).find(Te=>Te.id===$);return ce?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:H?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${H?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#2E94FF"}}),jsx("span",{className:"text-xs font-medium",style:{color:H?"#e6edf3":"#111827"},children:ce.name})]}):null})()}),document.body),jsx($g,{isOpen:ke,onClose:()=>yt(false),onSave:Wt,isDark:H,locale:d})]})}var Qg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],Zg=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],e0=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var ic={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},lc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},dc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Yi={dark:ic,light:lc,neutral:dc};function t0(e){return Yi[e]||Yi.dark}var cc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},uc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},qi={en:cc,es:uc};function Cs(e){return qi[e]||qi.en}function Xi(e,t){let a=Cs(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 a0(e){let t=Cs(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 r0(e,t=0,a=true){let r=Cs(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 mc(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function s0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var d0=26,fw=22,bw=10;function i0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function gc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function c0(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 l0(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 hw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:m,isStart:d,isEnd:p}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",h=p?gc(c.effortMinutes,n,i):null,f=p?c0(c,n,i):null,b=p?c.blockers?.find(v=>v.severity==="critical"):null;return jsxs(motion.button,{onClick:v=>{v.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${m*d0}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${fw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function u0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:m,comments:d,onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:v,timerState:C,onLogTime:N,onUpdateEstimate:T,onUpdateSoldEffort:k,onStartTimer:w,onStopTimer:E,onDiscardTimer:I,blurFinancials:D=false,suppressDetailModal:X$1=false,lens:O="hours",hourlyRate:H=0}){let{theme:F="dark",locale:q="en",customTranslations:ee,showBacklog:Se=true}=t,R=Xi(q,ee),j=F==="dark"||F==="neutral",[be,Je]=useState(r||new Date),[z,re]=useState(null),[J,Fe]=useState(null),[he,Ue]=useState(null),[Be,nt]=useState({}),Z=3,st=3,oe=useCallback(W=>{Fe(W.id),X$1||re(W),h?.(W.id);},[X$1,h]),[rt,ht]=useState(null),Mt=useCallback(()=>{Je(new Date(be.getFullYear(),be.getMonth()-1,1));},[be]),ke=useCallback(()=>{Je(new Date(be.getFullYear(),be.getMonth()+1,1));},[be]),yt=useCallback(()=>{Je(new Date);},[]),dt=useMemo(()=>{let W=be.getFullYear(),te=be.getMonth(),We=new Date(W,te,1),Ce=new Date(W,te+1,0),He=We.getDay(),Ne=Ce.getDate(),_e=Ns(e),wt=new Date;wt.setHours(0,0,0,0);let mt=[],ot=He,et=new Date(W,te,0).getDate();for(let Ft=ot-1;Ft>=0;Ft--){let xt=new Date(W,te-1,et-Ft);mt.push({date:xt,isCurrentMonth:false,isToday:false,isWeekend:xt.getDay()===0||xt.getDay()===6,events:_e.filter(Tt=>mc(xt,Tt)).map(Tt=>({id:Tt.id,title:Tt.name,start:Tt.startDate,end:Tt.endDate,task:Tt}))});}for(let Ft=1;Ft<=Ne;Ft++){let xt=new Date(W,te,Ft),Tt=xt.getTime()===wt.getTime();mt.push({date:xt,isCurrentMonth:true,isToday:Tt,isWeekend:xt.getDay()===0||xt.getDay()===6,events:_e.filter(gt=>mc(xt,gt)).map(gt=>({id:gt.id,title:gt.name,start:gt.startDate,end:gt.endDate,task:gt}))});}let Yt=42-mt.length;for(let Ft=1;Ft<=Yt;Ft++){let xt=new Date(W,te+1,Ft);mt.push({date:xt,isCurrentMonth:false,isToday:false,isWeekend:xt.getDay()===0||xt.getDay()===6,events:_e.filter(Tt=>mc(xt,Tt)).map(Tt=>({id:Tt.id,title:Tt.name,start:Tt.startDate,end:Tt.endDate,task:Tt}))});}return mt},[be,e]),at=useMemo(()=>Ns(e).filter(W=>!W.startDate||!W.endDate),[e]),$=useMemo(()=>{let W=Ns(e),te=0,We=0,Ce=0,He=0,Ne=0;W.forEach(et=>{et.effortMinutes&&(te+=et.effortMinutes),et.soldEffortMinutes&&(We+=et.soldEffortMinutes),et.scheduleVariance!=null&&(Ce+=et.scheduleVariance,He++),et.soldEffortMinutes&&et.effortMinutes&&(Ne+=et.soldEffortMinutes-et.effortMinutes);});let _e=We>0?Math.min(100,Math.round(te/We*100)):0,wt=He>0?Math.round(Ce/He):0,ot=`${Ne<0?"-":"+"}${l0(Ne,O,H)}`;return {budgetUtil:_e,avgVariance:wt,costDisplay:ot,hasCostData:We>0}},[e,O,H]),de=useMemo(()=>{let W=[0,0,0,0,0,0];return dt.forEach((te,We)=>{let Ce=Math.floor(We/7);te.events.forEach(He=>{if(He.task.startDate&&He.task.soldEffortMinutes){let Ne=new Date(He.task.startDate),_e=te.date;Ne.getFullYear()===_e.getFullYear()&&Ne.getMonth()===_e.getMonth()&&Ne.getDate()===_e.getDate()&&Ce<W.length&&(W[Ce]-=He.task.soldEffortMinutes);}});}),W},[dt]),S=useMemo(()=>{let W=Ns(e),te=new Map,We=new Set,Ce=[0,0,0,0,0,0];if(dt.length===0)return {segmentsByCell:te,multiDayTaskIds:We,maxLanesPerRow:Ce};let He=ot=>new Date(ot.getFullYear(),ot.getMonth(),ot.getDate()),Ne=He(dt[0].date),_e=He(dt[dt.length-1].date),wt=[];for(let ot of W){if(!ot.startDate||!ot.endDate)continue;let et=He(ot.startDate),Yt=He(ot.endDate);if(et.getTime()===Yt.getTime()||Yt<Ne||et>_e)continue;let Ft=et<Ne?Ne:et,xt=Yt>_e?_e:Yt,Tt=i0(Ft,Ne),gt=i0(xt,Ne);Tt<0||Tt>41||gt<0||gt>41||Tt!==gt&&(We.add(ot.id),wt.push({task:ot,startIdx:Tt,endIdx:gt}));}wt.sort((ot,et)=>ot.startIdx!==et.startIdx?ot.startIdx-et.startIdx:et.endIdx-et.startIdx-(ot.endIdx-ot.startIdx));let mt=[[],[],[],[],[],[]];for(let{task:ot,startIdx:et,endIdx:Yt}of wt){let Ft=Math.floor(et/7),xt=Math.floor(Yt/7),Tt=He(ot.startDate),gt=He(ot.endDate),zt=false;for(let Re=Ft;Re<=xt;Re++){let Ae=Re===Ft?et%7:0,ct=Re===xt?Yt%7:6,se=ct-Ae+1,fe=0,L=mt[Re]??[];for(mt[Re]||(mt[Re]=L);fe<L.length&&(L[fe]??-1)>=Ae;)fe++;if(fe>=bw){zt=true;break}fe>=L.length?L.push(ct):L[fe]=ct,Ce[Re]=Math.max(Ce[Re]??0,fe+1);let _=Re===Ft&&Tt>=Ne,K=Re===xt&><=_e,ue=Re*7+Ae,Me={taskId:ot.id,task:ot,rowIndex:Re,startCol:Ae,endCol:ct,spanCols:se,lane:fe,isStart:_,isEnd:K};te.has(ue)||te.set(ue,[]),te.get(ue).push(Me);}zt&&(We.delete(ot.id),te.forEach((Re,Ae)=>{let ct=Re.filter(se=>se.taskId!==ot.id);ct.length===0?te.delete(Ae):te.set(Ae,ct);}));}return {segmentsByCell:te,multiDayTaskIds:We,maxLanesPerRow:Ce}},[dt,e]),Y=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],le=be.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),we=le.charAt(0).toUpperCase()+le.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",j?"text-white/30":"text-gray-600"),children:[R.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",j?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",j?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",j?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",j?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:R.labels.noEvents}),jsx("p",{className:u("text-sm",j?"text-white/30":"text-gray-600"),children:R.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",j?"bg-[#050505]":"bg-white",n),style:i,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",j?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",j?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",j?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Mt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",j?"text-white":"text-gray-900"),children:we}),jsx("button",{onClick:ke,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:yt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",j?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:R.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(W=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",j?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",j?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Fe(null),children:dt.map((W,te)=>{let We=te%7===6,Ce=te>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!We&&(j?"border-r border-[#222]":"border-r border-gray-200"),!Ce&&(j?"border-b border-[#222]":"border-b border-gray-200"),j?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&&j&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!j&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?j?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?j?"text-white/60":"text-gray-900":j?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let He=Math.floor(te/7),Ne=(S.maxLanesPerRow[He]??0)*d0,_e=S.segmentsByCell.get(te);return Ne===0&&!_e?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:_e?.map(wt=>jsx(hw,{segment:wt,isDark:j,blurFinancials:D,isSelected:J===wt.taskId,t:R,lens:O,hourlyRate:H,onClick:()=>{oe(wt.task),a.onEventClick?.({id:wt.task.id,title:wt.task.name,start:wt.task.startDate,end:wt.task.endDate,task:wt.task});}},wt.taskId))})})(),(()=>{let He=W.events.filter(Ne=>Ne.task.isMilestone&&!S.multiDayTaskIds.has(Ne.id));return He.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[He.slice(0,4).map(Ne=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:_e=>{_e.stopPropagation(),oe(Ne.task);}},Ne.id)),He.length>4&&jsxs("span",{className:u("text-[8px] font-mono",j?"text-white/30":"text-gray-400"),children:["+",He.length-4]})]})})(),(()=>{let He=[];W.events.forEach(_e=>{_e.task.blockers?.forEach(wt=>{(wt.severity==="warning"||wt.severity==="critical")&&He.push({taskId:_e.id,type:wt.type,severity:wt.severity,variance:_e.task.scheduleVariance});});});let Ne=He[0];return Ne?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[R.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${R.labels.delay})`:""]})]})}):null})(),(()=>{let He=W.events.filter(mt=>!S.multiDayTaskIds.has(mt.id)),Ne=Be[te]||Z,_e=He.slice(0,Ne),wt=He.length-Ne;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[_e.map(mt=>jsxs(motion.button,{onClick:()=>{oe(mt.task),a.onEventClick?.(mt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",mt.task.progress===100||mt.task.status==="completed"?j?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":j?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:j?mt.task.progress===100||mt.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)"}:mt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",mt.task.isMilestone?j?"text-amber-400":"text-amber-600":mt.task.isCriticalPath?"text-red-400":j?"text-[#1264FF]":"text-gray-400"),children:mt.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:mt.title})]},mt.id)),wt>0&&jsxs("button",{onClick:mt=>{mt.stopPropagation(),nt(ot=>({...ot,[te]:Ne+st}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",wt," ",q==="es"?"m\xE1s":"more"]}),Ne>Z&&He.length>Z&&jsx("button",{onClick:mt=>{mt.stopPropagation(),nt(ot=>({...ot,[te]:Z}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:q==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let He=te>=28,Ne=te%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:_e=>{_e.stopPropagation(),ht(rt===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",rt===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",j?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",rt===te&&"rotate-45")})}),jsx(AnimatePresence,{children:rt===te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ht(null)}),jsx(motion.div,{initial:{opacity:0,y:He?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:He?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",He?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",j?"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(qo,{onSubmit:_e=>{a.onTaskCreate?.({name:_e.name,startDate:_e.startDate||W.date,endDate:_e.endDate||W.date,priority:_e.priority,assignees:_e.assignee?[_e.assignee]:void 0}),ht(null);},onCancel:()=>ht(null),availableUsers:t.availableUsers,isDark:j,locale:q==="es"?"es":"en",defaultDate:W.date,dropdownDirection:He?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let He=Math.floor(te/7),Ne=de[He];if(!Ne||Ne===0)return null;let _e=l0(Ne,O,H);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:[R.labels.cashOut,": ",Ne<0?"-":"+",_e]})})()]},te)})})})]}),Se&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",j?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",j?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:R.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",j?"text-white/20":"text-gray-400"),children:at.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:at.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",j?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",j?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",j?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):at.map(W=>jsxs("button",{onClick:()=>{oe(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",j?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",j?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",j?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(te=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),W.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",j?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",j?"text-white/25":"text-gray-400",D&&"blur-sm select-none"),children:[gc(W.effortMinutes,O,H)&&jsxs("span",{children:[R.labels.estimate,": ",gc(W.effortMinutes,O,H)]}),(()=>{let te=c0(W,O,H);return te?jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsx(Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(s0,{task:W,isDark:j})]}),W.assignees&&W.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((te,We)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},We))})]})]},W.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:R.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",j?"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:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:["\u25C8 ",R.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",j?"text-white/40":"text-gray-500"),children:R.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",j?"text-white/60":"text-gray-700",D&&"blur-sm select-none"),children:[$.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",j?"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:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:R.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.avgVariance>0?"text-emerald-400":$.avgVariance<0?"text-red-400":j?"text-white/50":"text-gray-600"),children:[$.avgVariance>0?"+":"",$.avgVariance," ",R.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:R.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:$.costDisplay})]})]})]})]})]}),!X$1&&jsx(go,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),re(W);},theme:F==="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:c,onCreateTag:l,attachments:z?m?.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:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:v,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:T,onSoldEffortUpdate:k,onTimerStart:w,onTimerStop:E,onTimerDiscard:I,blurFinancials:D}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ue(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",j?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",j?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",j?"text-white/90":"text-gray-900"),children:he.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ue(null),className:u("p-1 rounded",j?"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:he.events.map(W=>jsxs("button",{onClick:()=>{Ue(null),oe(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",j?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(s0,{task:W.task,isDark:j}),jsx("span",{className:u("text-sm truncate flex-1",j?"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 fc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},bc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},hc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Zi={dark:fc,light:bc,neutral:hc};function p0(e){return Zi[e]||Zi.dark}function xw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=useState(false),m=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=m.length,y=new Set(m.flatMap(f=>f.assignedUserIds||[])).size,x=m.map(f=>f.priority).filter(Boolean),h=new Set(m.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[m]),p=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:m.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:m.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var g0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ss(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 Es(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 f0(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 b0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=useMemo(()=>({...g0,...n}),[n]),[l,m]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(v=>{let C=v.timestamp.toISOString().split("T")[0],N=b.get(C);N?N.push(v):b.set(C,[v]);}),Array.from(b.entries()).sort((v,C)=>C[0].localeCompare(v[0])).map(([v,C])=>({date:new Date(v),events:C.sort((N,T)=>T.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=useMemo(()=>{let b=new Set,v=new Set;return e.forEach(C=>{b.add(C.userId),v.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(v)}},[e]),x=b=>{m(v=>{let C=new Set(v);return C.has(b)?C.delete(b):C.add(b),C});},h=b=>{let C=new Date().getTime()-b.getTime(),N=Math.floor(C/6e4),T=Math.floor(C/36e5),k=Math.floor(C/864e5);return N<1?"just now":N<60?`${N}m ago`:T<24?`${T}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",i),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let v=b.target.value;a({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxs("option",{value:b,children:[Es(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let v=b.target.value;a({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(b=>jsx("option",{value:b,children:b},b))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(b=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:b.events.map((v,C)=>{let N=l.has(v.id),T=s===v.id,k=f0(v.type);return jsxs("div",{"data-event-id":v.id,className:u("history-timeline-event",N&&"expanded",T&&"selected"),onClick:()=>o?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Es(v.type)})}),C<b.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&v.userAvatar&&jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsx("span",{className:"history-timeline-event-action",children:Ss(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),x(v.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([w,E])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},w)),v.metadata&&Object.keys(v.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([w,E])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},w))]})]})]})]},v.id)})})]},b.date?.toISOString()||"all"))})]})}function y0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let m=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&Es(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Ss(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>i(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>i(y),title:Ss(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function yc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function xc(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function x0(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 v0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Nw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(m=>{let d=a/2,p=r/2;m.vx+=(d-m.x)*o.centerForce*l,m.vy+=(p-m.y)*o.centerForce*l,n.forEach(g=>{if(m.id===g.id)return;let y=m.x-g.x,x=m.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*l/(h*h);m.vx+=y/h*f,m.vy+=x/h*f;});}),t.forEach(m=>{let d=i.get(typeof m.source=="string"?m.source:m.source.id),p=i.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!p)return;let g=p.x-d.x,y=p.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*l;d.vx+=g*h,d.vy+=y*h,p.vx-=g*h,p.vy-=y*h;}),n.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return n}function w0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=useRef(null),[m,d]=useState([]),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,v]=useState(1),[C,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=Nw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),k=useCallback(O=>{if(!p||!l.current)return;let F=l.current.getBoundingClientRect(),q=(O.clientX-F.left-C.x)/b,ee=(O.clientY-F.top-C.y)/b;d(Se=>Se.map(R=>R.id===p?{...R,x:q,y:ee,fx:q,fy:ee}:R));},[p,b,C]),w=useCallback(()=>{g(null);},[]),E=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),I=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),D=useCallback(O=>{let H=m.find(F=>F.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),X=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=O.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:yc(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[x0(O)," ",xc(O)]})]},O))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:w,onMouseLeave:w,children:[jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=D(typeof O.source=="string"?O.source:O.source.id),F=D(typeof O.target=="string"?O.target:O.target.id),q=v0(O.type),ee=h===O.id,Se=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ee&&"hovered",Se&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:R=>I(O,R),children:[jsx("line",{x1:H.x,y1:H.y,x2:F.x,y2:F.y,stroke:yc(O.type),strokeWidth:Se?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ee?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ee&&jsx("text",{x:(H.x+F.x)/2,y:(H.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:xc(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let H=y===O.id,F=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",H&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:q=>T(O.id,q),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:q=>E(O,q),children:[jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:X(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:H?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function T0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[i,c]=useState(false),[l,m]=useState(null),[d,p]=useState(null),g=useRef(null),y=i||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let b=v=>{v.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),m(null),p(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),m(null),p(null);try{let b=await r(s.trim());p(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,v)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},v))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,v)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},v)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,v)=>jsx("button",{onClick:()=>n(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},v))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var vc={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var Sw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Ew={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 Mw(e,t,a){let r=vc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ms(e){return `$${e.toFixed(4)}`}var wc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Mw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),l={},m={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:m,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let i=this.operations.filter(m=>m.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},nn=new wc;function S0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(nn.getStats()),[s,n]=useState(nn.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(nn.getStats()),n(nn.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=nn.getRecentOperations(5);return jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ms(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ms(m)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:i.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ms(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function F0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=useState(""),[c,l]=useState(""),[m,d]=useState(""),[p,g]=useState(false),[y,x]=useState(null),[h,f]=useState(null),[b,v]=useState(null),C=useRef(null),N=p||o;useEffect(()=>{e&&C.current&&C.current.focus();},[e]),useEffect(()=>{let I=D=>{D.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let T=()=>{N||(i(""),l(""),d(""),x(null),f(null),v(null),t());},k=async()=>{if(!(!n.trim()||N)){g(true),x(null),f(null),v(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});f(I.tasks.tasks),v({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){x(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},w=()=>{h&&(a(h),T());};if(!e)return null;let E=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(Xt,{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:I=>I.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:T,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",E,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((I,D)=>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:["#",D+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.id))})]})}):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:C,value:n,onChange:I=>i(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:I=>l(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((I,D)=>jsx("button",{onClick:()=>i(I),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:I},D))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:N&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:T,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:w,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:k,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function al({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&Us(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,v)=>{console.warn(`Retry attempt ${b} after ${v}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(h,f,b)=>{r(v=>{let C=v.cards.find(I=>I.id===h);if(!C)return v;let N=C.columnId,T={...C,columnId:f,position:b},k=v.cards.map(I=>I.id===h?T:I),w=v.columns.map(I=>{if(I.id===N)return {...I,cardIds:I.cardIds.filter(D=>D!==h)};if(I.id===f){let D=k.filter(X=>X.columnId===f).sort((X,O)=>X.position-O.position);return {...I,cardIds:D.map(X=>X.id)}}return I}),E={...v,cards:k,columns:w};return o(E),E});},[o]),n=useCallback(async(h,f)=>{r(b=>{let v=b.cards.map(N=>N.id===h?{...N,...f}:N),C={...b,cards:v};return o(C),C});},[o]),i=useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let v={...h,id:f},C=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),N={...b,cards:[...b.cards,v],columns:C};return o(N),N});},[o]),c=useCallback(async h=>{r(f=>{let b=f.cards.find(T=>T.id===h);if(!b)return f;let v=f.cards.filter(T=>T.id!==h),C=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(k=>k!==h)}:T),N={...f,cards:v,columns:C};return o(N),N});},[o]),l=useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let v={...h,id:f,cardIds:[]},C={...b,columns:[...b.columns,v]};return o(C),C});},[o]),m=useCallback(async(h,f)=>{r(b=>{let v=b.columns.map(N=>N.id===h?{...N,...f}:N),C={...b,columns:v};return o(C),C});},[o]),d=useCallback(async h=>{r(f=>{let b=f.cards.filter(N=>N.columnId!==h),v=f.columns.filter(N=>N.id!==h),C={...f,cards:b,columns:v};return o(C),C});},[o]),p=useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),g=useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),y=useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function A0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=al({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,l,m={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...m});},addColumn:(c,l)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Fs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},I0={by:"none",order:"asc"};function B0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...Fs,...e}),[s,n]=useState({...I0,...t}),i=useCallback(x=>{o(h=>({...h,...x}));},[]),c=useCallback(x=>{n(h=>({...h,...x}));},[]),l=useCallback(()=>{o(Fs),n(I0);},[]),m=useCallback(()=>{a&&o({...Fs,assignees:[a]});},[a]),d=useCallback(()=>{o({...Fs,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...Fs,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),v=String(f.getMonth()+1).padStart(2,"0"),C=String(f.getDate()).padStart(2,"0"),N=`${b}-${v}-${C}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let k=T.endDate||T.dueDate;if(!k)return false;let w;if(typeof k=="string")w=k.split("T")[0]||k;else {let E=k.getUTCFullYear(),I=String(k.getUTCMonth()+1).padStart(2,"0"),D=String(k.getUTCDate()).padStart(2,"0");w=`${E}-${I}-${D}`;}switch(r.dateFilter){case "overdue":return w<N;case "today":return w===N;case "this-week":let E=new Date(N+"T00:00:00"),I=new Date(w+"T00:00:00"),D=new Date(E);return D.setDate(D.getDate()+7),I>=E&&I<=D;case "custom":if(r.dateRange){let X=typeof k=="string"?new Date(k):k;return X>=r.dateRange.start&&X<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let v=0;switch(s.by){case "created":let C=f.createdAt?new Date(f.createdAt).getTime():0,N=b.createdAt?new Date(b.createdAt).getTime():0;v=C-N;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=T[f.priority||"LOW"],w=T[b.priority||"LOW"];v=k-w;break;case "dueDate":let E=f.endDate||f.dueDate,I=b.endDate||b.dueDate;if(!E)return 1;if(!I)return -1;let D=typeof E=="string"?new Date(E).getTime():E.getTime(),X=typeof I=="string"?new Date(I).getTime():I.getTime();v=D-X;break;case "title":v=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,H=b.estimatedTime||0;v=O-H;break;default:v=0;}return s.order==="asc"?v:-v}),h},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:y,hasActiveFilters:g}}var O0,$0;if(typeof window<"u")try{let e=$s("ai");O0=e.generateObject,$0=e.generateText;}catch{}function H0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(O0&&$0&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function Cc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function z0(e){let{cards:t}=e,[a,r]=Cc(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,y=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(w=>w.columnId===x.columnId).sort((w,E)=>w.position-E.position),b=f.findIndex(w=>w.id===a.lastSelectedCardId),v=f.findIndex(w=>w.id===d),[C,N]=b<v?[b,v]:[v,b],T=f.slice(C,N+1).map(w=>w.id),k=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:m}}var U0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function W0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...U0,...a}),[a]),[s,n]=useState([]),i=useCallback((x,h,f,b,v)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:v,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,C]);},[o.minCardsPerStack,s]),c=useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),l=useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),m=useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let v=b.cardIds.filter(C=>C!==h);return v.length<o.minCardsPerStack?null:{...b,cardIds:v}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),p=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=useCallback(async x=>{let h=t.filter(N=>N.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(N);});}),b.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${T}"`,confidence:.85});});let v=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(T=>{v.has(T)||v.set(T,[]),v.get(T).push(N);});}),v.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(h.forEach(N=>{N.priority&&(C.has(N.priority)||C.set(N.priority,[]),C.get(N.priority).push(N));}),C.forEach((N,T)=>{if(N.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${T} Priority`,cardIds:N.map(w=>w.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let k=(await r.findSimilar(N,h)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let w=[N.id,...k.map(I=>I.card.id)],E=k.reduce((I,D)=>I+D.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:w,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:E});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,T)=>T.confidence-N.confidence).slice(0,5)},[t,o,r]),y=useCallback(x=>{i(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[i]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:y,config:o}}var G0=createContext(null);function V0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=$s("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=$s("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=$s("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(G0.Provider,{value:{store:o},children:e})}function rl(){let e=useContext(G0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function As(){let e=rl(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let i=useCallback(b=>{e.updateBoard(b);},[e]),c=useCallback(b=>{e.addColumn(b);},[e]),l=useCallback((b,v)=>{e.updateColumn(b,v);},[e]),m=useCallback(b=>{e.deleteColumn(b);},[e]),d=useCallback(b=>e.getColumn(b),[e]),p=useCallback(b=>{e.addCard(b);},[e]),g=useCallback((b,v)=>{e.updateCard(b,v);},[e]),y=useCallback(b=>{e.deleteCard(b);},[e]),x=useCallback((b,v,C)=>{e.moveCard(b,v,C);},[e]),h=useCallback(b=>e.getCard(b),[e]),f=useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:m,getColumn:d,addCard:p,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function j0(e){let{cards:t}=As();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 K0(e="position",t="asc"){let{cards:a}=As();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var ol=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=nu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},jw=new ol;function q0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=useRef(null),m=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:p,className:o,children:jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function X0(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 Q0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let m=useRef(null),d=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:i}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:m,style:g,className:s,children:jsx("div",{style:y,children:p.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function Z0(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 ef(e,t=10){return e>t}var Sc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ec={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Mc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Pc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ac={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Lc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ic={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},Bc={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},Rc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Oc={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},$c={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},nl={spacing:Sc,borderRadius:Ec,fontSize:Mc,fontWeight:Fc,lineHeight:Pc,zIndex:Ac,duration:Lc,easing:Ic,shadows:Bc,opacity:Rc,kanban:Oc,gantt:$c};function tf(e,t,a){return e[t]??a}function Hc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Hc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function qw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function zc(e="asakaa"){let t=Hc(nl),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=qw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Lm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function vo(e,t){let a=Lm(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function Rd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+p):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let p=parseInt(i[1],10),g=parseInt(i[2],10)-1,y=parseInt(i[3],10);return new Date(y,g,p)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=parseInt(l[1],10),g=c[l[2].toLowerCase()],y=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,p)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=m[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,g)}return null}function Od(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 $d(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Im(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Bm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),m=r[2].trim(),d=vo(t,l),p=Rd(m);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:y},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),m=o[2].trim(),d=vo(t,l),p=Od(m);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),m=s[2].trim(),d=vo(t,l),p=$d(m);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),m=n[2].trim(),d=vo(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),m=i[2].trim(),d=vo(t,l),p=vo(t,m);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),m=vo(t,l);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Rm(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 o2(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 n2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ri(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(p=>p.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Ri(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let n=m=>{if(m)return typeof m=="string"?new Date(m):m},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:o2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Om(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:n2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function $m(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ri(r,e,t))}var Hd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},zd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Oi={en:Hd,es:zd};function Ud(e){return Oi[e]||Oi.en}function $i(e,t){let a=Ud(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Wd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Hm(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 zm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Hm(e),l=Wd[0],m=Wd.find(g=>g.value===c)??l,d=m.icon,p=g=>{switch(Hm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Wd.map(g=>{let y=g.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(y,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Gd=[{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 Wm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let m=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Gd.find(m=>m.value===e)??Gd[4],l=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Gd.map(m=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(m.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[l]})]},m.value))})]})}function xs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Vd(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 _d({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),d=useRef(null);useEffect(()=>{let x=h=>{m.current&&!m.current.contains(h.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:xs(x.name),color:x.color||Vd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Vd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)},`${x.name}-${h}`)),e.length>3&&jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:m,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Vd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)},`${x.name}-${h}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:d,type:"text",value:c,onChange:x=>l(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):xs(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Ym({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,m]=useState(false),[d,p]=useState(o),[g,y]=useState(()=>{let k=o==="start"?e:t;if(k){let v=k instanceof Date?k:new Date(k);return new Date(v.getFullYear(),v.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let k=v=>{x.current&&!x.current.contains(v.target)&&m(false);};return l&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{l&&p(r?o:"start");},[l,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let k=g.getFullYear(),v=g.getMonth(),E=new Date(k,v,1),D=new Date(k,v+1,0).getDate(),X=E.getDay(),O=[],F=new Date(k,v,0).getDate();for(let ee=X-1;ee>=0;ee--)O.push({date:new Date(k,v-1,F-ee),isCurrentMonth:false});for(let ee=1;ee<=D;ee++)O.push({date:new Date(k,v,ee),isCurrentMonth:true});let q=42-O.length;for(let ee=1;ee<=q;ee++)O.push({date:new Date(k,v+1,ee),isCurrentMonth:false});return O},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),m(false);else if(d==="start"){let v=f&&k>f?k:f;a(k,v||void 0),p("end");}else {let v=h&&k<h?k:h;a(v||void 0,k),m(false);}},N=()=>{let k=new Date,v=new Date(k);v.setDate(k.getDate()+1);let E=new Date(k);E.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let I=new Date(k);I.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let D=new Date(k);D.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let X=new Date(k);X.setDate(k.getDate()+14);let O=new Date(k);return O.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:v,display:v.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:E,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let k=r&&o==="start"?h:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let T=r&&o==="start"?h:f;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{onClick:k=>{k.stopPropagation(),m(!l);let v=o==="start"?h:f;v&&y(new Date(v.getFullYear(),v.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),l&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((k,v)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>C(k.date),children:[jsx("span",{children:k.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},v)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),m(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((k,v)=>{let E=k.date.toDateString()===new Date().toDateString(),I=h?.toDateString()===k.date.toDateString(),D=f?.toDateString()===k.date.toDateString(),X=I||D,O=!r&&h&&f&&k.date>=h&&k.date<=f;return jsx("button",{onClick:()=>C(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),E&&"ring-2 ring-[#007BFF]",I&&"bg-[#007BFF] text-white",D&&!I&&"bg-[#7C3AED] text-white",O&&!X&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!X&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},v)})})]})]})]})]})}function Ui({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Ym,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function $n(e=600){let[t,a]=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 Wi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[i,c]=useState(false),l=useRef(e),m=useRef([]);return useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,p=e,g=p-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),w=Math.round(d+g*b);n(w),x===o&&(c(false),n(p));},y*x);m.current.push(h);}return l.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function qm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,i]=useState(0),c=useRef(null),l=useRef(null),m=useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let y=Date.now();l.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);i(h);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function Jm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),{isFlashing:d,triggerFlash:p}=$n(),{displayValue:g,isAnimating:y}=Wi(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let N=C.currentTarget.getBoundingClientRect(),T=C.clientX-N.left,k=Math.round(T/N.width*100),v=Math.max(0,Math.min(100,k));v!==e&&(t(v),s&&p());},h=useCallback(C=>{r||!t||(C.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=useCallback(()=>{i(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&p());}},[c,t,e,s,p]),b=useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&i(false);},[f]),w=g??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsx("input",{ref:m,value:c,onChange:C=>l(C.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function eg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{c(e);},[e]);let m=()=>{i!==e&&t?.(i),n(false);},d=p=>{p.key==="Enter"?m():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:i,onChange:p=>c(p.target.value),onBlur:m,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function rg({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,m]=useState(false),[d,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:x}=$n(),{displayValue:h,isAnimating:f}=Wi(e,{enabled:i&&!l});useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let C=parseFloat(d);if(!isNaN(C)){let N=C;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&x());}m(false);},w=C=>{C.key==="Enter"?b():C.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):l?jsx("input",{ref:g,type:"number",value:d,onChange:C=>p(C.target.value),onBlur:b,onKeyDown:w,onClick:C=>C.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:C=>{C.stopPropagation(),m(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function og({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=useState(false),c=useRef(null);return useEffect(()=>{let l=m=>{c.current&&!c.current.contains(m.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxs("button",{onClick:m=>{m.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function sg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:m}=qm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?m():l(!e):t(!e));},p=i?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&p&&"ring-green-500/50",i&&!p&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsx("button",{onClick:g=>{g.stopPropagation(),m();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function dg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function G2(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 V2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Nr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[m,d]=useState(false),[p,g]=useState(""),y=useRef(null),{isFlashing:x,triggerFlash:h}=$n(),f=c==="financial"&&l>0,b=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:G2(e,r);useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),k=e%60;T>0&&k>0?g(`${T}h ${k}m`):T>0?g(`${T}h`):g(`${k}m`);}else g("");},[e,m]);let w=()=>{let T=V2(p);T!==e&&(t?.(T),n&&h()),d(false);},C=T=>{T.key==="Enter"?w():T.key==="Escape"&&d(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let N=f?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:b})]}):m?jsx("input",{ref:y,type:"text",value:p,onChange:T=>g(T.target.value),onBlur:w,onKeyDown:C,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:b})]})}function mg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function fg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",m=i==="financial"&&c>0,d=ee=>m?`$${Math.round(ee*c).toLocaleString("en-US")}`:`${ee}h`,[p,g]=useState(false),[y,x]=useState(false),[h,f]=useState(null),b=useRef(null),w=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,T=Math.round(w/60*10)/10,k=Math.round(C/60*10)/10,v=C>0?w/C*100:0,E=v>100?Math.round((w-C)/60*10)/10:0,I=v>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!y&&!h)return;let ee=Se=>{b.current&&!b.current.contains(Se.target)&&(x(false),f(null));};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[y,h]);let D=ee=>{if(ee.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Se=>!Se),f(null);return}n&&n(e);},X=ee=>{x(false),f(ee);},O=async(ee,Se)=>{h==="log"&&r&&ee?r(e,ee,Se):h==="estimate"&&o?o(e,ee):h==="quoted"&&s&&s(e,ee),f(null);},H=r||o||s||n,F=[{mode:"log",icon:Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(ee=>ee.show),q=h==="estimate"?C:h==="quoted"?N:void 0;return C===0&&w===0&&N===0?jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&H&&jsx("button",{onClick:D,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:F.map(ee=>jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(ee.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(ao,{mode:h,locale:a,isDark:t,currentValue:q||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(T)}),C>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),E>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(E)," Over"]})]}),C>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(v,100)}%`,backgroundColor:I,borderRadius:2,transition:"width 0.3s"}})})]}),H&&jsx("button",{onClick:D,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:F.map(ee=>jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(ee.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(ao,{mode:h,locale:a,isDark:t,currentValue:q||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function J2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function Q2(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function bg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function hg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let m=J2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsx(bg,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:m.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?Q2(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(bg,{assignee:s,size:28,isDark:t}),jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var Z2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function xg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Z2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function g1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function f1(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:i,onColumnHide:c,onColumnSort:l,availableUsers:m=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=useRef(null),b=r==="es"?kg.es:kg.en;if(useEffect(()=>{let k=E=>{f.current&&!f.current.contains(E.target)&&t();},v=E=>{E.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",v);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),i&&(k.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),m.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(v=>({id:`assign-${v.id}`,label:v.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:v.name.charAt(0).toUpperCase()}),onClick:()=>{let E=e.task.assignees||[],D=E.some(X=>X.name===v.name)?E.filter(X=>X.name!==v.name):[...E,{name:v.name,initials:g1(v.name),color:v.color||f1(v.name),avatar:v.avatarUrl}];i({...e.task,assignees:D}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},C=()=>{if(!e.columnId)return [];let k=[];return l&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},N=e.type==="task"?w():C(),T={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:f,style:T,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(k=>k.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsx(b1,{item:k,isDark:a},k.id):jsxs("button",{onClick:k.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function b1({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxs("button",{onClick:i.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var kg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var Lg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},L1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Bg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=useState(""),[m,d]=useState(null),[p,g]=useState(null),y=useRef(null),x=i==="es"?Ig.es:Ig.en;useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let v=y.current.parentElement;if(v){let X=v.getBoundingClientRect();g({top:X.bottom+4,right:window.innerWidth-X.right});}let E=y.current.getBoundingClientRect(),D=window.innerHeight-E.top-20;d(Math.max(300,D));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let v=I=>{y.current&&!y.current.contains(I.target)&&t();},E=I=>{I.key==="Escape"&&t();};document.addEventListener("mousedown",v),document.addEventListener("keydown",E),y._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",E);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=useMemo(()=>{let k=new Set([...L1]);return a.forEach(v=>{v.type&&v.type!=="assignees"&&k.add(v.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let v=x.columns[k];if(v)return v;let E=a.find(I=>I.type===k);return E?.label?E.label:k},b=k=>{if(k==="name")return;let v=a.map(E=>E.id===k?{...E,visible:!E.visible}:E);o(v);},w=(k,v)=>{let E=a.find(D=>D.type===k&&(!v||D.customFieldId===v));if(E){b(E.id);return}let I={id:v||k,type:k,label:v?r.find(D=>D.id===v)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:v};o([...a,I]);},C=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),N=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),T=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:y,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[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:x.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:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:k=>l(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:k=>{k&&k.style.setProperty("--focus-border",T);},onFocus:k=>{k.currentTarget.style.borderColor=T,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:k=>k.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:x.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:C.map(k=>{let v=a.find(D=>D.type===k&&!D.customFieldId),E=v?.visible??false,I=k==="name";return jsxs("button",{onClick:()=>{I||(v?b(v.id):w(k));},disabled:I,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:I?.4:1,cursor:I?"not-allowed":"pointer"},onMouseEnter:D=>{I||(D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&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:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Lg[k]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),N.length>0&&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:x.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:N.map(k=>{let E=a.find(I=>I.customFieldId===k.id)?.visible??false;return jsxs("button",{onClick:()=>w(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:I=>{I.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&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:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Lg[k.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Ig={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var W1=[{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 $g({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[i,c]=useState("text"),[l,m]=useState([""]),d=o==="es"?Og.es:Og.en;useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let p=()=>{if(!s.trim())return;let h={name:s.trim(),type:i};i==="dropdown"&&(h.options=l.filter(f=>f.trim())),a(h),t();},g=()=>{m([...l,""]);},y=(h,f)=>{let b=[...l];b[h]=f,m(b);},x=h=>{l.length>1&&m(l.filter((f,b)=>b!==h));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:W1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:u("text-xs",i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),i==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[l.map((h,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>x(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},f)),jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Og={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 Ug={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Wg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=useState(false),c=useRef(null),l=useRef(0),m=s==="es"?Ug.es:Ug.en;useEffect(()=>{if(!n)return;let g=x=>{Date.now()-l.current<100||c.current&&!c.current.contains(x.target)&&i(false);},y=x=>{x.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:m.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),m.filters,p&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Gg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Cs(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${Math.round(e).toLocaleString("en-US")}`}function Vg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:s?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),n&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let i=e.totalOffered??0,c=e.totalEstimated??0,l=e.totalExecuted??0,m=i-c,d=i>0?Math.round(m/i*100):0,p=i>0?Math.min(Math.round(c/i*100),120):0,g=c>i&&i>0,y=g?"#FF2D20":"#00E5CC";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Cs(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Cs(c)})]}),l>0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Cs(l)})]}),i>0&&jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(p,100)}%`,backgroundColor:y}})}),jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#FF2D20]/10 text-[#FF2D20]":"bg-red-50 text-red-600"),children:[m>=0?`+${Cs(m)} ${s?"Disp.":"Avail."}`:`${Cs(Math.abs(m))} ${s?"P\xE9rdida":"Loss"}`,i>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let i=e.totalHoursSpentMinutes??0,c=e.totalHoursAllocatedMinutes??0,l=c>0?Math.min(Math.round(i/c*100),100):0,m=i>c&&c>0,d=m?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",m?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Gg(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Gg(c)})]}),c>0&&jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let i=e.scheduleVarianceDays??0,c=i>0,l=i<0,m=e.scheduleVarianceLabel||(c?`+${i} ${s?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${i} ${s?"D\xEDas ATR\xC1S":"Days BEHIND"}`:s?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",c&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#FF2D20]/15 text-[#FF2D20]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#FF2D20":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var ow=[{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 Xg(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(...Xg(r.subtasks,t+1));return a}function nw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let m=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(m<=0)continue;let d=(s.progress||0)/m;r+=d,o++;}return o>0?r/o:null}function sw(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Gn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Gn(o);t+=s.spent,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 Wn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function iw({value:e,onChange:t,isDark:a}){let[r,o]=useState(false),[s,n]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Jg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:m="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:w=false,onCreateTask:C,persistFilter:N=false,financialBlur:T,healthSidebar:k,lens:v="hours",hourlyRate:E=0,rateMap:I,aggregateParentHours:D=false,showProjectTotals:X=false}=t,O=$i(d,p),H=m==="dark",F=P=>{if(!I||!P.assignees||P.assignees.length===0)return E;let ce=P.assignees.map(Te=>Te.id?I[Te.id]:void 0).filter(Te=>Te!=null&&Te>0);return ce.length===0?E:ce.reduce((Te,ze)=>Te+ze,0)/ce.length},q=P=>{let ce=0,Te=0,ze=0,Ze=Qe=>{for(let ye of Qe)if(ye.subtasks&&ye.subtasks.length>0)Ze(ye.subtasks);else {let Ge=F(ye);ce+=(ye.timeLoggedMinutes??0)/60*Ge,Te+=(ye.effortMinutes??0)/60*Ge,ze+=(ye.soldEffortMinutes??0)/60*Ge;}};return P.subtasks&&Ze(P.subtasks),{dollarSpent:ce,dollarAllocated:Te,dollarQuoted:ze}},ee=useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let P=localStorage.getItem(N);if(P){let ce=JSON.parse(P);return {statusFilter:ce.statusFilter||"all",hideCompleted:ce.hideCompleted||!1}}}catch(P){console.error("Error loading persisted filter:",P);}return {statusFilter:"all",hideCompleted:false}},[N]),Se=useMemo(()=>{function P(ce){let Te=0,ze=0,Ze=0,Qe=0,ye=0,Ge=0;for(let xt of ce)if(xt.subtasks&&xt.subtasks.length>0){let Et=P(xt.subtasks);Te+=Et.spent,ze+=Et.allocated,Ze+=Et.quoted,Qe+=Et.dollarSpent,ye+=Et.dollarAllocated,Ge+=Et.dollarQuoted;}else {let Et=xt.timeLoggedMinutes??0,$t=xt.effortMinutes??0,At=xt.soldEffortMinutes??0;Te+=Et,ze+=$t,Ze+=At;let Ut=F(xt);Qe+=Et/60*Ut,ye+=$t/60*Ut,Ge+=At/60*Ut;}return {spent:Te,allocated:ze,quoted:Ze,dollarSpent:Qe,dollarAllocated:ye,dollarQuoted:Ge}}return P(e)},[e]),R=useMemo(()=>{let P=new Map;function ce(Te){let ze=0;for(let Ze of Te)if(Ze.subtasks&&Ze.subtasks.length>0){let Qe=ce(Ze.subtasks);P.set(Ze.id,Qe),ze+=Qe;}else ze+=Ze.weight||0;return ze}return ce(e),P},[e]),j=useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:Se.spent,totalHoursAllocatedMinutes:Se.allocated}},[k,Se]),[be,Xe]=useState(true),[z,re]=useState("position"),[J,Fe]=useState("asc"),[he,Ue]=useState(""),[Be,nt]=useState(()=>ee().statusFilter),[Z,st]=useState(()=>ee().hideCompleted),[oe,rt]=useState(x||ow),[ht,Ft]=useState(false),[ke,yt]=useState(false),[dt,at]=useState({isOpen:false,x:0,y:0,type:"task"}),[$,de]=useState(null),[S,Y]=useState(false),[le,we]=useState(null),[W,te]=useState(null),[We,Ce]=useState(null),He=useRef(0),Ne=useRef(false),_e=!!(a.onTaskMove||a.onTaskReparent),kt=useCallback((P,ce)=>{_e&&(ce.preventDefault(),He.current=ce.clientY,de(P),Ne.current=false,Y(false),Ce({x:ce.clientX,y:ce.clientY}));},[_e]),mt=useCallback(P=>{if(!$||(Math.abs(P.clientY-He.current)>5&&!Ne.current&&(Ne.current=true,Y(true)),Ce({x:P.clientX,y:P.clientY}),!Ne.current))return;let Te=document.querySelectorAll("[data-listview-row]"),ze=null,Ze=null;Te.forEach(Qe=>{let ye=Qe.getBoundingClientRect(),Ge=Qe.getAttribute("data-listview-row");if(Ge&&Ge!==$&&P.clientY>=ye.top&&P.clientY<=ye.bottom){ze=Ge;let xt=P.clientY-ye.top,Et=ye.height;Ze=xt<Et*.25?"above":xt>Et*.75?"below":"child";}}),we(ze),te(Ze);},[$]),ot=useCallback(()=>{if(Ne.current&&$&&le&&W){if(W==="child"&&a.onTaskReparent)a.onTaskReparent($,le);else if(W==="above"||W==="below"){let P=(ze,Ze,Qe=null)=>{for(let ye of ze){if(ye.id===Ze)return Qe;if(ye.subtasks){let Ge=P(ye.subtasks,Ze,ye.id);if(Ge!==void 0)return Ge}}},ce=P(e,$,null),Te=P(e,le,null);if(a.onTaskReparent){let ze=(Et,$t)=>{if($t===null)return Et;for(let At of Et){if(At.id===$t)return At.subtasks||[];if(At.subtasks){let Ut=ze(At.subtasks,$t);if(Ut.length>0||At.subtasks.some(ha=>ha.id===$t))return Ut}}return []},Ze=ze(e,Te??null),Qe=Ze.findIndex(Et=>Et.id===le),ye=ce===Te,Ge=ye?Ze.findIndex(Et=>Et.id===$):-1,xt=W==="below"?Qe+1:Qe;ye&&Ge!==-1&&Ge<Qe&&(xt-=1),a.onTaskReparent($,Te??null,Math.max(0,xt));}}}de(null),we(null),te(null),Ce(null),Ne.current=false,Y(false);},[$,le,W,e,a]);useEffect(()=>{if($)return document.addEventListener("mousemove",mt),document.addEventListener("mouseup",ot),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",mt),document.removeEventListener("mouseup",ot),document.body.style.cursor="",document.body.style.userSelect="";}},[$,mt,ot]);let[et,Yt]=useState("all"),[Pt,vt]=useState(false),Nt=useRef(null),gt=useRef(null),Wt=useMemo(()=>{let P=0;function ce(Te,ze){for(let Ze of Te)ze>P&&(P=ze),Ze.subtasks?.length&&ce(Ze.subtasks,ze+1);}return ce(e,1),P},[e]);useEffect(()=>{if(!Pt)return;let P=ce=>{Nt.current?.contains(ce.target)||gt.current?.contains(ce.target)||vt(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[Pt]),useEffect(()=>{if(et==="all"){let Te=function(ze){for(let Ze of ze)Ze.subtasks?.length&&(Ze.isExpanded===false&&a.onTaskToggleExpand?.(Ze.id),Te(Ze.subtasks));};Te(e);}else {let Te=function(ze,Ze){for(let Qe of ze)if(Qe.subtasks?.length){let ye=Ze<et,Ge=Qe.isExpanded!==false;ye!==Ge&&a.onTaskToggleExpand?.(Qe.id),Te(Qe.subtasks,Ze+1);}};Te(e,1);}},[et]);let[Re,Ae]=useState(null),[ct,se]=useState(0),[fe,L]=useState(0),_=useRef(null),[K,ue]=useState(null),[Me,Ke]=useState(null);useEffect(()=>{x&&rt(x);},[x]),useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:Be,hideCompleted:Z}));}catch(P){console.error("Error persisting filter state:",P);}},[N,Be,Z]);let je=useMemo(()=>{let P=new Set;function ce(Te){for(let ze of Te)ze.subtasks?.length&&(ze.isExpanded!==false&&P.add(ze.id),ce(ze.subtasks));}return ce(e),P},[e]),Le=useMemo(()=>oe.filter(P=>P.visible),[oe]),ft=useCallback(P=>{a.onTaskToggleExpand?.(P);},[a]),Ct=useCallback(P=>{z===P?Fe(ce=>ce==="asc"?"desc":"asc"):(re(P),Fe("asc")),a.onSortChange?.({column:P,direction:J==="asc"?"desc":"asc"});},[z,J,a]),zt=useCallback(P=>{rt(P),a.onColumnsChange?.(P);},[a]),Ca=useCallback(P=>{let ce=oe.map(Te=>Te.id===P?{...Te,visible:false}:Te);zt(ce);},[oe,zt]),ta=useCallback((P,ce)=>{re(P),Fe(ce);},[]),U=useCallback((P,ce,Te)=>{b&&(P.preventDefault(),at({isOpen:true,x:P.clientX,y:P.clientY,type:ce?"task":"header",task:ce,columnId:Te}));},[b]),ne=useCallback(()=>{at(P=>({...P,isOpen:false}));},[]),Oe=useCallback((P,ce)=>{if(!f)return;P.preventDefault(),P.stopPropagation();let Te=oe.find(ze=>ze.id===ce);Te&&(Ae(ce),se(P.clientX),L(Te.width));},[oe,f]);useEffect(()=>{if(!Re)return;let P=Te=>{let ze=Te.clientX-ct,Ze=Math.max(50,fe+ze),Qe=oe.map(ye=>ye.id===Re?{...ye,width:Ze}:ye);rt(Qe);},ce=()=>{Re&&a.onColumnsChange?.(oe),Ae(null);};return document.addEventListener("mousemove",P),document.addEventListener("mouseup",ce),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",ce);}},[Re,ct,fe,oe,a]);let A=useCallback((P,ce)=>{if(ce==="name"){P.preventDefault();return}ue(ce),P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",ce),P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="0.5");},[]),ge=useCallback(P=>{P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="1"),ue(null),Ke(null);},[]),Ve=useCallback((P,ce)=>{P.preventDefault(),ce!=="name"&&(P.dataTransfer.dropEffect="move",Ke(ce));},[]),tt=useCallback(()=>{Ke(null);},[]),oa=useCallback((P,ce)=>{if(P.preventDefault(),!K||K===ce||ce==="name")return;let Te=[...oe],ze=Te.findIndex(ye=>ye.id===K),Ze=Te.findIndex(ye=>ye.id===ce);if(ze===-1||Ze===-1)return;let Qe=Te.splice(ze,1);Qe[0]&&(Te.splice(Ze,0,Qe[0]),zt(Te),ue(null),Ke(null));},[K,oe,zt]),Gt=useCallback(async P=>{if(a.onCreateCustomField){let ce={...P,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(ce);}yt(false);},[a]),Ta=useCallback(P=>P.progress===100||P.status==="completed"?"completed":P.progress&&P.progress>0||P.status==="in-progress"?"in-progress":"todo",[]),Ea=useMemo(()=>{let P=Xg(e);if(he.trim()){let ce=he.toLowerCase();P=P.filter(Te=>Te.name.toLowerCase().includes(ce));}return Be!=="all"&&(P=P.filter(ce=>Ta(ce)===Be)),Z&&(P=P.filter(ce=>Ta(ce)!=="completed")),P.sort((ce,Te)=>{let ze,Ze;switch(z){case "name":ze=ce.name.toLowerCase(),Ze=Te.name.toLowerCase();break;case "startDate":ze=ce.startDate?.getTime()||0,Ze=Te.startDate?.getTime()||0;break;case "endDate":ze=ce.endDate?.getTime()||0,Ze=Te.endDate?.getTime()||0;break;case "progress":ze=ce.progress||0,Ze=Te.progress||0;break;case "status":ze=ce.status||"todo",Ze=Te.status||"todo";break;case "priority":let Qe={urgent:0,high:1,medium:2,low:3,none:4};ze=Qe[ce.priority]??4,Ze=Qe[Te.priority]??4;break;case "position":return 0;default:return 0}return ze<Ze?J==="asc"?-1:1:ze>Ze?J==="asc"?1:-1:0}),P},[e,he,Be,Z,z,J,Ta]),Ga=useCallback((P,ce)=>{let Te=Qe=>{a.onTaskUpdate?.({...P,...Qe});},ze=Qe=>Qe?P.customFields?.find(Ge=>Ge.fieldId===Qe)?.value:void 0,Ze=(Qe,ye)=>{if(!Qe)return;let xt=[...P.customFields||[]],Et=xt.findIndex($t=>$t.fieldId===Qe);Et>=0?xt[Et]={fieldId:Qe,value:ye}:xt.push({fieldId:Qe,value:ye}),Te({customFields:xt});};switch(ce.type){case "name":return null;case "status":return jsx(zm,{value:P.status||(P.progress===100?"completed":P.progress&&P.progress>0?"in-progress":"todo"),onChange:ye=>{Te({status:ye,progress:ye==="completed"?100:ye==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsx(Wm,{value:P.priority,onChange:ye=>Te({priority:ye}),isDark:H,locale:d});case "assignees":{let ye=P.hasChildren,Ge=P.assignees||[];if(ye&&P.subtasks?.length){let xt=new Map;(P.assignees||[]).forEach($t=>xt.set($t.name,$t));let Et=$t=>{($t||[]).forEach(At=>{(At.assignees||[]).forEach(Ut=>{xt.has(Ut.name)||xt.set(Ut.name,Ut);}),At.subtasks?.length&&Et(At.subtasks);});};Et(P.subtasks),Ge=Array.from(xt.values());}return jsx(_d,{value:Ge,availableUsers:i,onChange:xt=>Te({assignees:xt}),isDark:H,locale:d,disabled:ye})}case "startDate":return jsx(Ui,{value:P.startDate,onChange:ye=>Te({startDate:ye}),isDark:H,locale:d,dateField:"start",startDate:P.startDate,endDate:P.endDate});case "endDate":return jsx(Ui,{value:P.endDate,onChange:ye=>Te({endDate:ye}),isDark:H,locale:d,dateField:"end",startDate:P.startDate,endDate:P.endDate});case "progress":{let ye=!!(P.subtasks&&P.subtasks.length>0);return jsx(Jm,{value:P.progress||0,onChange:ye?void 0:Ge=>{let xt=Ge===100?"completed":Ge>0?"in-progress":"todo";Te({progress:Ge,status:xt});},isDark:H,disabled:ye})}case "tags":return jsx(dg,{value:P.tags||[],isDark:H});case "text":return jsx(eg,{value:ze(ce.customFieldId)||"",onChange:ye=>Ze(ce.customFieldId,ye),isDark:H});case "number":return jsx(rg,{value:ze(ce.customFieldId)||0,onChange:ye=>Ze(ce.customFieldId,ye),isDark:H});case "date":let Qe=ze(ce.customFieldId);return jsx(Ui,{value:Qe?new Date(Qe):void 0,onChange:ye=>Ze(ce.customFieldId,ye),isDark:H,locale:d});case "dropdown":return jsx(og,{value:ze(ce.customFieldId)||"",options:ce.options||[],onChange:ye=>Ze(ce.customFieldId,ye),isDark:H});case "checkbox":return jsx(sg,{value:ze(ce.customFieldId)||false,onChange:ye=>Ze(ce.customFieldId,ye),isDark:H});case "estimatedTime":{let ye=P.status==="completed"||P.progress===100;return jsx(Nr,{value:P.estimatedTime,onChange:Ge=>Te({estimatedTime:Ge}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(P)})}case "quotedTime":{let ye=P.status==="completed"||P.progress===100,Ge=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(Nr,{value:P.quotedTime,onChange:xt=>Te({quotedTime:xt}),isDark:H,locale:d,disabled:ye,isBlurred:Ge,lens:v,hourlyRate:F(P)})}case "elapsedTime":{let ye=P.status==="completed"||P.progress===100;return jsx(Nr,{value:P.elapsedTime,onChange:Ge=>Te({elapsedTime:Ge}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(P)})}case "effortMinutes":{if(D&&P.subtasks&&P.subtasks.length>0){let{allocated:$t}=Gn(P);if(v==="financial"){let At=q(P),Ut=Math.round(At.dollarAllocated),ha=Math.round(At.dollarQuoted),ga=ha-Ut;return jsxs("div",{className:"flex items-center gap-1.5",children:[Ut>0?jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",Ut.toLocaleString("en-US")]}):null,ga!==0&&Ut>0&&ha>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",ga>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ga>0?"+":"",Math.abs(ga)>=1e3?`$${(ga/1e3).toFixed(1)}K`:`$${ga}`]})]})}return jsx(Nr,{value:$t>0?$t:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:E})}let ye=P.status==="completed"||P.progress===100,Ge=P.effortMinutes||0,xt=P.soldEffortMinutes||0,Et=F(P);if(v==="financial"&&Et&&Ge>0&&xt>0){let $t=Math.round(Ge/60*Et),Ut=Math.round(xt/60*Et)-$t;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Nr,{value:Ge,onChange:ha=>Te({effortMinutes:ha}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(P)}),Ut!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Ut>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ut>0?"+":"",Math.abs(Ut)>=1e3?`$${(Ut/1e3).toFixed(1)}K`:`$${Ut}`]})]})}return jsx(Nr,{value:Ge,onChange:$t=>Te({effortMinutes:$t}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(P)})}case "timeLoggedMinutes":{if(D&&P.subtasks&&P.subtasks.length>0){let{spent:Ge}=Gn(P);return jsx(Nr,{value:Ge>0?Ge:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(P)})}let ye=P.status==="completed"||P.progress===100;return jsx(Nr,{value:P.timeLoggedMinutes,onChange:a.onLogTime?Ge=>{a.onLogTime?.(P,Ge);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:ye,lens:v,hourlyRate:F(P)})}case "soldEffortMinutes":{if(D&&P.subtasks&&P.subtasks.length>0){let{quoted:xt}=Gn(P),Et=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Nr,{value:xt>0?xt:void 0,isDark:H,locale:d,disabled:true,isBlurred:Et,lens:v,hourlyRate:F(P)})}let ye=P.status==="completed"||P.progress===100,Ge=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Nr,{value:P.soldEffortMinutes,onChange:xt=>Te({soldEffortMinutes:xt}),isDark:H,locale:d,disabled:ye,isBlurred:Ge,lens:v,hourlyRate:F(P)})}case "scheduleVariance":{let ye=P.effortMinutes||0,Ge=P.soldEffortMinutes||0,xt=P.timeLoggedMinutes||0,Et=ye>0||Ge>0||xt>0;return jsx(mg,{startDate:P.startDate,endDate:P.endDate,scheduleVariance:P.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:Et})}case "hoursBar":{if(D&&P.hasChildren){let{spent:ye,allocated:Ge,quoted:xt}=Gn(P),Et=ye>Ge&&Ge>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",Et?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:Wn(ye)}),Ge>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-white/60":"text-gray-600",children:Wn(Ge)})]}),xt>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:Wn(xt)})]})]})}return jsx(fg,{task:P,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:v,hourlyRate:F(P)})}case "teamLoad":return P.hasChildren||P.subtasks&&P.subtasks.length>0?jsx(hg,{task:P,isDark:H,locale:d}):jsx(_d,{value:P.assignees||[],availableUsers:i,onChange:Ge=>{a.onTaskUpdate?.({...P,assignees:Ge});},isDark:H,locale:d});case "blockers":return jsx(xg,{blockers:P.blockers,isDark:H,locale:d});case "weight":{let ye=R.get(P.id);if(ye!==void 0)return jsx("span",{className:u("text-xs font-mono",ye>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?`${Number(ye.toFixed(2))}%`:"\u2014"});let Ge=P.weight||0;return jsx(iw,{value:Ge,onChange:xt=>Te({weight:xt}),isDark:H})}default:return jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,D,R]),ba=useCallback(P=>{let Te={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[P.type]||P.label;return typeof Te=="string"?Te:String(Te||P.type)},[O,d]),or=useMemo(()=>{let Te=Le.reduce((Ze,Qe)=>Ze+Qe.width,0)+(h?48:0),ze={};for(let Ze of Le)ze[Ze.id]=`${Ze.width/Te*100}%`;return ze},[Le,h]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxs("div",{ref:_,className:u(H?"bg-[#0D0D0D]":"bg-white",Re&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ea.length," ",O.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:he,onChange:P=>Ue(P.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",H?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),y&&Wt>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:Nt,onClick:()=>vt(!Pt),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?Pt?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":Pt?"bg-blue-50 border-blue-300 text-blue-600":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),et==="all"?d==="es"?"Todos":"All":`L${et}`]}),Pt&&jsx("div",{ref:gt,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",H?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Wt,5)},(P,ce)=>({value:ce+1,label:`L${ce+1}`}))].map(P=>jsxs("button",{onClick:()=>{Yt(P.value),vt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?et===P.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":et===P.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:P.label}),et===P.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(P.value)))})]}),jsx(Wg,{value:Be,hideCompleted:Z,onChange:nt,onHideCompletedChange:st,isDark:H,locale:d}),j?.enabled&&j.data&&!be&&jsx("button",{onClick:()=>Xe(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",H?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&C&&jsxs(motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:O.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Le.map(P=>{let ce=P.id!=="name",Te=Me===P.id&&K!==P.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",H?"text-white/60":"text-gray-500",ce&&"cursor-grab",K===P.id&&"opacity-50",Te&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:or[P.id],minWidth:P.minWidth},draggable:ce,onDragStart:ce?ze=>A(ze,P.id):void 0,onDragEnd:ce?ge:void 0,onDragOver:ce?ze=>Ve(ze,P.id):void 0,onDragLeave:ce?tt:void 0,onDrop:ce?ze=>oa(ze,P.id):void 0,onContextMenu:ze=>U(ze,void 0,P.id),children:[ce&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",H?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),P.sortable?jsxs("button",{draggable:false,onClick:()=>Ct(P.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[ba(P),jsx(ArrowUpDown,{className:u("w-3 h-3",z===P.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:ba(P)}),f&&P.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",Re===P.id&&"bg-[#007BFF]"),onMouseDown:ze=>Oe(ze,P.id)})]},P.id)}),h&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:P=>{P.stopPropagation(),Ft(ce=>!ce);},className:u("p-0.5 rounded transition-colors",H?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ht&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(Bg,{isOpen:ht,onClose:()=>Ft(false),columns:oe,customFields:c,onColumnsChange:zt,onCreateCustomField:()=>{Ft(false),yt(true);},isDark:H,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ea.map((P,ce)=>{let Te=je.has(P.id),ze=Math.min(ce*.01,.2),Ze=P.hasChildren&&P.level===0,Qe=P.subtasks?.length||0;if(Ze){let{spent:At,allocated:Ut,quoted:ha}=Gn(P),ga=nw(P),yr=sw(P);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ze},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(P),children:Le.map(Ma=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:or[Ma.id],minWidth:Ma.minWidth},children:Ma.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:pa=>{pa.stopPropagation(),ft(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Te?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:pa=>{pa.stopPropagation(),ft(P.id);},className:"flex-shrink-0 cursor-pointer",children:Te?jsx(FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),P.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:H?"#FFD60A":"#B45309"},children:P.wbsCode}),jsx("span",{title:P.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",H?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:P.name}),jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",H?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",Qe," ",d==="es"?Qe===1?"Tarea":"Tareas":Qe===1?"Item":"Items",")"]}),ga!==null&&jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",ga>=1?"text-[#32D74B]":ga>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",ga.toFixed(2)]}),yr>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",yr]})]}):Ma.type==="timeLoggedMinutes"?v==="financial"?(()=>{let pa=q(P),Dt=Math.round(pa.dollarSpent);return Dt>0?jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",Dt.toLocaleString("en-US")]}):null})():jsx(Nr,{value:At>0?At:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(P)}):Ma.type==="soldEffortMinutes"?v==="financial"?(()=>{let pa=q(P),Dt=Math.round(pa.dollarQuoted);return Dt>0?jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",Dt.toLocaleString("en-US")]}):null})():jsx(Nr,{value:ha>0?ha:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(P)}):Ma.type==="effortMinutes"?v==="financial"?(()=>{let pa=q(P),Dt=Math.round(pa.dollarAllocated),Go=Math.round(pa.dollarQuoted),po=Go-Dt;return jsxs("div",{className:"flex items-center gap-1.5",children:[Dt>0?jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",Dt.toLocaleString("en-US")]}):null,po!==0&&Dt>0&&Go>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",po>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[po>0?"+":"",Math.abs(po)>=1e3?`$${(po/1e3).toFixed(1)}K`:`$${po}`]})]})})():jsx(Nr,{value:Ut>0?Ut:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(P)}):Ga(P,Ma)},Ma.id))},P.id)}let ye=$===P.id,Ge=le===P.id,xt=Ge&&W==="above",Et=Ge&&W==="below",$t=Ge&&W==="child";return jsxs(motion.div,{"data-listview-row":P.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ze},className:u("flex items-center border-b transition-colors relative group",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),style:{opacity:ye?.4:1,backgroundColor:$t?H?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:$t?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(P),onDoubleClick:()=>a.onTaskDoubleClick?.(P),onContextMenu:At=>U(At,P),children:[xt&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),Et&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),_e&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:At=>kt(P.id,At),style:{color:H?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Le.map(At=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:or[At.id],minWidth:At.minWidth},children:At.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&P.level>0&&jsx("div",{style:{width:`${P.level*24}px`},className:"flex-shrink-0"}),y&&P.hasChildren&&jsx("button",{onClick:Ut=>{Ut.stopPropagation(),ft(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Te?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),y&&!P.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(P.wbsCode||P.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[P.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:P.wbsCode}),P.taskCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:P.taskCode})]}),jsx("span",{className:u("truncate font-bold text-[13px]",P.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:P.name}),P.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${P.tags[0].color}20`,color:P.tags[0].color},children:P.tags[0].name})]})]}):Ga(P,At)},At.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},P.id)})}),X&&Ea.length>0&&(()=>{let{spent:P,allocated:ce,quoted:Te}=Se,ze=ce-P,Ze=ze<0,Qe=Ze?`+${Wn(Math.abs(ze))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Wn(ze)} ${d==="es"?"AHORRADO":"SAVED"}`,ye=v==="financial"&&E>0,Ge=($t,At)=>{if(ye){let Ut=At??$t/60*E;return `$${Math.round(Ut).toLocaleString("en-US")}`}return Wn($t)},xt=ye?Math.abs(Se.dollarAllocated-Se.dollarSpent):0,Et=ye?`${Ze?"+":"-"}$${xt.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ze?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:Qe;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",H?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:H?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Le.map($t=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:or[$t.id],minWidth:$t.minWidth},children:$t.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):$t.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ge(P,ye?Se.dollarSpent:void 0)}),jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ge(ce,ye?Se.dollarAllocated:void 0)}),ce>0&&jsx("span",{className:u("text-[10px] font-semibold ml-1",Ze?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye?Et:Qe})]}):$t.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Te>0?Ge(Te,ye?Se.dollarQuoted:void 0):"\u2013"}):$t.type==="effortMinutes"?(()=>{if(ye&&Te>0&&ce>0){let At=Math.round(Se.dollarQuoted),Ut=Math.round(Se.dollarAllocated),ha=At-Ut,ga=At>0?Math.round(ha/At*100):0;return jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ge(ce,Se.dollarAllocated)}),jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",ha>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ha>=0?"+":"",Math.abs(ha)>=1e3?`$${(ha/1e3).toFixed(1)}K`:`$${ha}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",ga,"%)"]})]})]})}return jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ce>0?Ge(ce,ye?Se.dollarAllocated:void 0):"\u2013"})})():$t.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:P>0?Ge(P,ye?Se.dollarSpent:void 0):"\u2013"}):$t.type==="progress"?(()=>{let At=e||[],Ut=0,ha=0,ga=0,yr=0;for(let pa of At){let Dt=pa.weight||R.get(pa.id)||0,Go=pa.progress||0;Dt>0&&(Ut+=Go*Dt,ha+=Dt),ga+=Go,yr++;}let Ma=ha>0?Math.round(Ut/ha*10)/10:yr>0?Math.round(ga/yr):0;return jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Ma,"%"]})})():$t.type==="weight"?(()=>{let At=e||[],Ut=[],ha=pa=>{for(let Dt of pa)Ut.push(Dt),Dt.subtasks?.length&&ha(Dt.subtasks);};ha(At);let yr=Ut.filter(pa=>!pa.subtasks?.length||pa.subtasks.length===0).reduce((pa,Dt)=>pa+(Dt.weight||0),0),Ma=Math.abs(yr-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",Ma?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(yr.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},$t.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ea.length===0&&he&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),j?.enabled&&j.data&&be&&jsx(Vg,{data:j.data,isDark:H,locale:d,onClose:()=>Xe(false),lens:t?.lens})]}),jsx(Ng,{state:dt,onClose:ne,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ca,onColumnSort:ta,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),S&&We&&$&&createPortal(jsx("div",{style:{position:"fixed",left:We.x+12,top:We.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ce=De.flattenTasks(e).find(Te=>Te.id===$);return ce?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:H?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${H?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#2E94FF"}}),jsx("span",{className:"text-xs font-medium",style:{color:H?"#e6edf3":"#111827"},children:ce.name})]}):null})()}),document.body),jsx($g,{isOpen:ke,onClose:()=>yt(false),onSave:Gt,isDark:H,locale:d})]})}var Qg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],Zg=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],e0=[{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 lc={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"},dc={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"},cc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},qi={dark:lc,light:dc,neutral:cc};function t0(e){return qi[e]||qi.dark}var uc={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"}},pc={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"}},Xi={en:uc,es:pc};function Ns(e){return Xi[e]||Xi.en}function Ji(e,t){let a=Ns(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function a0(e){let t=Ns(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function r0(e,t=0,a=true){let r=Ns(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Ss(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function gc(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 s0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var d0=26,fw=22,bw=10;function i0(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 fc(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 c0(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 l0(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 hw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:m,isStart:d,isEnd:p}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",h=p?fc(c.effortMinutes,n,i):null,f=p?c0(c,n,i):null,b=p?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${m*d0}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${fw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function u0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:m,comments:d,onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,timerState:C,onLogTime:N,onUpdateEstimate:T,onUpdateSoldEffort:k,onStartTimer:v,onStopTimer:E,onDiscardTimer:I,blurFinancials:D=false,suppressDetailModal:X$1=false,lens:O="hours",hourlyRate:H=0}){let{theme:F="dark",locale:q="en",customTranslations:ee,showBacklog:Se=true}=t,R=Ji(q,ee),j=F==="dark"||F==="neutral",[be,Xe]=useState(r||new Date),[z,re]=useState(null),[J,Fe]=useState(null),[he,Ue]=useState(null),[Be,nt]=useState({}),Z=3,st=3,oe=useCallback(W=>{Fe(W.id),X$1||re(W),h?.(W.id);},[X$1,h]),[rt,ht]=useState(null),Ft=useCallback(()=>{Xe(new Date(be.getFullYear(),be.getMonth()-1,1));},[be]),ke=useCallback(()=>{Xe(new Date(be.getFullYear(),be.getMonth()+1,1));},[be]),yt=useCallback(()=>{Xe(new Date);},[]),dt=useMemo(()=>{let W=be.getFullYear(),te=be.getMonth(),We=new Date(W,te,1),Ce=new Date(W,te+1,0),He=We.getDay(),Ne=Ce.getDate(),_e=Ss(e),kt=new Date;kt.setHours(0,0,0,0);let mt=[],ot=He,et=new Date(W,te,0).getDate();for(let Pt=ot-1;Pt>=0;Pt--){let vt=new Date(W,te-1,et-Pt);mt.push({date:vt,isCurrentMonth:false,isToday:false,isWeekend:vt.getDay()===0||vt.getDay()===6,events:_e.filter(Nt=>gc(vt,Nt)).map(Nt=>({id:Nt.id,title:Nt.name,start:Nt.startDate,end:Nt.endDate,task:Nt}))});}for(let Pt=1;Pt<=Ne;Pt++){let vt=new Date(W,te,Pt),Nt=vt.getTime()===kt.getTime();mt.push({date:vt,isCurrentMonth:true,isToday:Nt,isWeekend:vt.getDay()===0||vt.getDay()===6,events:_e.filter(gt=>gc(vt,gt)).map(gt=>({id:gt.id,title:gt.name,start:gt.startDate,end:gt.endDate,task:gt}))});}let Yt=42-mt.length;for(let Pt=1;Pt<=Yt;Pt++){let vt=new Date(W,te+1,Pt);mt.push({date:vt,isCurrentMonth:false,isToday:false,isWeekend:vt.getDay()===0||vt.getDay()===6,events:_e.filter(Nt=>gc(vt,Nt)).map(Nt=>({id:Nt.id,title:Nt.name,start:Nt.startDate,end:Nt.endDate,task:Nt}))});}return mt},[be,e]),at=useMemo(()=>Ss(e).filter(W=>!W.startDate||!W.endDate),[e]),$=useMemo(()=>{let W=Ss(e),te=0,We=0,Ce=0,He=0,Ne=0;W.forEach(et=>{et.effortMinutes&&(te+=et.effortMinutes),et.soldEffortMinutes&&(We+=et.soldEffortMinutes),et.scheduleVariance!=null&&(Ce+=et.scheduleVariance,He++),et.soldEffortMinutes&&et.effortMinutes&&(Ne+=et.soldEffortMinutes-et.effortMinutes);});let _e=We>0?Math.min(100,Math.round(te/We*100)):0,kt=He>0?Math.round(Ce/He):0,ot=`${Ne<0?"-":"+"}${l0(Ne,O,H)}`;return {budgetUtil:_e,avgVariance:kt,costDisplay:ot,hasCostData:We>0}},[e,O,H]),de=useMemo(()=>{let W=[0,0,0,0,0,0];return dt.forEach((te,We)=>{let Ce=Math.floor(We/7);te.events.forEach(He=>{if(He.task.startDate&&He.task.soldEffortMinutes){let Ne=new Date(He.task.startDate),_e=te.date;Ne.getFullYear()===_e.getFullYear()&&Ne.getMonth()===_e.getMonth()&&Ne.getDate()===_e.getDate()&&Ce<W.length&&(W[Ce]-=He.task.soldEffortMinutes);}});}),W},[dt]),S=useMemo(()=>{let W=Ss(e),te=new Map,We=new Set,Ce=[0,0,0,0,0,0];if(dt.length===0)return {segmentsByCell:te,multiDayTaskIds:We,maxLanesPerRow:Ce};let He=ot=>new Date(ot.getFullYear(),ot.getMonth(),ot.getDate()),Ne=He(dt[0].date),_e=He(dt[dt.length-1].date),kt=[];for(let ot of W){if(!ot.startDate||!ot.endDate)continue;let et=He(ot.startDate),Yt=He(ot.endDate);if(et.getTime()===Yt.getTime()||Yt<Ne||et>_e)continue;let Pt=et<Ne?Ne:et,vt=Yt>_e?_e:Yt,Nt=i0(Pt,Ne),gt=i0(vt,Ne);Nt<0||Nt>41||gt<0||gt>41||Nt!==gt&&(We.add(ot.id),kt.push({task:ot,startIdx:Nt,endIdx:gt}));}kt.sort((ot,et)=>ot.startIdx!==et.startIdx?ot.startIdx-et.startIdx:et.endIdx-et.startIdx-(ot.endIdx-ot.startIdx));let mt=[[],[],[],[],[],[]];for(let{task:ot,startIdx:et,endIdx:Yt}of kt){let Pt=Math.floor(et/7),vt=Math.floor(Yt/7),Nt=He(ot.startDate),gt=He(ot.endDate),Wt=false;for(let Re=Pt;Re<=vt;Re++){let Ae=Re===Pt?et%7:0,ct=Re===vt?Yt%7:6,se=ct-Ae+1,fe=0,L=mt[Re]??[];for(mt[Re]||(mt[Re]=L);fe<L.length&&(L[fe]??-1)>=Ae;)fe++;if(fe>=bw){Wt=true;break}fe>=L.length?L.push(ct):L[fe]=ct,Ce[Re]=Math.max(Ce[Re]??0,fe+1);let _=Re===Pt&&Nt>=Ne,K=Re===vt&><=_e,ue=Re*7+Ae,Me={taskId:ot.id,task:ot,rowIndex:Re,startCol:Ae,endCol:ct,spanCols:se,lane:fe,isStart:_,isEnd:K};te.has(ue)||te.set(ue,[]),te.get(ue).push(Me);}Wt&&(We.delete(ot.id),te.forEach((Re,Ae)=>{let ct=Re.filter(se=>se.taskId!==ot.id);ct.length===0?te.delete(Ae):te.set(Ae,ct);}));}return {segmentsByCell:te,multiDayTaskIds:We,maxLanesPerRow:Ce}},[dt,e]),Y=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],le=be.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),we=le.charAt(0).toUpperCase()+le.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",j?"text-white/30":"text-gray-600"),children:[R.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",j?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",j?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",j?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",j?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",j?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",j?"text-white/90":"text-gray-900"),children:R.labels.noEvents}),jsx("p",{className:u("text-sm",j?"text-white/30":"text-gray-600"),children:R.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",j?"bg-[#050505]":"bg-white",n),style:i,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",j?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",j?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",j?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Ft,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",j?"text-white":"text-gray-900"),children:we}),jsx("button",{onClick:ke,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",j?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",j?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:yt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",j?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:R.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",j?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(W=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",j?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",j?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Fe(null),children:dt.map((W,te)=>{let We=te%7===6,Ce=te>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!We&&(j?"border-r border-[#222]":"border-r border-gray-200"),!Ce&&(j?"border-b border-[#222]":"border-b border-gray-200"),j?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&&j&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!j&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?j?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?j?"text-white/60":"text-gray-900":j?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let He=Math.floor(te/7),Ne=(S.maxLanesPerRow[He]??0)*d0,_e=S.segmentsByCell.get(te);return Ne===0&&!_e?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:_e?.map(kt=>jsx(hw,{segment:kt,isDark:j,blurFinancials:D,isSelected:J===kt.taskId,t:R,lens:O,hourlyRate:H,onClick:()=>{oe(kt.task),a.onEventClick?.({id:kt.task.id,title:kt.task.name,start:kt.task.startDate,end:kt.task.endDate,task:kt.task});}},kt.taskId))})})(),(()=>{let He=W.events.filter(Ne=>Ne.task.isMilestone&&!S.multiDayTaskIds.has(Ne.id));return He.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[He.slice(0,4).map(Ne=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:_e=>{_e.stopPropagation(),oe(Ne.task);}},Ne.id)),He.length>4&&jsxs("span",{className:u("text-[8px] font-mono",j?"text-white/30":"text-gray-400"),children:["+",He.length-4]})]})})(),(()=>{let He=[];W.events.forEach(_e=>{_e.task.blockers?.forEach(kt=>{(kt.severity==="warning"||kt.severity==="critical")&&He.push({taskId:_e.id,type:kt.type,severity:kt.severity,variance:_e.task.scheduleVariance});});});let Ne=He[0];return Ne?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[R.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${R.labels.delay})`:""]})]})}):null})(),(()=>{let He=W.events.filter(mt=>!S.multiDayTaskIds.has(mt.id)),Ne=Be[te]||Z,_e=He.slice(0,Ne),kt=He.length-Ne;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[_e.map(mt=>jsxs(motion.button,{onClick:()=>{oe(mt.task),a.onEventClick?.(mt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",mt.task.progress===100||mt.task.status==="completed"?j?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":j?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:j?mt.task.progress===100||mt.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)"}:mt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",mt.task.isMilestone?j?"text-amber-400":"text-amber-600":mt.task.isCriticalPath?"text-red-400":j?"text-[#1264FF]":"text-gray-400"),children:mt.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:mt.title})]},mt.id)),kt>0&&jsxs("button",{onClick:mt=>{mt.stopPropagation(),nt(ot=>({...ot,[te]:Ne+st}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",kt," ",q==="es"?"m\xE1s":"more"]}),Ne>Z&&He.length>Z&&jsx("button",{onClick:mt=>{mt.stopPropagation(),nt(ot=>({...ot,[te]:Z}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",j?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:q==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let He=te>=28,Ne=te%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:_e=>{_e.stopPropagation(),ht(rt===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",rt===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",j?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",rt===te&&"rotate-45")})}),jsx(AnimatePresence,{children:rt===te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ht(null)}),jsx(motion.div,{initial:{opacity:0,y:He?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:He?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",He?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",j?"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(Jo,{onSubmit:_e=>{a.onTaskCreate?.({name:_e.name,startDate:_e.startDate||W.date,endDate:_e.endDate||W.date,priority:_e.priority,assignees:_e.assignee?[_e.assignee]:void 0}),ht(null);},onCancel:()=>ht(null),availableUsers:t.availableUsers,isDark:j,locale:q==="es"?"es":"en",defaultDate:W.date,dropdownDirection:He?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let He=Math.floor(te/7),Ne=de[He];if(!Ne||Ne===0)return null;let _e=l0(Ne,O,H);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:[R.labels.cashOut,": ",Ne<0?"-":"+",_e]})})()]},te)})})})]}),Se&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",j?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",j?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:R.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",j?"text-white/20":"text-gray-400"),children:at.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:at.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",j?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",j?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",j?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):at.map(W=>jsxs("button",{onClick:()=>{oe(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",j?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",j?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",j?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(te=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),W.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",j?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",j?"text-white/25":"text-gray-400",D&&"blur-sm select-none"),children:[fc(W.effortMinutes,O,H)&&jsxs("span",{children:[R.labels.estimate,": ",fc(W.effortMinutes,O,H)]}),(()=>{let te=c0(W,O,H);return te?jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsx(Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(s0,{task:W,isDark:j})]}),W.assignees&&W.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((te,We)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},We))})]})]},W.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:R.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",j?"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:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",j?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",j?"text-white/40":"text-gray-500"),children:["\u25C8 ",R.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",j?"text-white/40":"text-gray-500"),children:R.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",j?"text-white/60":"text-gray-700",D&&"blur-sm select-none"),children:[$.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",j?"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:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:R.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.avgVariance>0?"text-emerald-400":$.avgVariance<0?"text-red-400":j?"text-white/50":"text-gray-600"),children:[$.avgVariance>0?"+":"",$.avgVariance," ",R.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",j?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",j?"text-white/25":"text-gray-400"),children:R.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:$.costDisplay})]})]})]})]})]}),!X$1&&jsx(fo,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),re(W);},theme:F==="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:c,onCreateTag:l,attachments:z?m?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Ss(e).filter(W=>W.id!==z?.id),comments:d?.filter(W=>W.taskId===z?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:T,onSoldEffortUpdate:k,onTimerStart:v,onTimerStop:E,onTimerDiscard:I,blurFinancials:D}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ue(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",j?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",j?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",j?"text-white/90":"text-gray-900"),children:he.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ue(null),className:u("p-1 rounded",j?"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:he.events.map(W=>jsxs("button",{onClick:()=>{Ue(null),oe(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",j?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(s0,{task:W.task,isDark:j}),jsx("span",{className:u("text-sm truncate flex-1",j?"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 bc={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)"},hc={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)"},yc={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)"},el={dark:bc,light:hc,neutral:yc};function p0(e){return el[e]||el.dark}function xw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=useState(false),m=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=m.length,y=new Set(m.flatMap(f=>f.assignedUserIds||[])).size,x=m.map(f=>f.priority).filter(Boolean),h=new Set(m.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[m]),p=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:m.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:m.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var g0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ms(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function Fs(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function f0(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 b0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=useMemo(()=>({...g0,...n}),[n]),[l,m]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let C=w.timestamp.toISOString().split("T")[0],N=b.get(C);N?N.push(w):b.set(C,[w]);}),Array.from(b.entries()).sort((w,C)=>C[0].localeCompare(w[0])).map(([w,C])=>({date:new Date(w),events:C.sort((N,T)=>T.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=useMemo(()=>{let b=new Set,w=new Set;return e.forEach(C=>{b.add(C.userId),w.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{m(w=>{let C=new Set(w);return C.has(b)?C.delete(b):C.add(b),C});},h=b=>{let C=new Date().getTime()-b.getTime(),N=Math.floor(C/6e4),T=Math.floor(C/36e5),k=Math.floor(C/864e5);return N<1?"just now":N<60?`${N}m ago`:T<24?`${T}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",i),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxs("option",{value:b,children:[Fs(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,users:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(b=>jsx("option",{value:b,children:b},b))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(b=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:b.events.map((w,C)=>{let N=l.has(w.id),T=s===w.id,k=f0(w.type);return jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",N&&"expanded",T&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Fs(w.type)})}),C<b.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:Ms(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),x(w.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([v,E])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},v)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([v,E])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},v))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function y0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let m=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&Fs(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Ms(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>i(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>i(y),title:Ms(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function xc(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 vc(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 x0(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 v0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Nw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(m=>{let d=a/2,p=r/2;m.vx+=(d-m.x)*o.centerForce*l,m.vy+=(p-m.y)*o.centerForce*l,n.forEach(g=>{if(m.id===g.id)return;let y=m.x-g.x,x=m.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*l/(h*h);m.vx+=y/h*f,m.vy+=x/h*f;});}),t.forEach(m=>{let d=i.get(typeof m.source=="string"?m.source:m.source.id),p=i.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!p)return;let g=p.x-d.x,y=p.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*l;d.vx+=g*h,d.vy+=y*h,p.vx-=g*h,p.vy-=y*h;}),n.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return n}function w0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=useRef(null),[m,d]=useState([]),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(1),[C,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=Nw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),k=useCallback(O=>{if(!p||!l.current)return;let F=l.current.getBoundingClientRect(),q=(O.clientX-F.left-C.x)/b,ee=(O.clientY-F.top-C.y)/b;d(Se=>Se.map(R=>R.id===p?{...R,x:q,y:ee,fx:q,fy:ee}:R));},[p,b,C]),v=useCallback(()=>{g(null);},[]),E=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),I=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),D=useCallback(O=>{let H=m.find(F=>F.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),X=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=O.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:xc(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[x0(O)," ",vc(O)]})]},O))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:v,onMouseLeave:v,children:[jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=D(typeof O.source=="string"?O.source:O.source.id),F=D(typeof O.target=="string"?O.target:O.target.id),q=v0(O.type),ee=h===O.id,Se=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ee&&"hovered",Se&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:R=>I(O,R),children:[jsx("line",{x1:H.x,y1:H.y,x2:F.x,y2:F.y,stroke:xc(O.type),strokeWidth:Se?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ee?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ee&&jsx("text",{x:(H.x+F.x)/2,y:(H.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:vc(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let H=y===O.id,F=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",H&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:q=>T(O.id,q),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:q=>E(O,q),children:[jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:X(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:H?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function T0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[i,c]=useState(false),[l,m]=useState(null),[d,p]=useState(null),g=useRef(null),y=i||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let b=w=>{w.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),m(null),p(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),m(null),p(null);try{let b=await r(s.trim());p(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},w))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},w)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,w)=>jsx("button",{onClick:()=>n(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},w))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var wc={"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 Sw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Ew={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 Mw(e,t,a){let r=wc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ps(e){return `$${e.toFixed(4)}`}var kc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Mw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),l={},m={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:m,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let i=this.operations.filter(m=>m.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},ln=new kc;function S0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(ln.getStats()),[s,n]=useState(ln.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(ln.getStats()),n(ln.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=ln.getRecentOperations(5);return jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ps(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ps(m)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:i.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ps(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function F0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=useState(""),[c,l]=useState(""),[m,d]=useState(""),[p,g]=useState(false),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(null),C=useRef(null),N=p||o;useEffect(()=>{e&&C.current&&C.current.focus();},[e]),useEffect(()=>{let I=D=>{D.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let T=()=>{N||(i(""),l(""),d(""),x(null),f(null),w(null),t());},k=async()=>{if(!(!n.trim()||N)){g(true),x(null),f(null),w(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});f(I.tasks.tasks),w({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){x(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},v=()=>{h&&(a(h),T());};if(!e)return null;let E=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(Xt,{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:I=>I.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:T,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",E,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((I,D)=>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:["#",D+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.id))})]})}):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:C,value:n,onChange:I=>i(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:I=>l(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((I,D)=>jsx("button",{onClick:()=>i(I),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:I},D))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:N&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:T,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:k,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function rl({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&Ws(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,w)=>{console.warn(`Retry attempt ${b} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(h,f,b)=>{r(w=>{let C=w.cards.find(I=>I.id===h);if(!C)return w;let N=C.columnId,T={...C,columnId:f,position:b},k=w.cards.map(I=>I.id===h?T:I),v=w.columns.map(I=>{if(I.id===N)return {...I,cardIds:I.cardIds.filter(D=>D!==h)};if(I.id===f){let D=k.filter(X=>X.columnId===f).sort((X,O)=>X.position-O.position);return {...I,cardIds:D.map(X=>X.id)}}return I}),E={...w,cards:k,columns:v};return o(E),E});},[o]),n=useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(N=>N.id===h?{...N,...f}:N),C={...b,cards:w};return o(C),C});},[o]),i=useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},C=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),N={...b,cards:[...b.cards,w],columns:C};return o(N),N});},[o]),c=useCallback(async h=>{r(f=>{let b=f.cards.find(T=>T.id===h);if(!b)return f;let w=f.cards.filter(T=>T.id!==h),C=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(k=>k!==h)}:T),N={...f,cards:w,columns:C};return o(N),N});},[o]),l=useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},C={...b,columns:[...b.columns,w]};return o(C),C});},[o]),m=useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(N=>N.id===h?{...N,...f}:N),C={...b,columns:w};return o(C),C});},[o]),d=useCallback(async h=>{r(f=>{let b=f.cards.filter(N=>N.columnId!==h),w=f.columns.filter(N=>N.id!==h),C={...f,cards:b,columns:w};return o(C),C});},[o]),p=useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),g=useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),y=useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function A0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=rl({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,l,m={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...m});},addColumn:(c,l)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var As={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},I0={by:"none",order:"asc"};function B0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...As,...e}),[s,n]=useState({...I0,...t}),i=useCallback(x=>{o(h=>({...h,...x}));},[]),c=useCallback(x=>{n(h=>({...h,...x}));},[]),l=useCallback(()=>{o(As),n(I0);},[]),m=useCallback(()=>{a&&o({...As,assignees:[a]});},[a]),d=useCallback(()=>{o({...As,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...As,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),C=String(f.getDate()).padStart(2,"0"),N=`${b}-${w}-${C}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let k=T.endDate||T.dueDate;if(!k)return false;let v;if(typeof k=="string")v=k.split("T")[0]||k;else {let E=k.getUTCFullYear(),I=String(k.getUTCMonth()+1).padStart(2,"0"),D=String(k.getUTCDate()).padStart(2,"0");v=`${E}-${I}-${D}`;}switch(r.dateFilter){case "overdue":return v<N;case "today":return v===N;case "this-week":let E=new Date(N+"T00:00:00"),I=new Date(v+"T00:00:00"),D=new Date(E);return D.setDate(D.getDate()+7),I>=E&&I<=D;case "custom":if(r.dateRange){let X=typeof k=="string"?new Date(k):k;return X>=r.dateRange.start&&X<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let w=0;switch(s.by){case "created":let C=f.createdAt?new Date(f.createdAt).getTime():0,N=b.createdAt?new Date(b.createdAt).getTime():0;w=C-N;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=T[f.priority||"LOW"],v=T[b.priority||"LOW"];w=k-v;break;case "dueDate":let E=f.endDate||f.dueDate,I=b.endDate||b.dueDate;if(!E)return 1;if(!I)return -1;let D=typeof E=="string"?new Date(E).getTime():E.getTime(),X=typeof I=="string"?new Date(I).getTime():I.getTime();w=D-X;break;case "title":w=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,H=b.estimatedTime||0;w=O-H;break;default:w=0;}return s.order==="asc"?w:-w}),h},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:y,hasActiveFilters:g}}var O0,$0;if(typeof window<"u")try{let e=Hs("ai");O0=e.generateObject,$0=e.generateText;}catch{}function H0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(O0&&$0&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function Tc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function z0(e){let{cards:t}=e,[a,r]=Tc(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,y=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(v=>v.columnId===x.columnId).sort((v,E)=>v.position-E.position),b=f.findIndex(v=>v.id===a.lastSelectedCardId),w=f.findIndex(v=>v.id===d),[C,N]=b<w?[b,w]:[w,b],T=f.slice(C,N+1).map(v=>v.id),k=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:m}}var U0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function W0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...U0,...a}),[a]),[s,n]=useState([]),i=useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:w,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,C]);},[o.minCardsPerStack,s]),c=useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),l=useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),m=useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(C=>C!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),p=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=useCallback(async x=>{let h=t.filter(N=>N.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(N);});}),b.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${T}"`,confidence:.85});});let w=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(T=>{w.has(T)||w.set(T,[]),w.get(T).push(N);});}),w.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(h.forEach(N=>{N.priority&&(C.has(N.priority)||C.set(N.priority,[]),C.get(N.priority).push(N));}),C.forEach((N,T)=>{if(N.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${T} Priority`,cardIds:N.map(v=>v.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let k=(await r.findSimilar(N,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let v=[N.id,...k.map(I=>I.card.id)],E=k.reduce((I,D)=>I+D.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:v,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:E});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,T)=>T.confidence-N.confidence).slice(0,5)},[t,o,r]),y=useCallback(x=>{i(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[i]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:y,config:o}}var G0=createContext(null);function V0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Hs("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Hs("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Hs("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(G0.Provider,{value:{store:o},children:e})}function ol(){let e=useContext(G0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Is(){let e=ol(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let i=useCallback(b=>{e.updateBoard(b);},[e]),c=useCallback(b=>{e.addColumn(b);},[e]),l=useCallback((b,w)=>{e.updateColumn(b,w);},[e]),m=useCallback(b=>{e.deleteColumn(b);},[e]),d=useCallback(b=>e.getColumn(b),[e]),p=useCallback(b=>{e.addCard(b);},[e]),g=useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=useCallback(b=>{e.deleteCard(b);},[e]),x=useCallback((b,w,C)=>{e.moveCard(b,w,C);},[e]),h=useCallback(b=>e.getCard(b),[e]),f=useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:m,getColumn:d,addCard:p,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function j0(e){let{cards:t}=Is();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 K0(e="position",t="asc"){let{cards:a}=Is();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var nl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=nu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},jw=new nl;function q0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=useRef(null),m=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:p,className:o,children:jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function X0(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 Q0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let m=useRef(null),d=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:i}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:m,style:g,className:s,children:jsx("div",{style:y,children:p.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function Z0(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 ef(e,t=10){return e>t}var Ec={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Mc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Fc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Pc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ac={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Lc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ic={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Bc={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)"},Rc={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)"},Oc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},$c={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}},sl={spacing:Ec,borderRadius:Mc,fontSize:Fc,fontWeight:Pc,lineHeight:Ac,zIndex:Lc,duration:Ic,easing:Bc,shadows:Rc,opacity:Oc,kanban:$c,gantt:Hc};function tf(e,t,a){return e[t]??a}function zc(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)?zc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function qw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Uc(e="asakaa"){let t=zc(sl),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=qw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
414
414
|
${a.join(`
|
|
415
415
|
`)}
|
|
416
|
-
}`}function
|
|
416
|
+
}`}function Bs(e,t="asakaa"){let a=[],r=zc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
417
417
|
${a.join(`
|
|
418
418
|
`)}
|
|
419
|
-
}`}var
|
|
419
|
+
}`}var il={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Wc={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Gc={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Vc(e=il,t="asakaa"){let a=Uc(t),r=Bs(e,t);return `${a}
|
|
420
420
|
|
|
421
421
|
${r}`}function af(){return `/**
|
|
422
422
|
* ASAKAA Design Tokens
|
|
@@ -424,21 +424,21 @@ ${r}`}function af(){return `/**
|
|
|
424
424
|
* Do not edit this file directly
|
|
425
425
|
*/
|
|
426
426
|
|
|
427
|
-
${
|
|
427
|
+
${Vc(il)}
|
|
428
428
|
|
|
429
429
|
/* Light theme */
|
|
430
430
|
[data-theme="light"] {
|
|
431
|
-
${
|
|
431
|
+
${Bs(Wc,"asakaa").split(`
|
|
432
432
|
`).slice(1,-1).join(`
|
|
433
433
|
`)}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/* Neutral theme */
|
|
437
437
|
[data-theme="neutral"] {
|
|
438
|
-
${
|
|
438
|
+
${Bs(Gc,"asakaa").split(`
|
|
439
439
|
`).slice(1,-1).join(`
|
|
440
440
|
`)}
|
|
441
441
|
}
|
|
442
|
-
`}var Xw=({theme:e})=>{switch(e){case "dark":return jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function rf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=
|
|
443
|
-
export{S0 as AIUsageDashboard,Ew as AI_FEATURES,
|
|
442
|
+
`}var Xw=({theme:e})=>{switch(e){case "dark":return jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function rf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Sn();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,i])=>{let c=n,l=c===r;return jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${i.displayName} theme`,"aria-pressed":l,title:i.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(Xw,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:i.displayName})]},c)})})}
|
|
443
|
+
export{S0 as AIUsageDashboard,Ew as AI_FEATURES,wc as AI_MODELS,Vl as AddCardButton,Hl as AddColumnButton,no as AttachmentUploader,V0 as BoardProvider,ui as BulkOperationsToolbar,ad as BurnDownChart,e0 as CUSTOM_FIELD_TYPES,u0 as CalendarBoard,mo as Card,Xl as CardDetailModal,Zl as CardDetailModalV2,y0 as CardHistoryReplay,b0 as CardHistoryTimeline,w0 as CardRelationshipsGraph,xw as CardStack,dd as CardTemplateSelector,yl as CircuitBreaker,vn as Column,hi as ColumnManager,Kl as CommandPalette,md as ConfigMenu,Pn as ContextMenu,ls as DEFAULT_SHORTCUTS,Qg as DEFAULT_TABLE_COLUMNS,ld as DEFAULT_TEMPLATES,Yn as DateRangePicker,Xn as DependenciesSelector,fs as DependencyLine,rd as DistributionCharts,Dl as EditableColumnTitle,Cn as ErrorBoundary,Jp as ExportDropdown,ud as ExportImportModal,pd as FilterBar,Pm as GANTT_AI_SYSTEM_PROMPT,Li as GanttAIAssistant,Dm as GanttBoard,Mn as GanttI18nContext,Ei as GanttMilestone,bi as GanttToolbar,F0 as GenerateGanttTasksDialog,T0 as GeneratePlanModal,sd as GroupBySelector,Al as HealthBar,Mo as KanbanBoard,Ol as KanbanToolbar,ns as KanbanViewAdapter,id as KeyboardShortcutsHelp,Jg as ListView,da as MenuIcons,nl as PluginManager,jo as PrioritySelector,Ll as ProfitabilityReport,Jo as QuickTaskCreate,Sw as RATE_LIMITS,Zg as STANDARD_FIELDS,od as SwimlaneBoardView,El as TagBadge,Wu as TagList,Do as TagPicker,Ci as TaskBar,fo as TaskDetailModal,Fm as TaskFormModal,vi as TaskGrid,hd as ThemeModal,Hp as ThemeProvider,rf as ThemeSwitcher,ao as TimeInputPopover,Ml as TimePill,Fl as TimePopover,Fi as Timeline,Yo as UserAssignmentSelector,td as VelocityChart,Q0 as VirtualGrid,q0 as VirtualList,ln as aiUsageTracker,Mc as borderRadius,Us as calculatePosition,bc as calendarDarkTheme,uc as calendarEnTranslations,pc as calendarEsTranslations,hc as calendarLightTheme,yc as calendarNeutralTheme,el as calendarThemes,Xi as calendarTranslations,Ri as cardToGanttTask,$m as cardsToGanttTasks,u as cn,yp as createKanbanView,Bf as createRetryWrapper,gd as darkTheme,il as darkTokenTheme,mi as defaultTheme,sl as designTokens,Ic as duration,Bc as easing,af as exportTokensToCSS,vo as findTaskByName,Fc as fontSize,Pc as fontWeight,Ps as formatCost,fi as ganttEnTranslations,Up as ganttEsTranslations,Om as ganttTaskToCardUpdate,ut as ganttThemes,Hc as ganttTokens,yd as ganttTranslations,De as ganttUtils,Uc as generateCSSVariables,Vc as generateCompleteCSS,Pf as generateInitialPositions,Am as generateTasksContext,Bs as generateThemeVariables,p0 as getCalendarTheme,Ns as getCalendarTranslations,t0 as getListViewTheme,Ud as getListViewTranslations,a0 as getMonthNames,tf as getToken,Wp as getTranslations,r0 as getWeekdayNames,$c as kanbanTokens,fd as lightTheme,Wc as lightTokenTheme,Ac as lineHeight,lc as listViewDarkTheme,Hd as listViewEnTranslations,zd as listViewEsTranslations,dc as listViewLightTheme,cc as listViewNeutralTheme,qi as listViewThemes,Oi as listViewTranslations,Ji as mergeCalendarTranslations,$i as mergeListViewTranslations,xd as mergeTranslations,bd as neutralTheme,Gc as neutralTokenTheme,Oc as opacity,Bm as parseLocalCommand,Rd as parseNaturalDate,Od as parseNaturalDuration,$d as parseProgress,Im as parseStatus,jw as pluginManager,If as retrySyncOperation,Ws as retryWithBackoff,Rc as shadows,ef as shouldVirtualizeGrid,Ec as spacing,en as themes,H0 as useAI,A0 as useBoard,Is as useBoardCore,ol as useBoardStore,W0 as useCardStacking,Bl as useDragState,j0 as useFilteredCards,B0 as useFilters,Br as useGanttI18n,rl as useKanbanState,Rp as useKeyboardShortcuts,z0 as useMultiSelect,Tc as useSelectionState,K0 as useSortedCards,Sn as useTheme,Z0 as useVirtualGrid,X0 as useVirtualList,Rm as validateAIResponse,_l as withErrorBoundary,Vs as wouldCreateCircularDependency,Lc as zIndex};//# sourceMappingURL=index.js.map
|
|
444
444
|
//# sourceMappingURL=index.js.map
|