@libxai/board 1.5.82 → 1.5.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import Of 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 ry from'react-markdown';import oy from'remark-gfm';import ny 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 Ws=(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 Vs=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 [Vs.Translate.toString(e),Vs.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 Gs(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 Af(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function hl(e,t){return e.length===0?1e3:t===0?Gs(null,e[0].position):t>=e.length?Gs(e[e.length-1].position,null):Gs(e[t-1].position,e[t].position)}function ou(e,t=100){return e>t}var Lf=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 If(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 js(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Lf,onRetry:l}=t,c,i=0;for(let m=1;m<=a;m++){i=m;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,m===a||!n(c,m))return {error:c,attempts:i,success:false};let g=If(m,r,o,s);if(l)try{l(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:i,success:false}}function Bf(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Rf(e,t={}){return async(...a)=>js(()=>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 nu=(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))(nu||{}),jo=class jo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,c?n:"");break;case "INFO":console.info(l,o,c?n:"");break;case "WARN":console.warn(l,o,c?n:"");break;case "ERROR":console.error(l,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",...jo.globalOptions};}static configure(t){jo.globalOptions={...jo.globalOptions,...t};}child(t){return new jo({...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 _s((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new _s(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:nu[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};jo.globalOptions={};var xl=jo,_s=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}},su=new xl;function $f(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 Hf(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(l=>l.id===s.columnId);return [s.id,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 zf(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 Of(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),c=297,i=210,m=n.width/n.height,d=c-20,p=d/m;p>i-20&&(p=i-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(l,"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 l=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,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(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 i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let m=[];c.startDate&&m.push(`Start: ${c.startDate}`),c.endDate&&m.push(`End: ${c.endDate}`),i.push(m.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function vl(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function lu(e,t,a,r){switch(t){case "json":return $f(e,r);case "csv":return Hf(e);case "pdf":return await zf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function du(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"},l=new Blob([e],{type:n[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function Uf(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 Wf(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=cu(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=cu(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,y)=>{i[g]=l[y]||"";});let m=i.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:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function cu(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 uu(e,t){switch(t){case "json":return Uf(e);case "csv":return Wf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function pu(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 mu(){return useContext(wl)}var gu=createContext(null);function fu({children:e,themeName:t}){return jsx(gu.Provider,{value:{themeName:t},children:e})}function hn(){return useContext(gu)}function Qt({children:e,container:t}){let[a,r]=useState(false),o=mu(),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:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var vu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Xf="#BDC3C7",Jf=({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 _o({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),c=useRef(null),i=()=>{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=>{l.current&&!l.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?vu[e]:null,p=d?.color||Xf;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Qt,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(vu).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(Jf,{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 Qf=[{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 Xn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),p=(hn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.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,S=v.top,X;I>=k+w?X=v.bottom+w:S>=k+w?X=v.top-k-w:X=I>=S?v.bottom+w:Math.max(10,v.top-k-w),l({top:X,left:E}),s(true);};useEffect(()=>{let v=C=>{c.current&&!c.current.contains(C.target)&&!i.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(),S=String(E.getMonth()+1).padStart(2,"0"),X=String(E.getDate()).padStart(2,"0");return `${I}-${S}-${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],S=w[2];return E===void 0||I===void 0||S===void 0?null:new Date(E,I-1,S)},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:i,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${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(Qt,{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:Qf.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 qo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[l,c]=useState(""),[i,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,S;E>=T+k?S=b.bottom+k:I>=T+k?S=b.top-T-k:S=E>=I?b.bottom+k:Math.max(10,b.top-T-k),m({top:S,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(l.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(Qt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange: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 Ks(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let m of i){if(!s.has(m)&&l(m))return true;if(n.has(m))return true}}return n.delete(c),false};return l(a)}function Qn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=useState(false),[i,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,S=300,X=d?380:120,O=4,$=w.right-S;$<10&&($=w.left),$+S>I-10&&($=I-S-10);let F=E-w.bottom,Y=w.top,Z;F>=X+O?Z=w.bottom+O:Y>=X+O?Z=w.top-X-O:Z=F>=Y?w.bottom+O:Math.max(10,w.top-X-O),y({top:Z,left:$}),c(true);};useEffect(()=>{if(!l||!b.current)return;let w=b.current.getBoundingClientRect(),E=window.innerHeight,I=window.innerWidth,S=300,X=d?380:120,O=4,$=w.right-S;$<10&&($=w.left),$+S>I-10&&($=I-S-10);let F=E-w.bottom,Y=w.top,Z;F>=X+O?Z=w.bottom+O:Y>=X+O?Z=w.top-X-O:Z=F>=Y?w.bottom+O:Math.max(10,w.top-X-O),y({top:Z,left:$});},[d,l]),useEffect(()=>{let w=E=>{f.current&&!f.current.contains(E.target)&&!b.current?.contains(E.target)&&(c(false),m(""));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),useEffect(()=>{let w=E=>{E.key==="Escape"&&(c(false),m(""));};if(l)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]);let C=w=>{let E=t.includes(w),I=a.find(S=>S.id===w);if(h(null),E){let S=t.filter(X=>X!==w);r(S),S.length===0&&p(false);}else {if(s&&Ks(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(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:b,onClick:()=>l?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})]}),l&&jsx(Qt,{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:i,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 go=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:m,setNodeRef:d,transform:p,transition:g,isDragging:y}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:Vs.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:d,style:x,...i,...m,onClick:()=>a?.(e),children:t(e)});let h=l.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),...i,...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(_o,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsx(Xn,{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})})}),l.length>0&&jsx("div",{onClick:C=>C.stopPropagation(),className:"user-selector",children:jsx(qo,{assignedUsers:h,availableUsers:l,onChange:C=>n?.(e.id,{assignedUserIds:C.map(N=>N.id)})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"dependencies-selector",children:jsx(Qn,{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)));go.displayName="Card";var qs={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"}},Fu=({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 Pu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),m=[...Object.entries(qs).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(qs).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=qs[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"}:{...qs.todo,id:"todo"}},p=()=>{if(!i.current)return;let h=i.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),l({top:E,left:T}),s(true);};useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!i.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:i,onClick:()=>o?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsx(Fu,{icon:y.icon,color:x})}),o&&jsx(Qt,{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(Fu,{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 Au={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 Lu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Au[s]||Au.en,[l,c]=useState(false),[i,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(l&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[l]),useEffect(()=>{let N=T=>{x.current&&!x.current.contains(T.target)&&!h.current?.contains(T.target)&&(c(false),m(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{let N=T=>{T.key==="Escape"&&(c(false),m(false),p(e));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l,e]),useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);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(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsx(Qt,{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:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:d,onChange: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 vn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,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??ou(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}})(),S=I.state==="exceeded",X=()=>"asakaa-column-count";return jsxs("div",{ref:C,className:u("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",S&&"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(Lu,{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 $=t[O.index];return $?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsx(go,{card:$,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},$.id):null})}):t.map(O=>jsx(go,{card:O,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},O.id))})})]})});vn.displayName="Column";function Dl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let m=s.trim();m&&m!==e?t(m):n(e),o(false);},i=m=>{m.key==="Enter"?c():m.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:m=>n(m.target.value),onBlur:c,onKeyDown:i,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 yb(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 Hu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),m=c.split(/\s+/);return !!(i===s||c===s||m.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function xb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function vb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var wb=["\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 zu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:m=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=l==="dark",[f,b]=useState(false),[v,C]=useState([]),[N,T]=useState(0),[k,w]=useState(null),[E,I]=useState(false),S=useRef(null),X$1=useRef(null),O=useRef(null),$=useRef(null),F=useCallback((z,re)=>{let J=yb(z,re);if(w(J),J){let Ae=r.filter(xe=>xe.name.toLowerCase().includes(J.query)||xe.email&&xe.email.toLowerCase().includes(J.query)).slice(0,5);C(Ae),b(Ae.length>0),T(0);}else b(false),C([]);},[r]),Y=z=>{let re=z.target.value;if(t(re),F(re,z.target.selectionStart||0),S.current){S.current.style.height="24px";let J=S.current.scrollHeight,Ae=280,xe=Math.min(J,Ae);S.current.style.height=`${xe}px`,S.current.style.overflowY=J>Ae?"auto":"hidden";}},Z=()=>{S.current&&F(e,S.current.selectionStart||0);},Se=useCallback(z=>{if(!k||!S.current)return;let re=e.slice(0,k.start),J=e.slice(k.end),Ae=`@${z.name.replace(/\s+/g,"")} `,xe=re+Ae+J;t(xe),b(false),w(null),setTimeout(()=>{if(S.current){let Ue=k.start+Ae.length;S.current.selectionStart=Ue,S.current.selectionEnd=Ue,S.current.focus();}},0);},[k,e,t]),B=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)&&S.current&&!S.current.contains(re.target)&&b(false),$.current&&!$.current.contains(re.target)&&I(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let _=useCallback(z=>{if(!S.current)return;let re=S.current.selectionStart||e.length,J=e.slice(0,re)+z+e.slice(re);t(J),I(false),setTimeout(()=>{if(S.current){let Ae=re+z.length;S.current.selectionStart=Ae,S.current.selectionEnd=Ae,S.current.focus();}},0);},[e,t]),ye=useCallback(z=>{if(!g||!z.target.files)return;let re=Array.from(z.target.files),J=x*1024*1024,Ae=re.filter(xe=>xe.size>J?(console.warn(`File ${xe.name} exceeds max size of ${x}MB`),false):true);Ae.length>0&&g(Ae),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:vb(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:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className: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:$,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:wb.map(z=>jsx("button",{type:"button",onClick:()=>_(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:ye,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:S,value:e,onChange:Y,onSelect:Z,onKeyDown:B,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:xb(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 Uu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,c)=>l.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:l.value},c):jsx("span",{children:l.value},c))})}var Zs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function So({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=useState(false),[i,m]=useState(""),[d,p]=useState(false),[g,y]=useState(Zs[10]||"#2E94FF"),[x,h]=useState({top:0,left:0}),f=useRef(null),b=useRef(null),v=useRef(null),C=useRef(null),N=t.filter(S=>S.name.toLowerCase().includes(i.toLowerCase())),T=t.some(S=>S.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&b.current){let S=b.current.getBoundingClientRect();h({top:S.bottom+6,left:S.left});}},[l]),useEffect(()=>{let S=X=>{let O=X.target,$=f.current?.contains(O),F=v.current?.contains(O);!$&&!F&&(c(false),m(""),p(false));};if(l)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),useEffect(()=>{l&&C.current&&C.current.focus();},[l]);let k=S=>{let X=e.some(O=>O.id===S.id);a(X?e.filter(O=>O.id!==S.id):[...e,S]);},w=async()=>{if(!(!r||!i.trim())){p(true);try{let S=await r(i.trim(),g);S&&(a([...e,S]),m(""),y(Zs[Math.floor(Math.random()*Zs.length)]||"#2E94FF"));}finally{p(false);}}},E=(S,X)=>{X.stopPropagation(),a(e.filter(O=>O.id!==S));},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(!l),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(S=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${S.color}20`,color:S.color},children:S.name},S.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref: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:i,onChange:S=>m(S.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:S=>{S.key==="Enter"&&i.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(S=>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:`${S.color}20`,color:S.color},onClick:X=>E(S.id,X),children:[S.name,jsx(X,{className:"w-3 h-3"})]},S.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(S=>{let X=e.some(O=>O.id===S.id);return jsxs("button",{type:"button",onClick:()=>k(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:X?`${S.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:S.color}}),jsx("span",{className:"flex-1 text-left",children:S.name}),X&&jsx(Check,{className:"w-4 h-4",style:{color:S.color}})]},S.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!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:Zs.map(S=>jsx("button",{type:"button",onClick:()=>y(S),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:S,outline:g===S?`2px solid ${S}`:"none",outlineOffset:"2px"}},S))}),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 "',i.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 Vu({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 Fb(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Pb({className:e}){return jsxs("svg",{className:u("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Ml({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Fb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Gu(e.loggedMinutes),i=e.estimateMinutes?Gu(e.estimateMinutes):null,m=a&&i?`${c} / ${i}`: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(Pb,{className:l[t]}),jsx("span",{children:m})]})}function Ab(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 ti(e){let t=Ab(e);return t!==null?String(t):e}function _u(e){let a=ti(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function ai(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Bb(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Rb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Ob({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 Ku({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 $b({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:l,onStopTimer:c,onDiscardTimer:i,onClose:m,className:d}){let[p,g]=useState(""),[y,x]=useState(t.estimateMinutes?ai(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(Ku,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Bb(o)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Ob,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Ku,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,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(Rb,{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($b,{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:ai(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?ai(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:ai(I.durationMinutes)})]},I.id))})]})]})}function Vb(e){let a=ti(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function 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 oo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=useState(Gb(r)),[i,m]=useState(""),[d,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let y=async()=>{p(true);let v=Vb(l);await o(v&&v>0?v:null,i||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:l,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:i,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||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?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 jb(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=jb(e.health),s=_b(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className: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}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}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 qb(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 Xb(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 Jb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",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",l),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",l),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",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className: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",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",c),children:wn(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,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:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Qb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className: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",l),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":l),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":l),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),qb(e.status,a)),children:Xb(e.status,t)})})]})}function Ll({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=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",l,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(Jb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",c,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className: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",i),children:g.map(y=>jsx(Qb,{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 ph(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 rp(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 mh(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 bo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,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:S,onTimerStop:X$1,onTimerDiscard:O,blurFinancials:$=false}){let F=s==="dark",Y={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)"},Z=e&&"title"in e&&!("name"in e),Se=e,[B,_]=useState(e?rp(e,l):null),[ye,Je]=useState(false),[z,re]=useState(false),[J,Ae]=useState(false),[xe,Ue]=useState(null),[Re,it]=useState(new Date),[ee,lt]=useState(false),[de,dt]=useState(false),[ot,At]=useState(""),[we,vt]=useState(false),[gt,at]=useState(false),[H,le]=useState(false),[D,K]=useState(false),[pe,Te]=useState(""),V=useRef(null),te=useRef(null),[Oe,De]=useState(""),We=useRef(null),[Fe,Ke]=useState(""),[ft,ct]=useState(false),[pt,rt]=useState([]),[Gt,Mt]=useState(""),[Dt,wt]=useState(false),bt=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=rp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:A?.id,taskName:A?.name,soldEffortMinutes:A?.soldEffortMinutes,quotedMinutes:A?.quotedMinutes,effortMinutes:A?.effortMinutes,timeLoggedMinutes:A?.timeLoggedMinutes}),_(A),Te(A.description||""),De(A.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!pe)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,pe]),useEffect(()=>()=>{V.current&&clearTimeout(V.current),We.current&&clearTimeout(We.current);},[]),useEffect(()=>{t&&bt.current&&y.length>0&&setTimeout(()=>{bt.current&&(bt.current.scrollTop=bt.current.scrollHeight);},100);},[t,y.length]);let Ut=useCallback(A=>{_(A),Z&&o&&Se?o(mh(A,Se)):r&&r(A);},[Z,Se,o,r]),Ve=useCallback(()=>{Je(false),re(false),Ae(false),Ue(null),dt(false),At(""),vt(false);},[]),Le=useCallback((A,ge)=>{if(!B)return;let je={...B,[A]:ge};Ut(je);},[B,Ut]),nt=useCallback(()=>{let A=te.current;A&&(A.style.height="auto",A.style.height=`${Math.max(100,A.scrollHeight)}px`);},[]),oe=useCallback(A=>{Te(A),setTimeout(nt,0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{if(B){let ge={...B,description:A};Ut(ge);}},800);},[B,Ut,nt]),be=useCallback(A=>{De(A),We.current&&clearTimeout(We.current),We.current=setTimeout(()=>{if(B&&A.trim()){let ge={...B,name:A.trim()};Ut(ge);}},800);},[B,Ut]),L=useCallback(A=>{let ge=A.map(je=>{let et={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:je};return je.type.startsWith("image/")&&(et.preview=URL.createObjectURL(je)),et});rt(je=>[...je,...ge]);},[]),j=useCallback(A=>{rt(ge=>{let je=ge.find(et=>et.id===A);return je?.preview&&URL.revokeObjectURL(je.preview),ge.filter(et=>et.id!==A)});},[]),q=useCallback(async()=>{if(!(!B||!Fe.trim()&&pt.length===0||!x)){ct(true);try{let A=Hu(Fe,f),ge=[];if(pt.length>0&&b){let je=pt.map(et=>et.file);ge=await b(je);}await x(B.id,Fe.trim(),A.length>0?A:void 0,ge.length>0?ge:void 0),Ke(""),pt.forEach(je=>{je.preview&&URL.revokeObjectURL(je.preview);}),rt([]);}finally{ct(false);}}},[B,Fe,pt,x,f,b]),me=useCallback(()=>{if(!B||!Gt.trim())return;let A=B.subtasks||[],ge={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Gt.trim(),progress:0,startDate:new Date,endDate:new Date,position:A.length},je=[...A,ge],et={...B,subtasks:je};Ut(et),Mt(""),wt(false);},[B,Gt,Ut]),Ne=useCallback(A=>{if(!B?.subtasks)return;let ge=B.subtasks.map(et=>et.id===A?{...et,progress:et.progress===100?0:100}:et),je={...B,subtasks:ge};Ut(je);},[B,Ut]),Xe=useCallback(A=>{if(!B?.subtasks)return;let ge=B.subtasks.filter(et=>et.id!==A),je={...B,subtasks:ge};Ut(je);},[B,Ut]),_e=useCallback(A=>{let ge=typeof A=="string"?new Date(A):A,et=new Date().getTime()-ge.getTime(),oa=Math.floor(et/6e4),jt=Math.floor(et/36e5),La=Math.floor(et/864e5);return oa<1?n==="es"?"Ahora":"Just now":oa<60?n==="es"?`Hace ${oa} min`:`${oa}m ago`:jt<24?n==="es"?`Hace ${jt}h`:`${jt}h ago`:La<7?n==="es"?`Hace ${La}d`:`${La}d ago`:ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),$e=useCallback(A=>{if(!B)return;let ge=B.progress||0;A==="completed"?ge=100:A==="in-progress"&&ge===0?ge=10:A==="todo"&&(ge=0);let je={...B,status:A,progress:ge};Ut(je),Je(false);},[B,Ut]),kt=useCallback((A,ge)=>{if(!B)return;let je={...B,startDate:A,endDate:ge};Ut(je);},[B,Ut]),mt=useCallback(()=>{let A=Re.getFullYear(),ge=Re.getMonth(),je=new Date(A,ge,1),oa=new Date(A,ge+1,0).getDate(),jt=je.getDay(),La=[],_a=new Date(A,ge,0).getDate();for(let ma=jt-1;ma>=0;ma--)La.push({date:new Date(A,ge-1,_a-ma),isCurrentMonth:false});for(let ma=1;ma<=oa;ma++)La.push({date:new Date(A,ge,ma),isCurrentMonth:true});let Ia=42-La.length;for(let ma=1;ma<=Ia;ma++)La.push({date:new Date(A,ge+1,ma),isCurrentMonth:false});return La},[Re]),Wt=useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),le(false),!B||!d)return;let ge=Array.from(A.dataTransfer.files);if(ge.length!==0){K(true);try{await d(B.id,ge);}finally{K(false);}}},[B,d]),Ta=useCallback(async A=>{if(!B||!d||!A.target.files)return;let ge=Array.from(A.target.files);if(ge.length!==0){K(true);try{await d(B.id,ge);}finally{K(false);}A.target.value="";}},[B,d]),Xt=useCallback(A=>{A.preventDefault(),A.stopPropagation(),le(true);},[]),U=useCallback(A=>{A.preventDefault(),A.stopPropagation(),le(false);},[]),ne=useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),He=useCallback(A=>A.startsWith("image/")?Image:A.includes("pdf")||A.includes("document")?FileText:File,[]);return !t||!B?null:jsx(AnimatePresence,{children:t&&B&&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:B.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=B.progress===100?0:100,je={...B,progress:A,status:A===100?"completed":"todo"};Ut(je);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":F?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Oe,onChange:A=>be(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",B.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:()=>{Ve(),Je(!ye);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-blue-500/20 text-blue-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?n==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:ye&&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:()=>$e(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",B.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:()=>{Ve(),Ae(!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:[B.assignees&&B.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[B.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)),B.assignees.length>3&&jsxs("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",B.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:()=>Ae(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:l.length>0?l.map(A=>{let ge=B.assignees?.some(je=>je.name===A.name);return jsxs("button",{onClick:()=>{let je=B.assignees||[],et;ge?et=je.filter(oa=>oa.name!==A.name):et=[...je,A],Le("assignees",et);},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(xe?null:"start"),it(B.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:[B.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"}),B.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:xe&&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 je=new Date(A);je.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let et=new Date(A);et.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 jt=new Date(A);jt.setDate(A.getDate()+14);let La=new Date(A);return La.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:je,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:et,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:jt,display:jt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:La,display:La.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ia,ma)=>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(xe==="start"){let dr=B.endDate&&Ia.date>B.endDate?Ia.date:B.endDate;kt(Ia.date,dr),Ue("end");}else {let dr=B.startDate&&Ia.date<B.startDate?Ia.date:B.startDate;kt(dr,Ia.date),Ue(null);}},children:[jsx("span",{children:Ia.label}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Ia.display})]},ma))})(),jsx("div",{className:u("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{kt(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:xe==="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:Re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>it(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:()=>it(new Date(Re.getFullYear(),Re.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:()=>it(new Date(Re.getFullYear(),Re.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:mt().map((A,ge)=>{let je=A.date.toDateString()===new Date().toDateString(),et=B.startDate?.toDateString()===A.date.toDateString(),oa=B.endDate?.toDateString()===A.date.toDateString(),jt=et||oa,La=B.startDate&&B.endDate&&A.date>=B.startDate&&A.date<=B.endDate;return jsx("button",{onClick:()=>{let _a=new Date(A.date);if(xe==="start"){let Ia=B.endDate&&_a>B.endDate?_a:B.endDate;kt(_a,Ia),Ue("end");}else {let Ia=B.startDate&&_a<B.startDate?_a:B.startDate;kt(Ia,_a),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"),je&&"ring-2 ring-[#2E94FF]",et&&"bg-[#2E94FF] text-white",oa&&!et&&"bg-[#7C3AED] text-white",La&&!jt&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!jt&&(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:()=>{Ve(),re(!z);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?n==="es"?"Alta":"High":B.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:()=>{Le("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",B.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:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.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:[ee?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:A=>{let ge=parseInt(A.target.value),je=B.status;ge===100?je="completed":ge>0?je="in-progress":je="todo";let et={...B,progress:ge,status:je};Ut(et);},onBlur:()=>lt(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:()=>lt(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",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[B.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:B.status==="completed"||B.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:gt==="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(oo,{mode:"estimate",locale:n,isDark:F,currentValue:C?.estimateMinutes||null,onSave:async A=>{await E?.(B.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:$?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"}):B.status==="completed"||B.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:B.quotedMinutes?kn(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.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(B.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:gt==="quoted"&&!$&&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(oo,{mode:"quoted",locale:n,isDark:F,currentValue:B.quotedMinutes||null,onSave:async A=>{I?(await I(B.id,A),_(ge=>ge?{...ge,quotedMinutes:A}:null)):Le("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:[B.status==="completed"||B.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?.(B.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"}),ph(k||0)]}):jsx("button",{type:"button",onClick:()=>S?.(B.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"})}),B.status==="completed"||B.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:gt==="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(oo,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(A,ge)=>{A&&await w?.(B.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(So,{selectedTags:B.tags||[],availableTags:c,onChange:A=>{Le("tags",A);},onCreateTag:i,theme:Y})]}),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:[B.dependencies&&B.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(A=>{let ge=g.find(je=>je.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 je=(B.dependencies||[]).filter(et=>et!==A);Le("dependencies",je);},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:()=>{Ve(),dt(!de);},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:de&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{dt(false),At("");}}),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:ot,onChange:A=>At(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!==B.id).filter(A=>ot===""||A.name.toLowerCase().includes(ot.toLowerCase())).map(A=>{let ge=B.dependencies?.includes(A.id);return jsxs("button",{onClick:()=>{let je=B.dependencies||[],et;ge?et=je.filter(oa=>oa!==A.id):et=[...je,A.id],Le("dependencies",et);},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:()=>{Ve(),vt(!we);},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:B.color||"#6366F1"}}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:Xo.find(A=>A.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:we&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>vt(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=B.color===A.value;return jsx("button",{onClick:()=>{Le("color",A.value),vt(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:B.isMilestone||false,onChange:A=>Le("isMilestone",A.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.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:pe,onChange:A=>oe(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",B.subtasks&&B.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(A=>A.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...B.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:()=>Ne(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:()=>Xe(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))}),Dt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Gt,onChange:A=>Mt(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Gt.trim()?me():A.key==="Escape"&&(wt(false),Mt(""));},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:me,disabled:!Gt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Gt.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:()=>{wt(false),Mt("");},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:()=>wt(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=He(A.type),je=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:[je&&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:Xt,onDragLeave:U,onDrop:Wt,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?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",D&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Ta,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||D}),D?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className: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",H?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!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:`
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 $f 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 oy from'react-markdown';import ny from'remark-gfm';import sy 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 Ws=(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 Vs=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 [Vs.Translate.toString(e),Vs.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 Gs(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 Lf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function yl(e,t){return e.length===0?1e3:t===0?Gs(null,e[0].position):t>=e.length?Gs(e[e.length-1].position,null):Gs(e[t-1].position,e[t].position)}function nu(e,t=100){return e>t}var If=e=>{if(e.message.includes("network")||e.message.includes("fetch"))return true;if("status"in e){let t=e.status;return t>=500||t===429}return false};function Bf(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function js(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=If,onRetry:l}=t,c,i=0;for(let p=1;p<=a;p++){i=p;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,p===a||!n(c,p))return {error:c,attempts:i,success:false};let g=Bf(p,r,o,s);if(l)try{l(c,p,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:i,success:false}}function Rf(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 Of(e,t={}){return async(...a)=>js(()=>e(...a),t)}var xl=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 su=(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))(su||{}),_o=class _o{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,c?n:"");break;case "INFO":console.info(l,o,c?n:"");break;case "WARN":console.warn(l,o,c?n:"");break;case "ERROR":console.error(l,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 _s((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new _s(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:su[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};_o.globalOptions={};var vl=_o,_s=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}},iu=new vl;function Hf(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 zf(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(l=>l.id===s.columnId);return [s.id,wl(s.title),wl(s.description||""),wl(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 Uf(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 $f(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),c=297,i=210,p=n.width/n.height,d=c-20,m=d/p;m>i-20&&(m=i-20,d=m*p);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(l,"PNG",y,20,d,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let l=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,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(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 p=o.splitTextToSize(c.description,160);o.text(p,25,s),s+=p.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let p=[];c.startDate&&p.push(`Start: ${c.startDate}`),c.endDate&&p.push(`End: ${c.endDate}`),i.push(p.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function wl(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function du(e,t,a,r){switch(t){case "json":return Hf(e,r);case "csv":return zf(e);case "pdf":return await Uf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function cu(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let p=`${r}.pdf`;e.save(p);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function Wf(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Vf(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=uu(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=uu(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,y)=>{i[g]=l[y]||"";});let p=i.Column||"Unnamed";o.has(p)||o.set(p,{id:`col-${o.size+1}`,title:p,position:o.size+1,cardIds:[]});let d=o.get(p),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(m),d.cardIds.push(m.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function uu(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 pu(e,t){switch(t){case "json":return Wf(e);case "csv":return Vf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function mu(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 kl=createContext(null);function gu(){return useContext(kl)}var fu=createContext(null);function bu({children:e,themeName:t}){return jsx(fu.Provider,{value:{themeName:t},children:e})}function yn(){return useContext(fu)}function Jt({children:e,container:t}){let[a,r]=useState(false),o=gu(),s=yn();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var wu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Jf="#BDC3C7",Qf=({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 Ko({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),c=useRef(null),i=()=>{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=>{l.current&&!l.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 p=g=>{t(g),o(false);},d=e?wu[e]:null,m=d?.color||Jf;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Jt,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(wu).map(([g,y])=>jsxs("button",{onClick:()=>p(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(Qf,{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:()=>p(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 Zf=[{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 Xn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),m=(yn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),C=window.innerHeight,N=window.innerWidth,T=320,k=380,w=4,F=v.left;F+T>N-10&&(F=N-T-10),F<10&&(F=10);let I=C-v.bottom,S=v.top,X;I>=k+w?X=v.bottom+w:S>=k+w?X=v.top-k-w:X=I>=S?v.bottom+w:Math.max(10,v.top-k-w),l({top:X,left:F}),s(true);};useEffect(()=>{let v=C=>{c.current&&!c.current.contains(C.target)&&!i.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=F=>{let I=F.getFullYear(),S=String(F.getMonth()+1).padStart(2,"0"),X=String(F.getDate()).padStart(2,"0");return `${I}-${S}-${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 F=w[0],I=w[1],S=w[2];return F===void 0||I===void 0||S===void 0?null:new Date(F,I-1,S)},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:i,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${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(Jt,{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:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:m?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:Zf.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:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${m?"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:m?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange: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:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange: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:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter: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 Yo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[l,c]=useState(""),[i,p]=useState({top:0,left:0}),d=useRef(null),m=useRef(null),g=()=>{if(!m.current)return;let b=m.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 F=v-b.bottom,I=b.top,S;F>=T+k?S=b.bottom+k:I>=T+k?S=b.top-T-k:S=F>=I?b.bottom+k:Math.max(10,b.top-T-k),p({top:S,left:w}),n(true);};useEffect(()=>{let b=v=>{d.current&&!d.current.contains(v.target)&&!m.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(l.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:m,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[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(Jt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange: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 Ks(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(p=>{if(typeof p=="string")return p;let d=p;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let p of i){if(!s.has(p)&&l(p))return true;if(n.has(p))return true}}return n.delete(c),false};return l(a)}function Qn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=useState(false),[i,p]=useState(""),[d,m]=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(),F=window.innerHeight,I=window.innerWidth,S=300,X=d?380:120,O=4,$=w.right-S;$<10&&($=w.left),$+S>I-10&&($=I-S-10);let A=F-w.bottom,q=w.top,Z;A>=X+O?Z=w.bottom+O:q>=X+O?Z=w.top-X-O:Z=A>=q?w.bottom+O:Math.max(10,w.top-X-O),y({top:Z,left:$}),c(true);};useEffect(()=>{if(!l||!b.current)return;let w=b.current.getBoundingClientRect(),F=window.innerHeight,I=window.innerWidth,S=300,X=d?380:120,O=4,$=w.right-S;$<10&&($=w.left),$+S>I-10&&($=I-S-10);let A=F-w.bottom,q=w.top,Z;A>=X+O?Z=w.bottom+O:q>=X+O?Z=w.top-X-O:Z=A>=q?w.bottom+O:Math.max(10,w.top-X-O),y({top:Z,left:$});},[d,l]),useEffect(()=>{let w=F=>{f.current&&!f.current.contains(F.target)&&!b.current?.contains(F.target)&&(c(false),p(""));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),useEffect(()=>{let w=F=>{F.key==="Escape"&&(c(false),p(""));};if(l)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]);let C=w=>{let F=t.includes(w),I=a.find(S=>S.id===w);if(h(null),F){let S=t.filter(X=>X!==w);r(S),S.length===0&&m(false);}else {if(s&&Ks(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]),m(true);}},N=()=>{let w=!d;m(w),w||r([]);},T=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:b,onClick:()=>l?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})]}),l&&jsx(Jt,{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:i,onChange:w=>p(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 F=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:F?"#3b82f6":"transparent",borderColor:F?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:F&&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([]),m(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 go=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:p,setNodeRef:d,transform:m,transition:g,isDragging:y}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:Vs.Transform.toString(m),transition:g};if(t)return jsx("div",{ref:d,style:x,...i,...p,onClick:()=>a?.(e),children:t(e)});let h=l.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),...i,...p,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(Ko,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsx(Xn,{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})})}),l.length>0&&jsx("div",{onClick:C=>C.stopPropagation(),className:"user-selector",children:jsx(Yo,{assignedUsers:h,availableUsers:l,onChange:C=>n?.(e.id,{assignedUserIds:C.map(N=>N.id)})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"dependencies-selector",children:jsx(Qn,{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)));go.displayName="Card";var qs={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"}},Pu=({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 Au({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),p=[...Object.entries(qs).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(qs).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=qs[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"}:{...qs.todo,id:"todo"}},m=()=>{if(!i.current)return;let h=i.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,F;k>=C+N?F=h.bottom+N:w>=C+N?F=h.top-C-N:F=k>=w?h.bottom+N:Math.max(10,h.top-C-N),l({top:F,left:T}),s(true);};useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!i.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:i,onClick:()=>o?s(false):m(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsx(Pu,{icon:y.icon,color:x})}),o&&jsx(Jt,{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:p.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(Pu,{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 Lu={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 Iu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Lu[s]||Lu.en,[l,c]=useState(false),[i,p]=useState(false),[d,m]=useState(e),[g,y]=useState({top:0,left:0}),x=useRef(null),h=useRef(null),f=useRef(null);useEffect(()=>{if(l&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[l]),useEffect(()=>{let N=T=>{x.current&&!x.current.contains(T.target)&&!h.current?.contains(T.target)&&(c(false),p(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{let N=T=>{T.key==="Escape"&&(c(false),p(false),m(e));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l,e]),useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let b=()=>{p(true),m(e);},v=()=>{let N=d.trim();N&&N!==e&&t(N),p(false),c(false),m(e);},C=N=>{N.key==="Enter"?v():N.key==="Escape"&&(p(false),m(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsx(Jt,{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:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:d,onChange:N=>m(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 wn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:p,cardHeight:d=120,isCollapsed:m,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=p??nu(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}})(),S=I.state==="exceeded",X=()=>"asakaa-column-count";return jsxs("div",{ref:C,className:u("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",S&&"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(Iu,{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":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),b&&b(e,t),!m&&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 $=t[O.index];return $?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsx(go,{card:$,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},$.id):null})}):t.map(O=>jsx(go,{card:O,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},O.id))})})]})});wn.displayName="Column";function Sl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):n(e),o(false);},i=p=>{p.key==="Enter"?c():p.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:p=>n(p.target.value),onBlur:c,onKeyDown:i,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 xb(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 zu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(i===s||c===s||p.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function vb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var kb=["\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 Uu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:p=true,enableAttachments:d=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=l==="dark",[f,b]=useState(false),[v,C]=useState([]),[N,T]=useState(0),[k,w]=useState(null),[F,I]=useState(false),S=useRef(null),X$1=useRef(null),O=useRef(null),$=useRef(null),A=useCallback((z,re)=>{let J=xb(z,re);if(w(J),J){let Le=r.filter(we=>we.name.toLowerCase().includes(J.query)||we.email&&we.email.toLowerCase().includes(J.query)).slice(0,5);C(Le),b(Le.length>0),T(0);}else b(false),C([]);},[r]),q=z=>{let re=z.target.value;if(t(re),A(re,z.target.selectionStart||0),S.current){S.current.style.height="24px";let J=S.current.scrollHeight,Le=280,we=Math.min(J,Le);S.current.style.height=`${we}px`,S.current.style.overflowY=J>Le?"auto":"hidden";}},Z=()=>{S.current&&A(e,S.current.selectionStart||0);},Ee=useCallback(z=>{if(!k||!S.current)return;let re=e.slice(0,k.start),J=e.slice(k.end),Le=`@${z.name.replace(/\s+/g,"")} `,we=re+Le+J;t(we),b(false),w(null),setTimeout(()=>{if(S.current){let Oe=k.start+Le.length;S.current.selectionStart=Oe,S.current.selectionEnd=Oe,S.current.focus();}},0);},[k,e,t]),B=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&&Ee(re);break}case "Tab":{z.preventDefault();let re=v[N];re&&Ee(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)&&S.current&&!S.current.contains(re.target)&&b(false),$.current&&!$.current.contains(re.target)&&I(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let _=useCallback(z=>{if(!S.current)return;let re=S.current.selectionStart||e.length,J=e.slice(0,re)+z+e.slice(re);t(J),I(false),setTimeout(()=>{if(S.current){let Le=re+z.length;S.current.selectionStart=Le,S.current.selectionEnd=Le,S.current.focus();}},0);},[e,t]),he=useCallback(z=>{if(!g||!z.target.files)return;let re=Array.from(z.target.files),J=x*1024*1024,Le=re.filter(we=>we.size>J?(console.warn(`File ${we.name} exceeds max size of ${x}MB`),false):true);Le.length>0&&g(Le),z.target.value="";},[g,x]),Ye=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:[m.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:m.map(z=>{let re=Ye(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:wb(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:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className: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:[p&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!F),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:F&&jsx(motion.div,{ref:$,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:kb.map(z=>jsx("button",{type:"button",onClick:()=>_(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:he,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:S,value:e,onChange:q,onSelect:Z,onKeyDown:B,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()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":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:()=>Ee(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:vb(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 Wu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,c)=>l.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:l.value},c):jsx("span",{children:l.value},c))})}var Zs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function So({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=useState(false),[i,p]=useState(""),[d,m]=useState(false),[g,y]=useState(Zs[10]||"#2E94FF"),[x,h]=useState({top:0,left:0}),f=useRef(null),b=useRef(null),v=useRef(null),C=useRef(null),N=t.filter(S=>S.name.toLowerCase().includes(i.toLowerCase())),T=t.some(S=>S.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&b.current){let S=b.current.getBoundingClientRect();h({top:S.bottom+6,left:S.left});}},[l]),useEffect(()=>{let S=X=>{let O=X.target,$=f.current?.contains(O),A=v.current?.contains(O);!$&&!A&&(c(false),p(""),m(false));};if(l)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),useEffect(()=>{l&&C.current&&C.current.focus();},[l]);let k=S=>{let X=e.some(O=>O.id===S.id);a(X?e.filter(O=>O.id!==S.id):[...e,S]);},w=async()=>{if(!(!r||!i.trim())){m(true);try{let S=await r(i.trim(),g);S&&(a([...e,S]),p(""),y(Zs[Math.floor(Math.random()*Zs.length)]||"#2E94FF"));}finally{m(false);}}},F=(S,X)=>{X.stopPropagation(),a(e.filter(O=>O.id!==S));},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(!l),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(S=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${S.color}20`,color:S.color},children:S.name},S.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref: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:i,onChange:S=>p(S.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:S=>{S.key==="Enter"&&i.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(S=>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:`${S.color}20`,color:S.color},onClick:X=>F(S.id,X),children:[S.name,jsx(X,{className:"w-3 h-3"})]},S.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(S=>{let X=e.some(O=>O.id===S.id);return jsxs("button",{type:"button",onClick:()=>k(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:X?`${S.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:S.color}}),jsx("span",{className:"flex-1 text-left",children:S.name}),X&&jsx(Check,{className:"w-4 h-4",style:{color:S.color}})]},S.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!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:Zs.map(S=>jsx("button",{type:"button",onClick:()=>y(S),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:S,outline:g===S?`2px solid ${S}`:"none",outlineOffset:"2px"}},S))}),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 "',i.trim(),'"']})]})]})}),document.body)]})}function Ml({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 Gu({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(Ml,{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 Jo=[{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 ju(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Pb(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Ab({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 Fl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Pb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=ju(e.loggedMinutes),i=e.estimateMinutes?ju(e.estimateMinutes):null,p=a&&i?`${c} / ${i}`: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(Ab,{className:l[t]}),jsx("span",{children:p})]})}function Lb(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 ti(e){let t=Lb(e);return t!==null?String(t):e}function Ku(e){let a=ti(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function ai(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 Rb(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 Ob({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function $b({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 qu({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Hb({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Pl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:p,className:d}){let[m,g]=useState(""),[y,x]=useState(t.estimateMinutes?ai(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=Ku(m);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()?Ku(y):null;await n(I),N(false);},F=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),k()),I.key==="Escape"&&p?.();};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:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(qu,{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:Rb(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($b,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(qu,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,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(Ob,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Hb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:T,type:"text",value:m,onChange:I=>g(I.target.value),onKeyDown:F,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||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:h,onChange:I=>f(I.target.value),onKeyDown:F,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:ai(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?ai(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:ai(I.durationMinutes)})]},I.id))})]})]})}function Gb(e){let a=ti(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function jb(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 ro({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=useState(jb(r)),[i,p]=useState(""),[d,m]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let y=async()=>{m(true);let v=Gb(l);await o(v&&v>0?v:null,i||void 0),m(false);},x=async()=>{m(true),await o(null),m(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:l,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:i,onChange:v=>p(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||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?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 _b(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 Kb(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 Ll({summary:e,showLabel:t=false,size:a="md",className:r}){let o=_b(e.health),s=Kb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className: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}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function kn(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 Yb(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 Xb(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 Jb(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 Qb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",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",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",kn(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",l),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",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className: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",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",c),children:kn(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",c),children:kn(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Zb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className: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",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?kn(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:kn(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":l),children:[o,kn(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":l),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",Xb(e.status,a),Yb(e.status,a)),children:Jb(e.status,t)})})]})}function Il({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",p=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",m=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",l,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",p),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(Qb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",c,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:m,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",i),children:g.map(y=>jsx(Zb,{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 Cn(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 mh(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 op(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 gh(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 bo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:p=[],onUploadAttachments:d,onDeleteAttachment:m,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:F,onSoldEffortUpdate:I,onTimerStart:S,onTimerStop:X$1,onTimerDiscard:O,blurFinancials:$=false}){let A=s==="dark",q={textTertiary:A?"#6B7280":"#9CA3AF",textSecondary:A?"#9CA3AF":"#6B7280",textPrimary:A?"#FFFFFF":"#111827",borderLight:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:A?"#1A1D25":"#FFFFFF",bgSecondary:A?"#0A0A0A":"#F9FAFB",hoverBg:A?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},Z=e&&"title"in e&&!("name"in e),Ee=e,[B,_]=useState(e?op(e,l):null),[he,Ye]=useState(false),[z,re]=useState(false),[J,Le]=useState(false),[we,Oe]=useState(null),[Be,lt]=useState(new Date),[ee,ct]=useState(false),[pe,et]=useState(false),[nt,Ut]=useState(""),[Ce,mt]=useState(false),[Dt,Xe]=useState(false),[H,ne]=useState(false),[D,K]=useState(false),[ce,Te]=useState(""),V=useRef(null),te=useRef(null),[$e,Ne]=useState(""),He=useRef(null),[Fe,Ge]=useState(""),[ht,dt]=useState(false),[gt,ot]=useState([]),[jt,Et]=useState(""),[Nt,Tt]=useState(false),yt=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 E=op(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:E?.id,taskName:E?.name,soldEffortMinutes:E?.soldEffortMinutes,quotedMinutes:E?.quotedMinutes,effortMinutes:E?.effortMinutes,timeLoggedMinutes:E?.timeLoggedMinutes}),_(E),Te(E.description||""),Ne(E.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!ce)return;let E=setTimeout(()=>{let fe=te.current;fe&&(fe.style.height="auto",fe.style.height=`${Math.max(100,fe.scrollHeight)}px`);},50);return ()=>clearTimeout(E)},[t,ce]),useEffect(()=>()=>{V.current&&clearTimeout(V.current),He.current&&clearTimeout(He.current);},[]),useEffect(()=>{t&&yt.current&&y.length>0&&setTimeout(()=>{yt.current&&(yt.current.scrollTop=yt.current.scrollHeight);},100);},[t,y.length]);let $t=useCallback(E=>{_(E),Z&&o&&Ee?o(gh(E,Ee)):r&&r(E);},[Z,Ee,o,r]),We=useCallback(()=>{Ye(false),re(false),Le(false),Oe(null),et(false),Ut(""),mt(false);},[]),Re=useCallback((E,fe)=>{if(!B)return;let je={...B,[E]:fe};$t(je);},[B,$t]),at=useCallback(()=>{let E=te.current;E&&(E.style.height="auto",E.style.height=`${Math.max(100,E.scrollHeight)}px`);},[]),ie=useCallback(E=>{Te(E),setTimeout(at,0),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{if(B){let fe={...B,description:E};$t(fe);}},800);},[B,$t,at]),me=useCallback(E=>{Ne(E),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(B&&E.trim()){let fe={...B,name:E.trim()};$t(fe);}},800);},[B,$t]),L=useCallback(E=>{let fe=E.map(je=>{let tt={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:je};return je.type.startsWith("image/")&&(tt.preview=URL.createObjectURL(je)),tt});ot(je=>[...je,...fe]);},[]),j=useCallback(E=>{ot(fe=>{let je=fe.find(tt=>tt.id===E);return je?.preview&&URL.revokeObjectURL(je.preview),fe.filter(tt=>tt.id!==E)});},[]),Y=useCallback(async()=>{if(!(!B||!Fe.trim()&&gt.length===0||!x)){dt(true);try{let E=zu(Fe,f),fe=[];if(gt.length>0&&b){let je=gt.map(tt=>tt.file);fe=await b(je);}await x(B.id,Fe.trim(),E.length>0?E:void 0,fe.length>0?fe:void 0),Ge(""),gt.forEach(je=>{je.preview&&URL.revokeObjectURL(je.preview);}),ot([]);}finally{dt(false);}}},[B,Fe,gt,x,f,b]),ge=useCallback(()=>{if(!B||!jt.trim())return;let E=B.subtasks||[],fe={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:jt.trim(),progress:0,startDate:new Date,endDate:new Date,position:E.length},je=[...E,fe],tt={...B,subtasks:je};$t(tt),Et(""),Tt(false);},[B,jt,$t]),De=useCallback(E=>{if(!B?.subtasks)return;let fe=B.subtasks.map(tt=>tt.id===E?{...tt,progress:tt.progress===100?0:100}:tt),je={...B,subtasks:fe};$t(je);},[B,$t]),Je=useCallback(E=>{if(!B?.subtasks)return;let fe=B.subtasks.filter(tt=>tt.id!==E),je={...B,subtasks:fe};$t(je);},[B,$t]),_e=useCallback(E=>{let fe=typeof E=="string"?new Date(E):E,tt=new Date().getTime()-fe.getTime(),ra=Math.floor(tt/6e4),Vt=Math.floor(tt/36e5),Ua=Math.floor(tt/864e5);return ra<1?n==="es"?"Ahora":"Just now":ra<60?n==="es"?`Hace ${ra} min`:`${ra}m ago`:Vt<24?n==="es"?`Hace ${Vt}h`:`${Vt}h ago`:Ua<7?n==="es"?`Hace ${Ua}d`:`${Ua}d ago`:fe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),ze=useCallback(E=>{if(!B)return;let fe=B.progress||0;E==="completed"?fe=100:E==="in-progress"&&fe===0?fe=10:E==="todo"&&(fe=0);let je={...B,status:E,progress:fe};$t(je),Ye(false);},[B,$t]),vt=useCallback((E,fe)=>{if(!B)return;let je={...B,startDate:E,endDate:fe};$t(je);},[B,$t]),ut=useCallback(()=>{let E=Be.getFullYear(),fe=Be.getMonth(),je=new Date(E,fe,1),ra=new Date(E,fe+1,0).getDate(),Vt=je.getDay(),Ua=[],lr=new Date(E,fe,0).getDate();for(let ya=Vt-1;ya>=0;ya--)Ua.push({date:new Date(E,fe-1,lr-ya),isCurrentMonth:false});for(let ya=1;ya<=ra;ya++)Ua.push({date:new Date(E,fe,ya),isCurrentMonth:true});let fa=42-Ua.length;for(let ya=1;ya<=fa;ya++)Ua.push({date:new Date(E,fe+1,ya),isCurrentMonth:false});return Ua},[Be]),Wt=useCallback(async E=>{if(E.preventDefault(),E.stopPropagation(),ne(false),!B||!d)return;let fe=Array.from(E.dataTransfer.files);if(fe.length!==0){K(true);try{await d(B.id,fe);}finally{K(false);}}},[B,d]),ha=useCallback(async E=>{if(!B||!d||!E.target.files)return;let fe=Array.from(E.target.files);if(fe.length!==0){K(true);try{await d(B.id,fe);}finally{K(false);}E.target.value="";}},[B,d]),ta=useCallback(E=>{E.preventDefault(),E.stopPropagation(),ne(true);},[]),U=useCallback(E=>{E.preventDefault(),E.stopPropagation(),ne(false);},[]),Ze=useCallback(E=>E<1024?`${E} B`:E<1024*1024?`${(E/1024).toFixed(1)} KB`:`${(E/(1024*1024)).toFixed(1)} MB`,[]),ye=useCallback(E=>E.startsWith("image/")?Image:E.includes("pdf")||E.includes("document")?FileText:File,[]);return !t||!B?null:jsx(AnimatePresence,{children:t&&B&&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",A?"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]",A?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",A?"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",A?"text-[#6B7280]":"text-gray-400"),children:B.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 E=B.progress===100?0:100,je={...B,progress:E,status:E===100?"completed":"todo"};$t(je);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":A?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:$e,onChange:E=>me(E.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",B.progress===100?"line-through text-[#6B7280]":A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{We(),Ye(!he);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-blue-500/20 text-blue-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?n==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ye(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]",A?"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(E=>jsxs("button",{onClick:()=>ze(E.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",B.status===E.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",E.color)}),jsx("span",{className:A?"text-white":"text-gray-900",children:E.label})]},E.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{We(),Le(!J);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((E,fe)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:E.color||"#8B5CF6"},title:E.name,children:E.initials||E.name.slice(0,2).toUpperCase()},fe)),B.assignees.length>3&&jsxs("span",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsx("span",{className:u("text-sm",A?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:J&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Le(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",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(E=>{let fe=B.assignees?.some(je=>je.name===E.name);return jsxs("button",{onClick:()=>{let je=B.assignees||[],tt;fe?tt=je.filter(ra=>ra.name!==E.name):tt=[...je,E],Re("assignees",tt);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",fe&&(A?"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:E.color||"#8B5CF6"},children:E.initials||E.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",A?"text-white":"text-gray-900"),children:E.name}),fe&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},E.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Oe(we?null:"start"),lt(B.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",A?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:we&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Oe(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",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",A?"border-white/10":"border-gray-200"),children:[(()=>{let E=new Date,fe=new Date(E);fe.setDate(E.getDate()+1);let je=new Date(E);je.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let tt=new Date(E);tt.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let ra=new Date(E);ra.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let Vt=new Date(E);Vt.setDate(E.getDate()+14);let Ua=new Date(E);return Ua.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:fe,display:fe.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:je,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:ra,display:ra.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Vt,display:Vt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ua,display:Ua.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((fa,ya)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(we==="start"){let Hr=B.endDate&&fa.date>B.endDate?fa.date:B.endDate;vt(fa.date,Hr),Oe("end");}else {let Hr=B.startDate&&fa.date<B.startDate?fa.date:B.startDate;vt(Hr,fa.date),Oe(null);}},children:[jsx("span",{children:fa.label}),jsx("span",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:fa.display})]},ya))})(),jsx("div",{className:u("border-t mt-2 pt-2",A?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{vt(void 0,void 0),Oe(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"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",A?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:we==="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",A?"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:()=>lt(new Date),className:u("p-1 rounded text-sm transition-colors",A?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>lt(new Date(Be.getFullYear(),Be.getMonth()-1)),className:u("p-1 rounded",A?"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:()=>lt(new Date(Be.getFullYear(),Be.getMonth()+1)),className:u("p-1 rounded",A?"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(E=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",A?"text-[#6B7280]":"text-gray-400"),children:E},E))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:ut().map((E,fe)=>{let je=E.date.toDateString()===new Date().toDateString(),tt=B.startDate?.toDateString()===E.date.toDateString(),ra=B.endDate?.toDateString()===E.date.toDateString(),Vt=tt||ra,Ua=B.startDate&&B.endDate&&E.date>=B.startDate&&E.date<=B.endDate;return jsx("button",{onClick:()=>{let lr=new Date(E.date);if(we==="start"){let fa=B.endDate&&lr>B.endDate?lr:B.endDate;vt(lr,fa),Oe("end");}else {let fa=B.startDate&&lr<B.startDate?lr:B.startDate;vt(fa,lr),Oe(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(A?"text-[#4B5563]":"text-gray-300"),E.isCurrentMonth&&(A?"text-white":"text-gray-900"),je&&"ring-2 ring-[#2E94FF]",tt&&"bg-[#2E94FF] text-white",ra&&!tt&&"bg-[#7C3AED] text-white",Ua&&!Vt&&(A?"bg-[#7C3AED]/20":"bg-purple-100"),!Vt&&(A?"hover:bg-white/10":"hover:bg-gray-100")),children:E.date.getDate()},fe)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{We(),re(!z);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?n==="es"?"Alta":"High":B.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]",A?"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(E=>jsxs("button",{onClick:()=>{Re("priority",E.id),re(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",B.priority===E.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",E.color)}),jsx("span",{className:A?"text-white":"text-gray-900",children:E.label})]},E.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",A?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.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",A?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ee?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:E=>{let fe=parseInt(E.target.value),je=B.status;fe===100?je="completed":fe>0?je="in-progress":je="todo";let tt={...B,progress:fe,status:je};$t(tt);},onBlur:()=>ct(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",A?"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:()=>ct(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",A?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${B.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",A?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),v&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?Cn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Xe("estimate"),className:u("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Cn(C.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Xe("estimate"),className:u("text-sm",A?"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(ro,{mode:"estimate",locale:n,isDark:A,currentValue:C?.estimateMinutes||null,onSave:async E=>{await F?.(B.id,E),Xe(false);},onClose:()=>Xe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:$?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",A?"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"}):B.status==="completed"||B.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Cn(B.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsx("button",{type:"button",onClick:()=>Xe("quoted"),className:u("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Cn(B.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Xe("quoted"),className:u("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Dt==="quoted"&&!$&&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(ro,{mode:"quoted",locale:n,isDark:A,currentValue:B.quotedMinutes||null,onSave:async E=>{I?(await I(B.id,E),_(fe=>fe?{...fe,quotedMinutes:E}:null)):Re("quotedMinutes",E),Xe(false);},onClose:()=>Xe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",A?"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?.(B.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"}),mh(k||0)]}):jsx("button",{type:"button",onClick:()=>S?.(B.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",A?"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"})}),B.status==="completed"||B.progress===100?jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",A?"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:()=>Xe("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",A?"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":A?"text-white":"text-gray-900"),children:[Cn(C.loggedMinutes),C.estimateMinutes&&jsxs("span",{className:u("font-normal",A?"text-[#6B7280]":"text-gray-400"),children:[" / ",Cn(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(ro,{mode:"log",locale:n,isDark:A,currentValue:null,onSave:async(E,fe)=>{E&&await w?.(B.id,{durationMinutes:E,note:fe,source:"manual"}),Xe(false);},onClose:()=>Xe(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(So,{selectedTags:B.tags||[],availableTags:c,onChange:E=>{Re("tags",E);},onCreateTag:i,theme:q})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(E=>{let fe=g.find(je=>je.id===E);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",A?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[fe?.name||E.slice(0,8),jsx("button",{onClick:()=>{let je=(B.dependencies||[]).filter(tt=>tt!==E);Re("dependencies",je);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},E)})}),jsxs("button",{onClick:()=>{We(),et(!pe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"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",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{et(false),Ut("");}}),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]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",A?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:nt,onChange:E=>Ut(E.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",A?"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(E=>E.id!==B.id).filter(E=>nt===""||E.name.toLowerCase().includes(nt.toLowerCase())).map(E=>{let fe=B.dependencies?.includes(E.id);return jsxs("button",{onClick:()=>{let je=B.dependencies||[],tt;fe?tt=je.filter(ra=>ra!==E.id):tt=[...je,E.id],Re("dependencies",tt);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",fe&&(A?"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",fe?"bg-blue-500 border-blue-500":A?"border-white/30":"border-gray-300"),children:fe&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",A?"text-white":"text-gray-900"),children:E.name}),jsx("span",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:E.id.slice(0,8)})]})]},E.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{We(),mt(!Ce);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"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:B.color||"#6366F1"}}),jsx("span",{className:u("text-sm",A?"text-white":"text-gray-900"),children:Jo.find(E=>E.value===B.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Ce&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>mt(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",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Jo.map(E=>{let fe=B.color===E.value;return jsx("button",{onClick:()=>{Re("color",E.value),mt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",fe&&"ring-2 ring-offset-2",A?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:E.value,outlineColor:fe?E.value:void 0},title:E.name,children:fe&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},E.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",A?"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:B.isMilestone||false,onChange:E=>Re("isMilestone",E.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":A?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",A?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",A?"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",A?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",A?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:te,value:ce,onChange:E=>ie(E.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",A?"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",A?"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",A?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(E=>E.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((E,fe)=>(E.position??0)-(fe.position??0)).map(E=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",A?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>De(E.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",E.progress===100?"bg-green-500 border-green-500":A?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:E.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",E.progress===100?"line-through text-[#6B7280]":A?"text-white":"text-gray-900"),children:E.name}),jsx("button",{onClick:()=>Je(E.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",A?"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"})})]},E.id))}),Nt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:jt,onChange:E=>Et(E.target.value),onKeyDown:E=>{E.key==="Enter"&&jt.trim()?ge():E.key==="Escape"&&(Tt(false),Et(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",A?"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:ge,disabled:!jt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",jt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":A?"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),Et("");},className:u("p-2 rounded-lg transition-colors",A?"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",A?"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",A?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",A?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",p.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsx("div",{className:"space-y-2 mb-4",children:p.map(E=>{let fe=ye(E.type),je=E.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[je&&E.thumbnailUrl?jsx("img",{src:E.thumbnailUrl,alt:E.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",A?"bg-white/10":"bg-gray-200"),children:jsx(fe,{className:u("w-5 h-5",A?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",A?"text-white":"text-gray-900"),children:E.name}),jsx("p",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:Ze(E.size)})]}),m&&jsx("button",{onClick:()=>m(E.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",A?"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"})})]},E.id)})}),jsxs("div",{onDragOver:ta,onDragLeave:U,onDrop:Wt,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?A?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":A?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",D&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:ha,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||D}),D?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",H?"text-blue-500":A?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:u("text-xs mt-1",A?"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",A?"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]",A?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",A?"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
  }
@@ -13,10 +13,10 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
13
13
  border-radius: 4px !important;
14
14
  }
15
15
  .activity-comments-scroll:hover::-webkit-scrollbar-thumb {
16
- background: ${F?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
16
+ background: ${A?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsx("div",{ref:bt,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 je=typeof A.createdAt=="string"?new Date(A.createdAt):A.createdAt,et=typeof ge.createdAt=="string"?new Date(ge.createdAt):ge.createdAt;return je.getTime()-et.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:_e(A.createdAt)})]}),jsx("div",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Uu,{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 je=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:[je?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(zu,{value:Fe,onChange:Ke,onSubmit:q,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:ft,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:pt,onFilesSelect:L,onRemoveFile:j})})]})]})]})})}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 Fo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,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:S,onUpdateSoldEffort:X,onStartTimer:O,onStopTimer:$,onDiscardTimer:F,blurFinancials:Y=false,sidePanel:Z,renderColumnMetrics:Se,suppressDetailModal:B=false}){let[_,ye]=Bl(),[Je,z]=useState(null),[re,J]=useState(false),Ae=useRef(null),xe=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ue=o?.theme||"dark",Re=Ue==="dark"||Ue==="neutral",it=Re?"dark":"",ee=useCallback((D,K)=>{t.onCardUpdate?.(D,K);},[t]),lt=useCallback((D,K)=>{t.onColumnUpdate?.(D,{title:K});},[t]),de=useCallback(D=>{t.onColumnDelete?.(D);},[t]),dt=["todo","in-progress","completed"],ot=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),At=useMemo(()=>{let D=new Map;return e.columns.forEach(K=>{let pe=K.cardIds.map(Te=>e.cards.find(V=>V.id===Te)).filter(Te=>Te!==void 0).sort((Te,V)=>Te.position-V.position);D.set(K.id,pe);}),D},[e.cards,e.columns]);useEffect(()=>{let D=Ae.current;if(!D)return;let K=te=>{let Oe=te.target,De=te.button===1,We=Oe===D||Oe.classList.contains("asakaa-column")&&!Oe.closest(".asakaa-card");(De||te.button===0&&We&&!_.isDragging)&&(te.preventDefault(),J(true),xe.current={x:te.clientX,y:te.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},pe=te=>{if(!re)return;let Oe=te.clientX-xe.current.x,De=te.clientY-xe.current.y;D.scrollLeft=xe.current.scrollLeft-Oe,D.scrollTop=xe.current.scrollTop-De;},Te=()=>{re&&(J(false),D.style.cursor="",D.style.userSelect="");},V=()=>{re&&(J(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",K),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",Te),D.addEventListener("mouseleave",V),()=>{D.removeEventListener("mousedown",K),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",Te),D.removeEventListener("mouseleave",V);}},[re,_.isDragging]);let we=useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(K=>typeof K=="string"?K:K.taskId):[]})),[e.cards]),vt=useCallback(D=>{let{active:K}=D,pe=e.cards.find(Te=>Te.id===K.id);pe&&ye({isDragging:true,draggedCardId:pe.id,sourceColumnId:pe.columnId,targetColumnId:pe.columnId});},[e.cards,ye]),gt=useCallback(D=>{let{active:K,over:pe}=D;if(!pe||!e.cards.find(te=>te.id===K.id))return;let V=null;pe.data.current?.type==="column"?V=pe.id:pe.data.current?.type==="card"&&(V=e.cards.find(Oe=>Oe.id===pe.id)?.columnId||null),V&&V!==_.targetColumnId&&ye({..._,targetColumnId:V});},[e.cards,_,ye]),at=useCallback(async D=>{let{active:K,over:pe}=D;if(ye({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!pe)return;let Te=e.cards.find(De=>De.id===K.id);if(!Te)return;let V,te;if(pe.data.current?.type==="column"){V=pe.id;let De=At.get(V)||[];te=hl(De,0);}else {let De=e.cards.find(Ke=>Ke.id===pe.id);if(!De)return;V=De.columnId;let We=At.get(V)||[],Fe=We.findIndex(Ke=>Ke.id===pe.id);te=hl(We,Fe);}let Oe=e.columns.find(De=>De.id===V);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let De=At.get(V)||[];if(Te.columnId!==V&&De.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,Te);return}}(Te.columnId!==V||Te.position!==te)&&await t.onCardMove?.(Te.id,V,te);},[e.cards,e.columns,At,t,ye]),H=useCallback(D=>{B||z(D),a?.(D),C?.(D.id);},[a,C,B]),le=useCallback(D=>{t.onCardUpdate?.(D.id,D),z(D);},[t]);return c?jsx("div",{className:u("asakaa-board",it,n),style:l,children:jsx(Nh,{columnCount:3})}):i?jsx("div",{className:u("asakaa-board",it,n),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(fu,{themeName:Ue,children:[jsxs("div",{className:u("flex h-full overflow-hidden",Z?"flex-row":""),children:[jsxs(DndContext,{sensors:ot,collisionDetection:closestCorners,onDragStart:vt,onDragOver:gt,onDragEnd:at,children:[jsxs("div",{ref:Ae,className:u("asakaa-board",Z?"flex-1":"",it,n),style:{...l,cursor:re?"grabbing":void 0},"data-theme":Ue,children:[e.columns.sort((D,K)=>D.position-K.position).map(D=>{let K=At.get(D.id)||[],pe=!dt.includes(D.id),Te=r?.renderColumnFooter?.(D);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(vn,{column:D,cards:K,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Se?(V,te)=>Se(V,te):void 0,onCardClick:H,onCardUpdate:ee,onColumnRename:t.onColumnUpdate?lt:void 0,onColumnDelete:t.onColumnDelete?de:void 0,isDeletable:pe,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Te]},D.id)}),m]}),jsx(DragOverlay,{children:_.draggedCardId?jsx(go,{card:e.cards.find(D=>D.id===_.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Z]}),!B&&jsx(bo,{task:Je,isOpen:!!Je,onClose:()=>z(null),onCardUpdate:le,theme:Re?"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:we,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:S,onSoldEffortUpdate:X,onTimerStart:O,onTimerStop:$,onTimerDiscard:F,blurFinancials:Y})]})}function Nh({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 Fh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Ph={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Ah={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Lh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ih({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=m=>{l.current&&!l.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,m)=>i.position-m.position).map((i,m)=>jsxs(motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Bh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,c]=useState(null),i=useRef(null);if(useEffect(()=>{let g=y=>{i.current&&!i.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:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,y)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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:l===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Rh({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:l,onExportExcel:c,translations:i,toolbarRightContent:m,toolbarEndContent:d}){let p=r==="dark"?Fh:Ph,g={...o==="es"?Ah:Lh,...i},y=n||l||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(Bh,{theme:p,t:g,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),d,t&&(s?jsx(Ih,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsx(Rh,{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),[l,c]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),c(""),n(false));},[l,e]),m=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(c(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);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:l,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:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),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:l="up"}){let[c,i]=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=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{w.current?.focus();},[]);let S=useCallback(()=>{f(false),v(false),N(false);},[]),X=useCallback(()=>{i(""),d(void 0),g(null),x(null),S(),t();},[t,S]),O=useCallback(()=>{let Y=c.trim();if(!Y)return;let Z=a.find(B=>B.id===p),Se=y||s;e({name:Y,priority:m,assignee:Z||void 0,assigneeId:p,startDate:Se,endDate:Se}),i(""),d(void 0),g(null),x(null),S(),w.current?.focus();},[c,m,p,y,s,a,e,S]),$=useCallback(Y=>{Y.key==="Enter"&&c.trim()&&(Y.preventDefault(),O()),Y.key==="Escape"&&X();},[O,X,c]),F=y||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>S(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:w,type:"text",value:c,onChange:Y=>i(Y.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:$})}),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:Y=>{Y.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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="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:Y=>Y.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(Y=>jsxs("button",{onClick:()=>{d(Y.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===Y.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",Y.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:Y.label})]},Y.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:Y=>{Y.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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="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:Y=>Y.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let Y=new Date,Z=new Date(Y);Z.setDate(Y.getDate()+1);let Se=new Date(Y);Se.setDate(Y.getDate()+((6-Y.getDay()+7)%7||7));let B=new Date(Y);B.setDate(Y.getDate()+((1-Y.getDay()+7)%7||7));let _=new Date(Y);_.setDate(Y.getDate()+14);let ye=new Date(Y);ye.setDate(Y.getDate()+28);let Je=E?"es-ES":"en-US";return [{label:E?"Hoy":"Today",date:Y,display:Y.toLocaleDateString(Je,{weekday:"short"}).slice(0,3)+"."},{label:E?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.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:B,display:E?"lun.":"mon."},{label:E?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(Je,{day:"numeric",month:"short"})},{label:E?"4 semanas":"4 weeks",date:ye,display:ye.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(Y=>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:Y},Y))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Y=T.getFullYear(),Z=T.getMonth(),Se=new Date(Y,Z,1).getDay(),B=new Date(Y,Z+1,0).getDate(),_=new Date(Y,Z,0).getDate(),ye=new Date().toDateString(),Je=[];for(let re=Se-1;re>=0;re--)Je.push({dayNum:_-re,isCurrent:false,date:new Date(Y,Z-1,_-re)});for(let re=1;re<=B;re++)Je.push({dayNum:re,isCurrent:true,date:new Date(Y,Z,re)});let z=42-Je.length;for(let re=1;re<=z;re++)Je.push({dayNum:re,isCurrent:false,date:new Date(Y,Z+1,re)});return Je.map((re,J)=>{let Ae=re.date.toDateString()===ye,xe=(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"),Ae&&"ring-1 ring-[#007FFF]",xe&&"bg-[#007FFF] text-white",!xe&&(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:Y=>{Y.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(Y=>Y.id===p)?.color||"#007FFF"},children:a.find(Y=>Y.id===p)?.initials||a.find(Y=>Y.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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="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:Y=>Y.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(Y=>jsxs("button",{type:"button",onClick:()=>{g(Y.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===Y.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:Y.color||"#007FFF"},children:Y.initials||Y.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:Y.name})]},Y.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:l="es"}){let[c,i]=useState(false),m=useRef(null),d=useRef(null),[p,g]=useState({}),[y,x]=useState(false),h=n==="dark",b={buttonLabel:o||(l==="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)&&i(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:()=>i(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),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:v,onCancel:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var is=class extends BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(Fo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
19
- `)}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 xp(e={}){return new is(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 jl(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:l,onOpenAIUsage:c,shortcut:i="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===i&&(E.preventDefault(),p(I=>!I)),E.key==="Escape"&&(p(false),h("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),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":l?.(),N();break;case "ai-usage":c?.(),N();break;case "back":h("home");break;}},[g,v,t,a,r,o,s,n,l,c,N]),k=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),N());},[f,g,t,N]);return d?jsx(Qt,{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 kp(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:yt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",A?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsx("div",{className:"space-y-4",children:[...y].sort((E,fe)=>{let je=typeof E.createdAt=="string"?new Date(E.createdAt):E.createdAt,tt=typeof fe.createdAt=="string"?new Date(fe.createdAt):fe.createdAt;return je.getTime()-tt.getTime()}).map(E=>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:E.user?.color||"#8B5CF6"},children:E.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",A?"text-white":"text-gray-900"),children:E.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:_e(E.createdAt)})]}),jsx("div",{className:u("text-sm",A?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Wu,{content:E.content,theme:s})}),E.attachments&&E.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:E.attachments.map(fe=>{let je=fe.type.startsWith("image/");return jsxs("a",{href:fe.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[je?jsx(Image,{className:u("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",A?"text-white":"text-gray-900"),children:fe.name})]},fe.id)})})]})]},E.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",A?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",A?"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",A?"border-white/10":"border-gray-200"),children:jsx(Uu,{value:Fe,onChange:Ge,onSubmit:Y,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:ht,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:gt,onFilesSelect:L,onRemoveFile:j})})]})]})]})})}function Rl(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Fo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:p,availableTags:d=[],onCreateTag:m,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:F,onLogTime:I,onUpdateEstimate:S,onUpdateSoldEffort:X,onStartTimer:O,onStopTimer:$,onDiscardTimer:A,blurFinancials:q=false,sidePanel:Z,renderColumnMetrics:Ee,suppressDetailModal:B=false}){let[_,he]=Rl(),[Ye,z]=useState(null),[re,J]=useState(false),Le=useRef(null),we=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Oe=o?.theme||"dark",Be=Oe==="dark"||Oe==="neutral",lt=Be?"dark":"",ee=useCallback((D,K)=>{t.onCardUpdate?.(D,K);},[t]),ct=useCallback((D,K)=>{t.onColumnUpdate?.(D,{title:K});},[t]),pe=useCallback(D=>{t.onColumnDelete?.(D);},[t]),et=["todo","in-progress","completed"],nt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Ut=useMemo(()=>{let D=new Map;return e.columns.forEach(K=>{let ce=K.cardIds.map(Te=>e.cards.find(V=>V.id===Te)).filter(Te=>Te!==void 0).sort((Te,V)=>Te.position-V.position);D.set(K.id,ce);}),D},[e.cards,e.columns]);useEffect(()=>{let D=Le.current;if(!D)return;let K=te=>{let $e=te.target,Ne=te.button===1,He=$e===D||$e.classList.contains("asakaa-column")&&!$e.closest(".asakaa-card");(Ne||te.button===0&&He&&!_.isDragging)&&(te.preventDefault(),J(true),we.current={x:te.clientX,y:te.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},ce=te=>{if(!re)return;let $e=te.clientX-we.current.x,Ne=te.clientY-we.current.y;D.scrollLeft=we.current.scrollLeft-$e,D.scrollTop=we.current.scrollTop-Ne;},Te=()=>{re&&(J(false),D.style.cursor="",D.style.userSelect="");},V=()=>{re&&(J(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",K),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",Te),D.addEventListener("mouseleave",V),()=>{D.removeEventListener("mousedown",K),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",Te),D.removeEventListener("mouseleave",V);}},[re,_.isDragging]);let Ce=useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(K=>typeof K=="string"?K:K.taskId):[]})),[e.cards]),mt=useCallback(D=>{let{active:K}=D,ce=e.cards.find(Te=>Te.id===K.id);ce&&he({isDragging:true,draggedCardId:ce.id,sourceColumnId:ce.columnId,targetColumnId:ce.columnId});},[e.cards,he]),Dt=useCallback(D=>{let{active:K,over:ce}=D;if(!ce||!e.cards.find(te=>te.id===K.id))return;let V=null;ce.data.current?.type==="column"?V=ce.id:ce.data.current?.type==="card"&&(V=e.cards.find($e=>$e.id===ce.id)?.columnId||null),V&&V!==_.targetColumnId&&he({..._,targetColumnId:V});},[e.cards,_,he]),Xe=useCallback(async D=>{let{active:K,over:ce}=D;if(he({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ce)return;let Te=e.cards.find(Ne=>Ne.id===K.id);if(!Te)return;let V,te;if(ce.data.current?.type==="column"){V=ce.id;let Ne=Ut.get(V)||[];te=yl(Ne,0);}else {let Ne=e.cards.find(Ge=>Ge.id===ce.id);if(!Ne)return;V=Ne.columnId;let He=Ut.get(V)||[],Fe=He.findIndex(Ge=>Ge.id===ce.id);te=yl(He,Fe);}let $e=e.columns.find(Ne=>Ne.id===V);if($e&&$e.wipLimit&&$e.wipLimitType==="hard"){let Ne=Ut.get(V)||[];if(Te.columnId!==V&&Ne.length>=$e.wipLimit){t.onWipLimitExceeded?.($e,Te);return}}(Te.columnId!==V||Te.position!==te)&&await t.onCardMove?.(Te.id,V,te);},[e.cards,e.columns,Ut,t,he]),H=useCallback(D=>{B||z(D),a?.(D),C?.(D.id);},[a,C,B]),ne=useCallback(D=>{t.onCardUpdate?.(D.id,D),z(D);},[t]);return c?jsx("div",{className:u("asakaa-board",lt,n),style:l,children:jsx(Dh,{columnCount:3})}):i?jsx("div",{className:u("asakaa-board",lt,n),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(bu,{themeName:Oe,children:[jsxs("div",{className:u("flex h-full overflow-hidden",Z?"flex-row":""),children:[jsxs(DndContext,{sensors:nt,collisionDetection:closestCorners,onDragStart:mt,onDragOver:Dt,onDragEnd:Xe,children:[jsxs("div",{ref:Le,className:u("asakaa-board",Z?"flex-1":"",lt,n),style:{...l,cursor:re?"grabbing":void 0},"data-theme":Oe,children:[e.columns.sort((D,K)=>D.position-K.position).map(D=>{let K=Ut.get(D.id)||[],ce=!et.includes(D.id),Te=r?.renderColumnFooter?.(D);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(wn,{column:D,cards:K,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Ee?(V,te)=>Ee(V,te):void 0,onCardClick:H,onCardUpdate:ee,onColumnRename:t.onColumnUpdate?ct:void 0,onColumnDelete:t.onColumnDelete?pe:void 0,isDeletable:ce,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Te]},D.id)}),p]}),jsx(DragOverlay,{children:_.draggedCardId?jsx(go,{card:e.cards.find(D=>D.id===_.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Z]}),!B&&jsx(bo,{task:Ye,isOpen:!!Ye,onClose:()=>z(null),onCardUpdate:ne,theme:Be?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:m,attachments:Ye?g?.get(Ye.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:Ce,comments:h,onAddComment:f,currentUser:b,mentionableUsers:v,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:w,isTimerRunning:F?.isRunning,timerElapsedSeconds:F?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:S,onSoldEffortUpdate:X,onTimerStart:O,onTimerStop:$,onTimerDiscard:A,blurFinancials:q})]})}function Dh({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var Ph={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Ah={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)"},Lh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ih={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Bh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,p)=>i.position-p.position).map((i,p)=>jsxs(motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Rh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,c]=useState(null),i=useRef(null);if(useEffect(()=>{let g=y=>{i.current&&!i.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),m=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:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,y)=>jsxs(motion.button,{onClick:()=>m(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom: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:l===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Oh({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 $l({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:p,toolbarEndContent:d}){let m=r==="dark"?Ph:Ah,g={...o==="es"?Lh:Ih,...i},y=n||l||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[p,jsx("div",{className:"w-px h-5",style:{backgroundColor:m.borderLight}})]}),y&&jsxs(Fragment,{children:[jsx(Rh,{theme:m,t:g,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),d,t&&(s?jsx(Bh,{columns:e,onSelect:t,theme:m,t:g,createTaskLabel:a}):jsx(Oh,{onClick:()=>t(),label:a||g.newTask}))]})})}function zl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[l,c]=useState(""),i=useCallback(()=>{let m=l.trim();m&&(e(m),c(""),n(false));},[l,e]),p=useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(c(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);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:l,onChange:m=>c(m.target.value),onKeyDown:p,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{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:l="up"}){let[c,i]=useState(""),[p,d]=useState(void 0),[m,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),F=o==="es",I=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{w.current?.focus();},[]);let S=useCallback(()=>{f(false),v(false),N(false);},[]),X=useCallback(()=>{i(""),d(void 0),g(null),x(null),S(),t();},[t,S]),O=useCallback(()=>{let q=c.trim();if(!q)return;let Z=a.find(B=>B.id===m),Ee=y||s;e({name:q,priority:p,assignee:Z||void 0,assigneeId:m,startDate:Ee,endDate:Ee}),i(""),d(void 0),g(null),x(null),S(),w.current?.focus();},[c,p,m,y,s,a,e,S]),$=useCallback(q=>{q.key==="Enter"&&c.trim()&&(q.preventDefault(),O()),q.key==="Escape"&&X();},[O,X,c]),A=y||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>S(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:w,type:"text",value:c,onChange:q=>i(q.target.value),placeholder:F?"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:$})}),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",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className: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:F?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:F?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:F?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:F?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:F?"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",p===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"}),A.toLocaleDateString(F?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:C&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className: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,Z=new Date(q);Z.setDate(q.getDate()+1);let Ee=new Date(q);Ee.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let B=new Date(q);B.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let _=new Date(q);_.setDate(q.getDate()+14);let he=new Date(q);he.setDate(q.getDate()+28);let Ye=F?"es-ES":"en-US";return [{label:F?"Hoy":"Today",date:q,display:q.toLocaleDateString(Ye,{weekday:"short"}).slice(0,3)+"."},{label:F?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.toLocaleDateString(Ye,{weekday:"short"}).slice(0,3)+"."},{label:F?"Este fin de semana":"This weekend",date:Ee,display:F?"s\xE1b.":"sat."},{label:F?"Pr\xF3xima semana":"Next week",date:B,display:F?"lun.":"mon."},{label:F?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(Ye,{day:"numeric",month:"short"})},{label:F?"4 semanas":"4 weeks",date:he,display:he.toLocaleDateString(Ye,{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(F?"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:F?"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:(F?["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(),Z=T.getMonth(),Ee=new Date(q,Z,1).getDay(),B=new Date(q,Z+1,0).getDate(),_=new Date(q,Z,0).getDate(),he=new Date().toDateString(),Ye=[];for(let re=Ee-1;re>=0;re--)Ye.push({dayNum:_-re,isCurrent:false,date:new Date(q,Z-1,_-re)});for(let re=1;re<=B;re++)Ye.push({dayNum:re,isCurrent:true,date:new Date(q,Z,re)});let z=42-Ye.length;for(let re=1;re<=z;re++)Ye.push({dayNum:re,isCurrent:false,date:new Date(q,Z+1,re)});return Ye.map((re,J)=>{let Le=re.date.toDateString()===he,we=(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"),Le&&"ring-1 ring-[#007FFF]",we&&"bg-[#007FFF] text-white",!we&&(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",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(q=>q.id===m)?.color||"#007FFF"},children:a.find(q=>q.id===m)?.initials||a.find(q=>q.id===m)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className: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",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:F?"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",m===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:q.color||"#007FFF"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.name})]},q.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:F?"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:F?"Guardar":"Save"})]})]})}function jl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[c,i]=useState(false),p=useRef(null),d=useRef(null),[m,g]=useState({}),[y,x]=useState(false),h=n==="dark",b={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!p.current)return;let C=90,N=()=>{let T=p.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)&&p.current&&!p.current.contains(T)&&i(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:p,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>i(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),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:m,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:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var is=class extends BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(Fo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
19
+ `)}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 vp(e={}){return new is(e)}var Tn=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(Tn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ql({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:p=""}){let[d,m]=useState(false),[g,y]=useState(""),[x,h]=useState("home"),[f,b]=useState(""),[v,C]=useState("");useEffect(()=>{let w=F=>{(F.metaKey||F.ctrlKey)&&F.key===i&&(F.preventDefault(),m(I=>!I)),F.key==="Escape"&&(m(false),h("home"),y(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),useEffect(()=>{d||(h("home"),y(""),b(""),C(""));},[d]);let N=useCallback(()=>{m(false);},[]),T=useCallback(w=>{let[F,I]=w.split(":");switch(F){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":l?.(),N();break;case "ai-usage":c?.(),N();break;case "back":h("home");break;}},[g,v,t,a,r,o,s,n,l,c,N]),k=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),N());},[f,g,t,N]);return d?jsx(Jt,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${p}`,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(F=>jsx("span",{className:"command-palette-item-label",children:F},F))})]},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 F=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:F?.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 Cp(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;
@@ -38,7 +38,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
38
38
  font-size: 12px !important;
39
39
  color: rgba(255, 255, 255, 0.4) !important;
40
40
  pointer-events: none !important;
41
- `;let i=()=>{n.remove(),document.removeEventListener("keydown",m);},m=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let p=r>0?r-1:a.length-1;i(),o(p);}else if(d.key==="ArrowRight"&&a.length>1){let p=r<a.length-1?r+1:0;i(),o(p);}};if(n.onclick=i,document.addEventListener("keydown",m),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
41
+ `;let i=()=>{n.remove(),document.removeEventListener("keydown",p);},p=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let m=r>0?r-1:a.length-1;i(),o(m);}else if(d.key==="ArrowRight"&&a.length>1){let m=r<a.length-1?r+1:0;i(),o(m);}};if(n.onclick=i,document.addEventListener("keydown",p),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
42
42
  position: absolute !important;
43
43
  bottom: 48px !important;
44
44
  left: 50% !important;
@@ -56,7 +56,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
56
56
  border: none !important;
57
57
  padding: 0 !important;
58
58
  cursor: pointer !important;
59
- `,h.onclick=f=>{f.stopPropagation(),i(),o(x);},d.appendChild(h);});let p=document.createElement("button");p.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",p.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',p.style.cssText=`
59
+ `,h.onclick=f=>{f.stopPropagation(),i(),o(x);},d.appendChild(h);});let m=document.createElement("button");m.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",m.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',m.style.cssText=`
60
60
  position: absolute !important;
61
61
  left: 0 !important;
62
62
  top: 0 !important;
@@ -69,7 +69,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
69
69
  border: none !important;
70
70
  cursor: pointer !important;
71
71
  opacity: 0.5 !important;
72
- `,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=y=>{y.stopPropagation();let x=r>0?r-1:a.length-1;i(),o(x);};let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",g.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',g.style.cssText=`
72
+ `,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=y=>{y.stopPropagation();let x=r>0?r-1:a.length-1;i(),o(x);};let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",g.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',g.style.cssText=`
73
73
  position: absolute !important;
74
74
  right: 0 !important;
75
75
  top: 0 !important;
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
82
82
  border: none !important;
83
83
  cursor: pointer !important;
84
84
  opacity: 0.5 !important;
85
- `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;i(),o(x);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Jh(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 Qh(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 io({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[c,i]=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)),S=I.findIndex(O=>O.id===w.id),X=O=>{let $=g.current.filter(Y=>Yl(Y.type)),F=$[O];F&&kp(F.url,F.name,$,O,X);};kp(w.url,w.name,I,S,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(S=>{if(S.size/1048576>r){I.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>S.type.match(O))){I.push(`${S.name} has invalid file type`);return}E.push(S);}),{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){i(true),d(null);try{await t?.(E);}catch(S){d(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[x,t]),f=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(true);},[]),b=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);},[]),v=useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),C=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(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:Qh(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:Jh(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 Xl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],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,S]=useState(false),[X,O]=useState({});if(!t||!e)return null;let $=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]),Y=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),$());},[e.id,o,$]),Z=useCallback(()=>{m&&w.trim()&&(m(e.id,w.trim()),E(""));},[e.id,w,m]),Se=useCallback(async()=>{if(y){S(true);try{let z=await y(e);O(re=>({...re,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{S(false);}}},[e,y]),B=useCallback(async()=>{if(x){S(true);try{let z=await x(e);O(re=>({...re,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{S(false);}}},[e,x]),_=useCallback(async()=>{if(h){S(true);try{let z=await h(e);O(re=>({...re,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{S(false);}}},[e,h]),ye={...e,...T},Je=s.filter(z=>ye.assignedUserIds?.includes(z.id));return jsx(Qt,{children:jsx("div",{className:"card-detail-overlay",onClick:$,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:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsx("input",{type:"text",value:T.title??ye.title,onChange:z=>k({...T,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:ye.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:Y,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:$,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",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.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",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.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??ye.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:ye.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??ye.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??ye.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:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:ye.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:ye.labels&&ye.labels.length>0?ye.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]:ye.startDate?new Date(ye.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:ye.startDate?new Date(ye.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]:ye.endDate?new Date(ye.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:ye.endDate?new Date(ye.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??ye.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:ye.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:ye.dependencies&&ye.dependencies.length>0?ye.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:ye.createdAt?new Date(ye.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:Z,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:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.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(io,{cardId:e.id,attachments:i,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:B,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:_,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(Ae=>Ae.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 ds({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=useState({top:0,left:0}),i=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;i.current&&!i.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(Qt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var ht={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 sy=["LOW","MEDIUM","HIGH","URGENT"],iy=["todo","in-progress","review","done"];function Zl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,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=hn(),I=C||E?.themeName||"dark",[S,X]=useState(e),[O,$]=useState(false),[F,Y]=useState(()=>[...e?.subtasks||[]].sort((j,q)=>(j.position??0)-(q.position??0))),[Z,Se]=useState(false),[B,_]=useState(""),[ye,Je]=useState(""),[z,re]=useState("all"),[J,Ae]=useState(false),[xe,Ue]=useState(false),[Re,it]=useState(false),[ee,lt]=useState(false),[de,dt]=useState(false),[ot,At]=useState(false),we=useRef(null),vt=useRef(null),gt=useRef(null),at=useRef(null),H=useRef(null),le=useRef(null),D=useRef(null),K=useRef(null),pe=useRef(null),Te=useRef(null),V=useRef(null),te=useRef(null);useEffect(()=>{if(e&&!S){X({...e});let L=[...e.subtasks||[]].sort((j,q)=>(j.position??0)-(q.position??0));Y(L);}else if(e&&S&&e.id!==S.id){X({...e});let L=[...e.subtasks||[]].sort((j,q)=>(j.position??0)-(q.position??0));Y(L);}},[e,S]),useEffect(()=>{let L=j=>{let q=j.target;at.current&&!at.current.contains(q)&&Ae(false),H.current&&!H.current.contains(q)&&Ue(false),le.current&&!le.current.contains(q)&&it(false),D.current&&!D.current.contains(q)&&lt(false);};if(J||xe||Re||ee)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[J,xe,Re,ee]),useEffect(()=>{if(!t)return;let L=j=>{let q=j.target,me=q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable;if(j.key==="Escape"){j.preventDefault(),J||xe||Re||ee||de||ot?(Ae(false),Ue(false),it(false),lt(false),dt(false),At(false)):me||a();return}if(me&&j.key!=="Escape")return;let Ne=j.metaKey||j.ctrlKey;switch(j.key.toLowerCase()){case "s":j.preventDefault(),Ae(true);break;case "a":j.preventDefault(),it(true);break;case "p":j.preventDefault(),Ue(true);break;case "l":j.preventDefault(),lt(true);break;case "d":Ne||(j.preventDefault(),dt(true),setTimeout(()=>K.current?.focus(),0));break;case "e":Ne||(j.preventDefault(),At(true));break;case "i":j.preventDefault(),$(true),setTimeout(()=>vt.current?.focus(),0);break;case "t":j.preventDefault(),Se(true);break;case "c":j.preventDefault(),gt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,J,xe,Re,ee,de,ot]);let Oe=useCallback(L=>{let j=L.currentTarget.textContent?.trim()||"";if(S&&j!==S.title){let q={...S,title:j};X(q),r?.(S.id,{title:j});}},[S,r]),De=useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=S?.title||"",L.currentTarget.blur());},[S]),We=useCallback(()=>{S&&e&&S.description!==e.description&&r?.(S.id,{description:S.description}),$(false);},[S,e,r]),Fe=useCallback(L=>{if(S){let j={...S,columnId:L};X(j),r?.(S.id,{columnId:L}),Ae(false);}},[S,r]),Ke=useCallback(L=>{if(S){let j={...S,priority:L};X(j),r?.(S.id,{priority:L}),Ue(false);}},[S,r]),ft=useCallback(L=>{if(S){let j=S.assignedUserIds||[],q=j.includes(L)?j.filter(Ne=>Ne!==L):[...j,L],me={...S,assignedUserIds:q};X(me),r?.(S.id,{assignedUserIds:q});}},[S,r]),ct=useCallback(L=>{if(S){let j=S.labels||[],q=j.includes(L)?j.filter(Ne=>Ne!==L):[...j,L],me={...S,labels:q};X(me),r?.(S.id,{labels:q});}},[S,r]),pt=useCallback(L=>{if(S){let j={...S,tags:L};X(j),r?.(S.id,{tags:L});}},[S,r]),rt=useCallback(L=>{if(S){let j=L.target.value,q={...S,endDate:j};X(q),r?.(S.id,{endDate:j}),dt(false);}},[S,r]),Gt=useCallback(L=>{if(S){let j={...S,estimatedTime:parseFloat(L)||0};X(j),r?.(S.id,{estimatedTime:parseFloat(L)||0});}},[S,r]),Mt=useCallback(()=>{if(B.trim()&&S){let L={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:F.length,createdAt:new Date},j=[...F,L];Y(j),_(""),Se(false),N?.(S.id,j);}},[B,F,S,N]),Dt=useCallback(L=>{let j=F.map(q=>q.id===L?{...q,completed:!q.completed,updatedAt:new Date}:q);Y(j),S&&N?.(S.id,j);},[F,S,N]),wt=useCallback(L=>{let j=F.filter(q=>q.id!==L);Y(j),S&&N?.(S.id,j);},[F,S,N]),bt=useCallback(()=>{ye.trim()&&S&&c&&(c(S.id,ye.trim()),Je(""));},[ye,S,c]),Ut=useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),bt());},[bt]),Ve=L=>jsx(ry,{remarkPlugins:[oy],rehypePlugins:[ny],components:{a:({node:j,...q})=>jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:L}),Le=l.filter(L=>z==="comments"?L.type.includes("COMMENT"):z==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let nt=S||e,oe=s.filter(L=>nt.assignedUserIds?.includes(L.id)),be=F.filter(L=>L.completed).length;return jsx(Qt,{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:we,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Oe,onKeyDown:De,children:nt.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:pe,className:"modal-v2-field",onClick:()=>Ae(!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:nt.columnId||"No status"})]}),jsx(ds,{triggerRef:pe,isOpen:J,onClose:()=>Ae(false),width:250,estimatedHeight:200,children:(y.length>0?y:iy.map(L=>({id:L,title:L}))).map(L=>jsx("button",{className:`modal-v2-popover-item ${nt.columnId===L.id?"active":""}`,onClick:()=>Fe(L.id),children:L.title},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:le,children:[jsxs("button",{ref:Te,className:"modal-v2-field",onClick:()=>it(!Re),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:oe.length>0?jsx("div",{className:"modal-v2-avatars",children:oe.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(ds,{triggerRef:Te,isOpen:Re,onClose:()=>it(false),width:280,estimatedHeight:300,children:s.map(L=>jsxs("button",{className:`modal-v2-popover-item ${nt.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>ft(L.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,nt.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:H,children:[jsxs("button",{ref:V,className:"modal-v2-field",onClick:()=>Ue(!xe),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:nt.priority||"None"})]}),jsxs(ds,{triggerRef:V,isOpen:xe,onClose:()=>Ue(false),width:180,estimatedHeight:220,children:[sy.map(L=>jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${nt.priority===L?"active":""}`,onClick:()=>Ke(L),children:L},L)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ke(""),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(So,{selectedTags:nt.tags||[],availableTags:h,onChange:pt,onCreateTag:f,theme:ht[I]||ht.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>lt(!ee),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:nt.labels&&nt.labels.length>0?jsx("span",{children:nt.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(ds,{triggerRef:te,isOpen:ee,onClose:()=>lt(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxs("button",{className:`modal-v2-popover-item ${nt.labels?.includes(L)?"active":""}`,onClick:()=>ct(L),children:[L,nt.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:()=>{dt(!de),setTimeout(()=>K.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:nt.endDate?new Date(nt.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:K,type:"date",value:typeof nt.endDate=="string"?nt.endDate.split("T")[0]:nt.endDate?(()=>{let L=new Date(nt.endDate),j=L.getUTCFullYear(),q=String(L.getUTCMonth()+1).padStart(2,"0"),me=String(L.getUTCDate()).padStart(2,"0");return `${j}-${q}-${me}`})():"",onChange:rt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>At(!ot),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:nt.estimatedTime?`${nt.estimatedTime}h`:"Not set"})]}),ot&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:nt.estimatedTime||"",onChange:L=>Gt(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>At(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:nt.description||"",onChange:L=>{if(S){let j={...S,description:L.target.value};X(j);}},onBlur:We,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>$(true),children:nt.description?jsx("div",{className:"modal-v2-markdown",children:Ve(nt.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:[be,"/",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:()=>Dt(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:()=>wt(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)),Z&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:L=>_(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Mt(),L.key==="Escape"&&(Se(false),_(""));},onBlur:Mt,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(io,{cardId:nt.id,attachments:T,onUpload:k?L=>k(nt.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:gt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ye,onChange:L=>Je(L.target.value),onKeyDown:Ut,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:bt,disabled:!ye.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Le.map(L=>{let j=s.find(me=>me.id===L.userId);if(L.type.includes("COMMENT")){let me=n.find(Ne=>Ne.id===L.metadata?.commentId);return me?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[j&&jsx("div",{className:"modal-v2-avatar",style:{background:j.color},children:j.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:j?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:me.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:j?.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)}),Le.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function by({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((l,c)=>l+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(by,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function Ny({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,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Ny,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Iy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Pp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function By({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Ap({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,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||Iy[c.name]||Pp[e.indexOf(c)%Pp.length]})),l=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?By:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Ap,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let m=i.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(Ap,{})}),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,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var gi=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[c,i]=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}),l(false);},h=C=>{r.onBulkMove?.(y,C),i(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:()=>l(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(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:()=>i(!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"})})]})]})})});gi.displayName="BulkOperationsToolbar";function zy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;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}`,l=y?.name||`User ${g}`,c=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=p.title,c=p.color,r.has(n)||r.set(n,{id:n,title:l,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}`,l=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,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),l=useMemo(()=>zy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(i=>{n(m=>{let d=new Set(m);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(Fo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let m=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),p={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Fo,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var 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),l=nd.find(i=>i.value===e)||nd[0];useEffect(()=>{function i(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),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:l.icon}),jsx("span",{children:l.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(i=>jsxs("button",{onClick:()=>c(i.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var cs=[{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 Vy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function Op(e={}){let{shortcuts:t=cs,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];},[]),l=useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!s.current)return;let m=i.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Vy(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function jy(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 Ky(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=_y(e),r=t?jy(t):"";return a?`${a} + ${r}`:r}function qy(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=cs,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=qy(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(([l,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:c.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Ky(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var 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:**
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;i(),o(x);},n.appendChild(d),n.appendChild(m),n.appendChild(g);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Qh(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 Zh(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 Xl(e){return e.startsWith("image/")}function so({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[c,i]=useState(false),[p,d]=useState(null),m=useRef(null),g=useRef(e);g.current=e;let y=useCallback((w,F)=>{F.preventDefault(),F.stopPropagation();let I=g.current.filter(O=>Xl(O.type)),S=I.findIndex(O=>O.id===w.id),X=O=>{let $=g.current.filter(q=>Xl(q.type)),A=$[O];A&&Cp(A.url,A.name,$,O,X);};Cp(w.url,w.name,I,S,X);},[]),x=useCallback(w=>{let F=[],I=[];return e.length+w.length>s?(I.push(`Maximum ${s} files allowed`),{valid:F,errors:I}):(w.forEach(S=>{if(S.size/1048576>r){I.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>S.type.match(O))){I.push(`${S.name} has invalid file type`);return}F.push(S);}),{valid:F,errors:I})},[e.length,s,r,o]),h=useCallback(async w=>{let{valid:F,errors:I}=x(w);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(F.length!==0){i(true),d(null);try{await t?.(F);}catch(S){d(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[x,t]),f=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(true);},[]),b=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);},[]),v=useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),C=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);let F=Array.from(w.dataTransfer.files);h(F);},[h]),N=useCallback(w=>{let F=w.target.files?Array.from(w.target.files):[];h(F),m.current&&(m.current.value="");},[h]),T=useCallback(()=>{m.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:m,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"]})]})})]}),p&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(w=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Xl(w.type)&&w.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:F=>y(w,F),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:Zh(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:Qh(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 Jl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:p,onDeleteComment:d,onUploadAttachments:m,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,F]=useState(""),[I,S]=useState(false),[X,O]=useState({});if(!t||!e)return null;let $=useCallback(()=>{N(false),k({}),v("details"),F(""),O({}),a();},[a]),A=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),$());},[e.id,o,$]),Z=useCallback(()=>{p&&w.trim()&&(p(e.id,w.trim()),F(""));},[e.id,w,p]),Ee=useCallback(async()=>{if(y){S(true);try{let z=await y(e);O(re=>({...re,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{S(false);}}},[e,y]),B=useCallback(async()=>{if(x){S(true);try{let z=await x(e);O(re=>({...re,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{S(false);}}},[e,x]),_=useCallback(async()=>{if(h){S(true);try{let z=await h(e);O(re=>({...re,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{S(false);}}},[e,h]),he={...e,...T},Ye=s.filter(z=>he.assignedUserIds?.includes(z.id));return jsx(Jt,{children:jsx("div",{className:"card-detail-overlay",onClick:$,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:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsx("input",{type:"text",value:T.title??he.title,onChange:z=>k({...T,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:he.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[C?jsxs(Fragment,{children:[jsx("button",{onClick:A,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:$,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",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.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",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.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??he.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:he.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??he.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:Ye.length>0?Ye.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??he.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:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:he.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:he.labels&&he.labels.length>0?he.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]:he.startDate?new Date(he.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:he.startDate?new Date(he.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]:he.endDate?new Date(he.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:he.endDate?new Date(he.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??he.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:he.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:he.dependencies&&he.dependencies.length>0?he.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:he.createdAt?new Date(he.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=>F(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:Z,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:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.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(so,{cardId:e.id,attachments:i,onUpload:m?z=>m(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:Ee,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:B,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:_,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(Le=>Le.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 ds({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=useState({top:0,left:0}),i=useRef(null),p=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=m-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(p());},[t,p]),useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(Jt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var ft={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 iy=["LOW","MEDIUM","HIGH","URGENT"],ly=["todo","in-progress","review","done"];function ed({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:p,onAIGenerateDescription:d,onAICreateSubtasks:m,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 F=yn(),I=C||F?.themeName||"dark",[S,X]=useState(e),[O,$]=useState(false),[A,q]=useState(()=>[...e?.subtasks||[]].sort((j,Y)=>(j.position??0)-(Y.position??0))),[Z,Ee]=useState(false),[B,_]=useState(""),[he,Ye]=useState(""),[z,re]=useState("all"),[J,Le]=useState(false),[we,Oe]=useState(false),[Be,lt]=useState(false),[ee,ct]=useState(false),[pe,et]=useState(false),[nt,Ut]=useState(false),Ce=useRef(null),mt=useRef(null),Dt=useRef(null),Xe=useRef(null),H=useRef(null),ne=useRef(null),D=useRef(null),K=useRef(null),ce=useRef(null),Te=useRef(null),V=useRef(null),te=useRef(null);useEffect(()=>{if(e&&!S){X({...e});let L=[...e.subtasks||[]].sort((j,Y)=>(j.position??0)-(Y.position??0));q(L);}else if(e&&S&&e.id!==S.id){X({...e});let L=[...e.subtasks||[]].sort((j,Y)=>(j.position??0)-(Y.position??0));q(L);}},[e,S]),useEffect(()=>{let L=j=>{let Y=j.target;Xe.current&&!Xe.current.contains(Y)&&Le(false),H.current&&!H.current.contains(Y)&&Oe(false),ne.current&&!ne.current.contains(Y)&&lt(false),D.current&&!D.current.contains(Y)&&ct(false);};if(J||we||Be||ee)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[J,we,Be,ee]),useEffect(()=>{if(!t)return;let L=j=>{let Y=j.target,ge=Y.tagName==="INPUT"||Y.tagName==="TEXTAREA"||Y.isContentEditable;if(j.key==="Escape"){j.preventDefault(),J||we||Be||ee||pe||nt?(Le(false),Oe(false),lt(false),ct(false),et(false),Ut(false)):ge||a();return}if(ge&&j.key!=="Escape")return;let De=j.metaKey||j.ctrlKey;switch(j.key.toLowerCase()){case "s":j.preventDefault(),Le(true);break;case "a":j.preventDefault(),lt(true);break;case "p":j.preventDefault(),Oe(true);break;case "l":j.preventDefault(),ct(true);break;case "d":De||(j.preventDefault(),et(true),setTimeout(()=>K.current?.focus(),0));break;case "e":De||(j.preventDefault(),Ut(true));break;case "i":j.preventDefault(),$(true),setTimeout(()=>mt.current?.focus(),0);break;case "t":j.preventDefault(),Ee(true);break;case "c":j.preventDefault(),Dt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,J,we,Be,ee,pe,nt]);let $e=useCallback(L=>{let j=L.currentTarget.textContent?.trim()||"";if(S&&j!==S.title){let Y={...S,title:j};X(Y),r?.(S.id,{title:j});}},[S,r]),Ne=useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=S?.title||"",L.currentTarget.blur());},[S]),He=useCallback(()=>{S&&e&&S.description!==e.description&&r?.(S.id,{description:S.description}),$(false);},[S,e,r]),Fe=useCallback(L=>{if(S){let j={...S,columnId:L};X(j),r?.(S.id,{columnId:L}),Le(false);}},[S,r]),Ge=useCallback(L=>{if(S){let j={...S,priority:L};X(j),r?.(S.id,{priority:L}),Oe(false);}},[S,r]),ht=useCallback(L=>{if(S){let j=S.assignedUserIds||[],Y=j.includes(L)?j.filter(De=>De!==L):[...j,L],ge={...S,assignedUserIds:Y};X(ge),r?.(S.id,{assignedUserIds:Y});}},[S,r]),dt=useCallback(L=>{if(S){let j=S.labels||[],Y=j.includes(L)?j.filter(De=>De!==L):[...j,L],ge={...S,labels:Y};X(ge),r?.(S.id,{labels:Y});}},[S,r]),gt=useCallback(L=>{if(S){let j={...S,tags:L};X(j),r?.(S.id,{tags:L});}},[S,r]),ot=useCallback(L=>{if(S){let j=L.target.value,Y={...S,endDate:j};X(Y),r?.(S.id,{endDate:j}),et(false);}},[S,r]),jt=useCallback(L=>{if(S){let j={...S,estimatedTime:parseFloat(L)||0};X(j),r?.(S.id,{estimatedTime:parseFloat(L)||0});}},[S,r]),Et=useCallback(()=>{if(B.trim()&&S){let L={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:A.length,createdAt:new Date},j=[...A,L];q(j),_(""),Ee(false),N?.(S.id,j);}},[B,A,S,N]),Nt=useCallback(L=>{let j=A.map(Y=>Y.id===L?{...Y,completed:!Y.completed,updatedAt:new Date}:Y);q(j),S&&N?.(S.id,j);},[A,S,N]),Tt=useCallback(L=>{let j=A.filter(Y=>Y.id!==L);q(j),S&&N?.(S.id,j);},[A,S,N]),yt=useCallback(()=>{he.trim()&&S&&c&&(c(S.id,he.trim()),Ye(""));},[he,S,c]),$t=useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),yt());},[yt]),We=L=>jsx(oy,{remarkPlugins:[ny],rehypePlugins:[sy],components:{a:({node:j,...Y})=>jsx("a",{...Y,target:"_blank",rel:"noopener noreferrer"})},children:L}),Re=l.filter(L=>z==="comments"?L.type.includes("COMMENT"):z==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let at=S||e,ie=s.filter(L=>at.assignedUserIds?.includes(L.id)),me=A.filter(L=>L.completed).length;return jsx(Jt,{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:Ce,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:$e,onKeyDown:Ne,children:at.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:Xe,children:[jsxs("button",{ref:ce,className:"modal-v2-field",onClick:()=>Le(!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:at.columnId||"No status"})]}),jsx(ds,{triggerRef:ce,isOpen:J,onClose:()=>Le(false),width:250,estimatedHeight:200,children:(y.length>0?y:ly.map(L=>({id:L,title:L}))).map(L=>jsx("button",{className:`modal-v2-popover-item ${at.columnId===L.id?"active":""}`,onClick:()=>Fe(L.id),children:L.title},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:ne,children:[jsxs("button",{ref:Te,className:"modal-v2-field",onClick:()=>lt(!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:ie.length>0?jsx("div",{className:"modal-v2-avatars",children:ie.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(ds,{triggerRef:Te,isOpen:Be,onClose:()=>lt(false),width:280,estimatedHeight:300,children:s.map(L=>jsxs("button",{className:`modal-v2-popover-item ${at.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>ht(L.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,at.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:H,children:[jsxs("button",{ref:V,className:"modal-v2-field",onClick:()=>Oe(!we),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:at.priority||"None"})]}),jsxs(ds,{triggerRef:V,isOpen:we,onClose:()=>Oe(false),width:180,estimatedHeight:220,children:[iy.map(L=>jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${at.priority===L?"active":""}`,onClick:()=>Ge(L),children:L},L)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ge(""),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(So,{selectedTags:at.tags||[],availableTags:h,onChange:gt,onCreateTag:f,theme:ft[I]||ft.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>ct(!ee),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:at.labels&&at.labels.length>0?jsx("span",{children:at.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(ds,{triggerRef:te,isOpen:ee,onClose:()=>ct(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxs("button",{className:`modal-v2-popover-item ${at.labels?.includes(L)?"active":""}`,onClick:()=>dt(L),children:[L,at.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:()=>{et(!pe),setTimeout(()=>K.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:at.endDate?new Date(at.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:K,type:"date",value:typeof at.endDate=="string"?at.endDate.split("T")[0]:at.endDate?(()=>{let L=new Date(at.endDate),j=L.getUTCFullYear(),Y=String(L.getUTCMonth()+1).padStart(2,"0"),ge=String(L.getUTCDate()).padStart(2,"0");return `${j}-${Y}-${ge}`})():"",onChange:ot,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Ut(!nt),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:at.estimatedTime?`${at.estimatedTime}h`:"Not set"})]}),nt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:at.estimatedTime||"",onChange:L=>jt(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ut(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:at.description||"",onChange:L=>{if(S){let j={...S,description:L.target.value};X(j);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>$(true),children:at.description?jsx("div",{className:"modal-v2-markdown",children:We(at.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"}),A.length>0&&jsxs("span",{className:"modal-v2-count",children:[me,"/",A.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ee(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:[A.map(L=>jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Nt(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)),Z&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:L=>_(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Et(),L.key==="Escape"&&(Ee(false),_(""));},onBlur:Et,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(so,{cardId:at.id,attachments:T,onUpload:k?L=>k(at.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:[p&&jsx("div",{className:"modal-v2-avatar",style:{background:p.color},children:p.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Dt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:he,onChange:L=>Ye(L.target.value),onKeyDown:$t,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:yt,disabled:!he.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Re.map(L=>{let j=s.find(ge=>ge.id===L.userId);if(L.type.includes("COMMENT")){let ge=n.find(De=>De.id===L.metadata?.commentId);return ge?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[j&&jsx("div",{className:"modal-v2-avatar",style:{background:j.color},children:j.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:j?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:ge.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:j?.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)}),Re.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function hy({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 ad({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(hy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function Dy({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 rd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Dy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var By={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Ap=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ry({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Lp({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 od({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||By[c.name]||Ap[e.indexOf(c)%Ap.length]})),l=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?Ry:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Lp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let p=i.payload,d=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.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(Lp,{})}),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,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var gi=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[c,i]=useState(false),[p,d]=useState(false),[m,g]=useState(false);if(e.length===0)return null;let y=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(y,{priority:C}),l(false);},h=C=>{r.onBulkMove?.(y,C),i(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:()=>l(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(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:()=>i(!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(!p),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),p&&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(!m),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),m&&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"})})]})]})})});gi.displayName="BulkOperationsToolbar";function Uy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;switch(t){case "assignee":let p=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);p.length>0?p.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,l=y?.name||`User ${g}`,c=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:l,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}`,l=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,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 nd({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),l=useMemo(()=>Uy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(i=>{n(p=>{let d=new Set(p);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(Fo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let p=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...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(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":p?"Expand lane":"Collapse lane",children:p?"\u25B6":"\u25BC"})]}),!p&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Fo,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var sd=[{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 id({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=sd.find(i=>i.value===e)||sd[0];useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),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:l.icon}),jsx("span",{children:l.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:sd.map(i=>jsxs("button",{onClick:()=>c(i.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var cs=[{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 Gy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function $p(e={}){let{shortcuts:t=cs,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];},[]),l=useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!s.current)return;let p=i.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Gy(i,d)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function _y(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ky(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 qy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ky(e),r=t?_y(t):"";return a?`${a} + ${r}`:r}function Yy(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 ld({shortcuts:e=cs,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Yy(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(([l,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:c.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:qy(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var dd=[{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 dd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},c=e.reduce((i,m)=>{let d=m.category||"Other";return i[d]||(i[d]=[]),i[d].push(m),i},{});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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className: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(([i,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:i})}),jsx("div",{children:m.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ud({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[c,i]=useState("json"),[m,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await lu(e,c,x);du(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await pu(h),b=h.name.endsWith(".json")?"json":"csv",v=uu(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:()=>l("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:()=>l("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:()=>i(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 Zy=["URGENT","HIGH","MEDIUM","LOW"],ex=[{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"}],tx=[{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:l,availableUsers:c=[],availableLabels:i=[],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"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange: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"}),Zy.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))]})}),i.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"}),i.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:ex.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:tx.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:l,onExportGanttCSV:c}){let[i,m]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let p=g=>{g(),m(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>m(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>p(()=>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},bi="dark";var hi=createContext(void 0),ux="asakaa-theme";function zp({children:e,defaultTheme:t=bi,storageKey:a=ux}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=en[r];Object.entries(c.colors).forEach(([m,d])=>{d&&l.style.setProperty(`--theme-${px(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&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:en};return jsx(hi.Provider,{value:n,children:e})}function Sn(){let e=useContext(hi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function px(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 Up(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ht[e]||ht.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ht[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ht[e].bgSecondary),bgGrid:r("--theme-bg-card",ht[e].bgGrid),bgWeekend:r("--theme-bg-hover",ht[e].bgWeekend),border:r("--theme-border-primary",ht[e].border),borderLight:r("--theme-border-subtle",ht[e].borderLight),textPrimary:r("--theme-text-primary",ht[e].textPrimary),textSecondary:r("--theme-text-secondary",ht[e].textSecondary),textTertiary:r("--theme-text-tertiary",ht[e].textTertiary),accent:r("--theme-accent-primary",ht[e].accent),accentHover:r("--theme-accent-hover",ht[e].accentHover),accentLight:r("--theme-accent-primary",ht[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ht[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ht[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ht[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ht[e].dependency),dependencyHover:r("--theme-border-secondary",ht[e].dependencyHover),criticalPath:r("--theme-error",ht[e].criticalPath),criticalPathLight:r("--theme-error",ht[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ht[e].today):e==="neutral"?r("--theme-text-primary",ht[e].today):r("--theme-error",ht[e].today),todayLight:e==="light"?r("--theme-accent-primary",ht[e].todayLight):e==="neutral"?r("--theme-text-primary",ht[e].todayLight):r("--theme-error",ht[e].todayLight),milestone:r("--theme-warning",ht[e].milestone),milestoneLight:r("--theme-warning",ht[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ht[e].statusTodo),statusInProgress:r("--theme-accent-primary",ht[e].statusInProgress),statusCompleted:r("--theme-success",ht[e].statusCompleted),hoverBg:r("--theme-bg-hover",ht[e].hoverBg),focusRing:r("--theme-accent-primary",ht[e].focusRing),...ht[e].dotGrid&&{dotGrid:ht[e].dotGrid},...ht[e].glassHeader&&{glassHeader:ht[e].glassHeader},...ht[e].glassToolbar&&{glassToolbar:ht[e].glassToolbar},...ht[e].forecastHud&&{forecastHud:ht[e].forecastHud},...ht[e].neonRedGlow&&{neonRedGlow:ht[e].neonRedGlow},...ht[e].executionBarBg&&{executionBarBg:ht[e].executionBarBg}}}var yi={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"}},Wp={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:yi,es:Wp};function Vp(e){return yd[e]||yd.en}function xd(e,t){let a=Vp(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(yi);function Br(){return useContext(Mn)}function ms(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),l=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),o}function Qp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=useState(false),[i,m]=useState(null),d=useRef(null),p=useRef(null),g=Br(),y=ms(d,l,"right",176);if(useEffect(()=>{if(!l)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)},[l]),!(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(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref: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:i!==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:i===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 jp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=useState(false),[c,i]=useState(null),[m,d]=useState(false),p=useRef(null),g=useRef(null),y=Br(),x=ms(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)&&l(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){i(N);try{await T();}catch(k){console.error(`Export ${N} failed:`,k);}finally{i(null),l(false);}}},C=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>l(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title: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 Bx({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 Rx({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),l=useRef(null),c=Br(),i=ms(n,o,"left");useEffect(()=>{if(!o)return;let p=g=>{let y=g.target;n.current&&!n.current.contains(y)&&l.current&&!l.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:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children: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 Kp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),c=useRef(null),i=Br(),m=ms(l,s,"left");useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;l.current&&!l.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:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick: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:i.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref: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:i.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:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Ox({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 l=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function $x({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,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,m=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,p=t?.currency||"$",g=d!=null?d>=1e6?`${p}${(d/1e6).toFixed(2)}M`:d>=1e3?`${p}${(d/1e3).toFixed(1)}K`:`${p}${d.toFixed(0)}`:"\u2014",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&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:m,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),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 Hx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:m,hasDependencies:d=true}){let[p,g]=useState(false),y=useRef(null),x=useRef(null),h=Br(),f=ms(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:l,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=i===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 xi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=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:S,onExportJSON:X,onExportMSProject:O,showCriticalPath:$=true,onShowCriticalPathChange:F,showDependencies:Y=true,onShowDependenciesChange:Z,highlightWeekends:Se=true,onHighlightWeekendsChange:B,showBaseline:_=false,onShowBaselineChange:ye,onCopySnapshotLink:Je,hasDependencies:z=true}){let re=Br(),J=w||E||I||S||X||O,Ae=!!e.glassToolbar,[xe,Ue]=useState(false),Re=useRef(null);useEffect(()=>{xe&&Re.current&&Re.current.focus();},[xe]);let it=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.toolbar.month}],ee=[{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"})}],lt=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ae){let de=lt?"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:lt?"#1A1A1A":e.bgSecondary,border:`1px solid ${lt?"rgba(255,255,255,0.08)":e.border}`},animate:{width:xe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Ue(!xe),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"})}),xe&&jsx("input",{ref:Re,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:dt=>{dt.key==="Escape"&&Ue(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:de}}),T&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:lt?"#000000":e.bgSecondary,border:`1px solid ${lt?"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"?lt?"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"?lt?"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(Ox,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:de}}),v&&jsx(_p,{theme:e,value:b??"all",onChange:v,maxDepth:C}),y&&jsx(Kp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:de}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:de}}),jsx(Hx,{theme:e,showCriticalPath:$,onShowCriticalPathChange:F,showBaseline:_,onShowBaselineChange:ye,highlightWeekends:Se,onHighlightWeekendsChange:B,showDependencies:Y,onShowDependenciesChange:Z,rowDensity:l,onRowDensityChange:c,hasDependencies:z}),jsx(jp,{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 ${lt?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${lt?"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($x,{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(Rx,{options:it,value:t,onChange:de=>a(de),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(Kp,{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||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(jp,{theme:e,onExportPNG:w,onExportPDF:E,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Je}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(Bx,{options:ee,value:s,onChange:de=>n(de),theme:e})]})]})}function vi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let m=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let i=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(Qt,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(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),[l,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 i=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:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(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 ca={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 nm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,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(),l(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(),i(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,l,c,i,m,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[p,b]),{setIsEditing:y}}function im(){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]),l=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]),i=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,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((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Ln(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ln(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}},l=(p,g,y)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,y)}:x),c=new Set(t),{tasks:i,removed:m}=n(e,c),d=l(i,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=(i,m,d)=>{for(let p=0;p<i.length;p++){let g=i[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},l=(i,m,d)=>{let p=i.findIndex(g=>g.id===m);if(p!==-1)return i.splice(p+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,m,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(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,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,c))return true;return false}let m=c==="up"?i-1:i+1;return m<0||m>=n.length?false:([n[i],n[m]]=[n[m],n[i]],n[i]={...n[i],position:i},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 fs(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((m,d)=>({...m,id:`${m.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let m=c[i],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(i+1,0,p),p},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function lm(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let m=a==="above"?i:i+1;return c.splice(m,0,n),true};return l(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,l=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},i=c(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=p=>p.map(g=>{if(g.id===t){let 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 dm(e,t,a,r){if(t===a)return e;let o=Ln(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===i||l(m,i))return true;return false};if(l(o,a))return e}let s=l=>{let c=l.filter(m=>m.id!==t),i=c.length<l.length;return c.map((m,d)=>{let p=i?{...m,position:d}:m;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let m=i.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 {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(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((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ki({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,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 S=useContext(Mn),[X,O]=useState(null),[$,F]=useState(null),[Y,Z]=useState(""),Se=useRef(null),[B,_]=useState(null),[ye,Je]=useState(0),[z,re]=useState(0),[J,Ae]=useState({isOpen:false,x:0,y:0,type:"header"}),[xe,Ue]=useState(null),[Re,it]=useState(null),[ee,lt]=useState(null),de=useRef(0),dt=5,ot=useRef(false),[At,we]=useState(null),[vt,gt]=useState(false),at=useRef(null),[H,le]=useState(null),[D,K]=useState(false),pe=useRef(null);useEffect(()=>{function oe(be){pe.current&&!pe.current.contains(be.target)&&K(false);}if(D)return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[D]),useEffect(()=>{$&&Se.current&&(Se.current.focus(),Se.current.select());},[$]),useEffect(()=>{if(!B)return;let oe=L=>{let j=L.clientX-ye,q=z+j;p?.(B,q);},be=()=>{_(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",oe),document.addEventListener("mouseup",be),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",be),document.body.style.cursor="",document.body.style.userSelect="";}},[B,ye,z,p]);let{selectedTaskIds:Te,handleTaskClick:V,isTaskSelected:te}=im(),{setIsEditing:Oe}=nm({tasks:e,selectedTaskIds:Te,onTaskSelect:(oe,be)=>{let j=An(e).map(q=>q.id);V(oe,j,be||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:oe=>{let be=An(e).find(L=>L.id===oe);be&&ct(be);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:oe=>{let be=An(e).find(L=>L.id===oe);be&&T&&T(be);},enableKeyboard:true}),De=(oe,be=0,L="")=>{let j=[],q=[...oe].sort((me,Ne)=>(me.position??0)-(Ne.position??0));for(let me=0;me<q.length;me++){let Ne=q[me],Xe=me+1,_e=L?`${L}.${Xe}`:`${Xe}.0`;if(Ne.wbsCode=_e,j.push({task:Ne,level:be}),Ne.subtasks&&Ne.subtasks.length>0&&Ne.isExpanded){let $e=L?`${L}.${Xe}`:`${Xe}`;j.push(...De(Ne.subtasks,be+1,$e));}}return j},We=De(e),Fe=48,Ke=Math.max(We.length*a,600-Fe),ft=oe=>!oe.startDate||!oe.endDate?"-":`${Math.ceil((oe.endDate.getTime()-oe.startDate.getTime())/(1e3*60*60*24))}d`,ct=oe=>{F(oe.id),Z(oe.name),Oe(true);},pt=oe=>{Y.trim()&&Y!==e.find(be=>be.id===oe)?.name&&C?.(oe,Y.trim()),F(null),Z(""),Oe(false);},rt=()=>{F(null),Z(""),Oe(false);},Gt=(oe,be)=>{be.stopPropagation(),N?.(oe.id);},Mt=(oe,be)=>{be.preventDefault(),de.current=be.clientY,Ue(oe),ot.current=false,gt(false),we({x:be.clientX,y:be.clientY});},Dt=oe=>{if(!xe||(Math.abs(oe.clientY-de.current)>dt&&!ot.current&&(ot.current=true,gt(true)),we({x:oe.clientX,y:oe.clientY}),!ot.current))return;if(E?.current){let me=E.current,Ne=me.getBoundingClientRect(),Xe=60,_e=12;at.current&&(cancelAnimationFrame(at.current),at.current=null);let $e=oe.clientY-Ne.top,kt=Ne.bottom-oe.clientY;if($e<Xe&&me.scrollTop>0){let mt=Math.round(_e*(1-$e/Xe)),Wt=()=>{me.scrollTop-=mt,ot.current&&me.scrollTop>0&&(at.current=requestAnimationFrame(Wt));};at.current=requestAnimationFrame(Wt);}else if(kt<Xe&&me.scrollTop<me.scrollHeight-me.clientHeight){let mt=Math.round(_e*(1-kt/Xe)),Wt=()=>{me.scrollTop+=mt,ot.current&&me.scrollTop<me.scrollHeight-me.clientHeight&&(at.current=requestAnimationFrame(Wt));};at.current=requestAnimationFrame(Wt);}}let L=document.querySelectorAll("[data-task-row]"),j=null,q=null;L.forEach(me=>{let Ne=me.getBoundingClientRect(),Xe=me.getAttribute("data-task-row");if(Xe&&Xe!==xe&&oe.clientY>=Ne.top&&oe.clientY<=Ne.bottom){j=Xe;let _e=oe.clientY-Ne.top,$e=Ne.height;_e<$e*.25?q="above":_e>$e*.75?q="below":q="child";}}),it(j),lt(q);},wt=()=>{if(ot.current&&xe&&Re&&ee){if(ee==="child")w?.(xe,Re);else if(ee==="above"||ee==="below"){let oe=(q,me,Ne=null)=>{for(let Xe of q){if(Xe.id===me)return Ne;if(Xe.subtasks){let _e=oe(Xe.subtasks,me,Xe.id);if(_e!==void 0)return _e}}},be=oe(e,xe,null),L=oe(e,Re,null),j=(q,me,Ne,Xe)=>{let _e=q.findIndex(mt=>mt.id===me),$e=Xe?q.findIndex(mt=>mt.id===Ne):-1,kt=ee==="below"?_e+1:_e;return Xe&&$e!==-1&&$e<_e&&(kt-=1),Math.max(0,kt)};if(L===null){let me=j(e,Re,xe,be===null);w?.(xe,null,me);}else {let q=Ln(e,L);if(q?.subtasks){let me=be===L,Ne=j(q.subtasks,Re,xe,me);w?.(xe,L,Ne);}}}}at.current&&(cancelAnimationFrame(at.current),at.current=null),Ue(null),it(null),lt(null),we(null),ot.current=false,gt(false);};useEffect(()=>{if(xe)return document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",wt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",wt),document.body.style.cursor="",document.body.style.userSelect="";}},[xe,Re,ee]);let bt=(oe,be,L)=>{let j=be.subtasks&&be.subtasks.length>0;switch(oe.id){case "name":let q=$===be.id,me=X===be.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:me?1:.3},onMouseDown:U=>Mt(be.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),be.subtasks&&be.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),c?.(be.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:be.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"}),q?jsx("input",{ref:Se,type:"text",value:Y,onChange:U=>Z(U.target.value),onKeyDown:U=>{U.key==="Enter"?pt(be.id):U.key==="Escape"&&rt();},onBlur:()=>pt(be.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:be.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:be.parentId?"13px":"14px",fontWeight:be.isMilestone?600:be.parentId?400:600,letterSpacing:be.parentId?"0":"-0.01em"},title:be.name,children:[be.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:be.wbsCode}),be.isHighlighted&&be.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:be.name}),be.subtasks&&be.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(be.progress||0),"%"]}),I&&be.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),I&&be.cpmData&&jsxs("span",{style:{color:be.cpmData.totalFloat<=0?"#EF4444":be.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(be.cpmData.totalFloat),"d"]})]}),me&&!q&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>Gt(be,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(),ct(be);},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 Xe=oe.id==="startDate"?"startDate":"endDate",_e=be[Xe],$e=H?.taskId===be.id&&H?.field===Xe,kt=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:j?.5:1,cursor:j?"default":"pointer"},title:j?"Auto-calculated from subtasks":void 0,onClick:U=>{if(!j)if($e)le(null);else {let ne=U.currentTarget.getBoundingClientRect();le({taskId:be.id,field:Xe,month:_e?typeof _e=="string"?new Date(_e):_e: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:kt(_e)}),j&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),$e&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>le(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:H?.position.top,left:H?.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 He=new Date(U);He.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:He},{label:"2 semanas",date:A}].map((je,et)=>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?.(be.id,{[Xe]:je.date}),le(null);},children:je.label},et))})(),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?.(be.id,{[Xe]:void 0}),le(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:()=>le(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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>le(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=H?.month||new Date,ne=U.getFullYear(),He=U.getMonth(),A=new Date(ne,He,1).getDay(),ge=new Date(ne,He+1,0).getDate(),je=new Date,et=[];for(let jt=A-1;jt>=0;jt--)et.push({day:new Date(ne,He,-jt).getDate(),date:new Date(ne,He-1,new Date(ne,He,-jt).getDate()),isCurrentMonth:false});for(let jt=1;jt<=ge;jt++)et.push({day:jt,date:new Date(ne,He,jt),isCurrentMonth:true});let oa=42-et.length;for(let jt=1;jt<=oa;jt++)et.push({day:jt,date:new Date(ne,He+1,jt),isCurrentMonth:false});return et.map((jt,La)=>{let _a=jt.date.toDateString()===je.toDateString(),ma=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===jt.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:jt.isCurrentMonth?ma?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ma?"#2E94FF":"transparent",boxShadow:_a&&!ma?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(be.id,{[Xe]:jt.date}),le(null);},children:jt.day},La)})})()})]})]})]}),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:ft(be)})});case "assignees":if(j)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let mt=r.filter(U=>be.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(qo,{assignedUsers:mt,availableUsers:r,onChange:U=>{let ne=U.map(He=>({id:He.id,name:He.name,initials:He.initials,color:He.color}));g?.(be.id,{assignees:ne.length>0?ne:void 0});}})});case "status":if(j){let U=be.progress===100?"\u2713":be.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(Pu,{status:be.status||"todo",onChange:U=>{g?.(be.id,{status:U,progress:U==="completed"?100:be.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:j?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${be.progress}%`,backgroundColor:be.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:[be.progress,"%"]})]});case "priority":let Wt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ta={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Xt=Wt[be.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(_o,{priority:Xt,onChange:U=>{U&&g?.(be.id,{priority:Ta[U]||"medium"});}})});default:return null}},Ut=oe=>[{id:"hide",label:"Hide Column",icon:ca.Hide,onClick:()=>d(oe),disabled:oe==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ca.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ca.SortDesc,onClick:()=>{}}],Ve=oe=>oe.subtasks&&oe.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{N?.(oe.id);}},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([oe.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(oe.id,oe.name):f?.([oe.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{n?.(oe);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{N?.(oe.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{g?.(oe.id,{status:"todo",progress:0});},disabled:oe.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{g?.(oe.id,{status:"in-progress"});},disabled:oe.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{g?.(oe.id,{status:"completed",progress:100});},disabled:oe.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([oe.id]);}},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(oe.id,oe.name):f?.([oe.id]);}}],Le=m.filter(oe=>oe.visible),nt=Le.reduce((oe,be)=>oe+be.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:nt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Fe}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Le.map((oe,be)=>{let L=be===Le.length-1,j=oe.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j?"":"justify-center"}`,style:{width:`${oe.width}px`,minWidth:`${oe.minWidth??(j?200:60)}px`,maxWidth:`${oe.maxWidth??2e3}px`,flexShrink:j&&Le.length===1?1:0,flexGrow:j&&Le.length===1?1:0,borderRight:L?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:q=>{q.preventDefault(),Ae({isOpen:true,x:q.clientX,y:q.clientY,type:"header",columnId:oe.id});},onMouseEnter:q=>{q.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:q=>{q.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:oe.label,children:oe.label}),oe.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:B===oe.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:q=>{q.preventDefault(),q.stopPropagation(),_(oe.id),Je(q.clientX),re(oe.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:B===oe.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},oe.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(vi,{columns:m,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>K(!D),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),D&&jsxs("div",{ref:pe,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:oe=>oe.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:()=>K(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:Ke},children:We.map(({task:oe,level:be},L)=>{let j=te(oe.id),q=Re===oe.id,me=q&&ee==="above",Ne=q&&ee==="below",Xe=q&&ee==="child",_e={};return Xe&&(_e.backgroundColor=`${t.accent}15`,_e.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":oe.id,className:`flex items-center cursor-pointer group ${xe===oe.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:Xe?`${t.accent}15`:L%2===0?t.bgPrimary:t.bgGrid,opacity:I?oe.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",..._e},onMouseEnter:()=>O(oe.id),onMouseLeave:()=>O(null),onClick:$e=>{let mt=An(e).map(Xt=>Xt.id),Ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?$e.metaKey:$e.ctrlKey;V(oe.id,mt,Ta,$e.shiftKey),s?.(oe);},onDoubleClick:$e=>{$e.stopPropagation(),n?.(oe);},onContextMenu:$e=>{$e.preventDefault(),Ae({isOpen:true,x:$e.clientX,y:$e.clientY,type:"task",task:oe}),l?.(oe,$e);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[me&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ne&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Le.map(($e,kt)=>{let mt=kt===Le.length-1,Wt=$e.id==="name";return jsx("div",{className:`px-4 flex items-center ${Wt?"justify-start":"justify-center"}`,style:{width:`${$e.width}px`,minWidth:`${$e.minWidth??(Wt?200:60)}px`,maxWidth:`${$e.maxWidth??2e3}px`,flexShrink:Wt&&Le.length===1?1:0,flexGrow:Wt&&Le.length===1?1:0,borderRight:mt?"none":`1px solid ${X===oe.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:bt($e,oe,Wt?be:0)},`${oe.id}-${$e.id}`)})]},oe.id)})}),jsx(Pn,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?Ut(J.columnId):J.type==="task"&&J.task?Ve(J.task):[],onClose:()=>Ae({...J,isOpen:false}),theme:t}),vt&&At&&xe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:At.x+12,top:At.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let oe=We.find(be=>be.task.id===xe)?.task;return oe?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:oe.name})}):null})()}),document.body)]})}function gm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[c,i]=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:l,ghostWidth:c,setGhostWidth:i,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:($,F)=>{r("none"),d(null),g(null),l($),i(F),N(0),f(null),v(0);}}}function Ni({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,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=gm(t,r),N=useRef(null),T=useRef(false),k=useRef(null),w=useRef(null),{dragMode:E,setDragMode:I,dragOffset:S,setDragOffset:X,ghostX:O,setGhostX:$,ghostWidth:F,setGhostWidth:Y,connectionLine:Z,setConnectionLine:Se,hoveredTaskId:B,setHoveredTaskId:_,activeZone:ye,setActiveZone:Je,draggedSegmentIndex:z,setDraggedSegmentIndex:re,draggedSegmentStartX:J,setDraggedSegmentStartX:Ae,segmentDragOffsetX:xe,setSegmentDragOffsetX:Ue,hoveredSegmentIndex:Re,setHoveredSegmentIndex:it,isHovered:ee,setIsHovered:lt,isDragging:de,isResizing:dt,isConnecting:ot,resetDragState:At}=C,we=18,vt=!!o.executionBarBg,gt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",at=vt?3:6,H=e.subtasks&&e.subtasks.length>0,le=e.endDate&&(()=>{let L=new Date;L.setHours(0,0,0,0);let j=new Date(e.endDate);return j.setHours(0,0,0,0),j<L})()&&e.progress<100,D=b&&e.isCriticalPath,K=o.name==="neutral"||o.today==="#1C1917",pe=e.status==="completed"||e.progress===100,Te={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=b&&e.isCriticalPath||le?"#EF4444":e.color?e.color:e.priority&&Te[e.priority]?Te[e.priority]:o.taskBarPrimary,Oe=v?"default":de?ot?"crosshair":dt?"ew-resize":"grabbing":"grab",De=v?"default":"ew-resize",Fe=(L=>L>=80?20:L>=60?15:L>=50?12:10)(r),Ke=r<50,ft=r<40;useEffect(()=>{x&&(!ee||de||e.segments)&&x(null);},[ee,de,e.segments,x]);let ct=L=>L.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),pt=()=>{let L=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${L} day${L!==1?"s":""}`},rt=L=>Math.round(L/s)*s,Gt=L=>{let j=Math.round(L/s),q=new Date(n);return q.setDate(q.getDate()+j),q},Mt=(L,j)=>{for(let q of g){if(q.id===e.id)continue;let me=5;if(L>=q.x-me&&L<=q.x+q.width+me&&j>=q.y-me&&j<=q.y+q.height+me)return q.id}return null},Dt=useCallback((L,j,q)=>{if(v)return;L.preventDefault(),L.stopPropagation();let me=N.current?.ownerSVGElement;if(!me)return;let Ne=me.createSVGPoint();Ne.x=L.clientX,Ne.y=L.clientY;let Xe=Ne.matrixTransform(me.getScreenCTM()?.inverse()),_e=q!==void 0?q:t,$e=j;if(!$e){let kt=Xe.x-_e;L.shiftKey?($e="connect",Se({x:t+r,y:a+we/2})):L.ctrlKey||L.metaKey?$e="move":L.altKey?$e=kt<r/2?"resize-start":"resize-end":ft?kt<r/2?$e="move":$e="resize-end":Ke?kt<=Fe/2?$e="resize-start":kt>=r-Fe/2?$e="resize-end":$e="move":kt<=Fe?$e="resize-start":kt>=r-Fe?$e="resize-end":$e="move";}T.current=false,I($e),lt(false),Je(null),$e==="move"?X(Xe.x-_e):$e==="connect"?Se({x:t+r,y:a+we/2}):X(0),$(_e),Y(r);},[t,r,a,we,v]),wt=useCallback(L=>{let j=N.current?.ownerSVGElement;if(!j)return;let q=j.closest(".gantt-timeline-scroll");if(!q)return;let me=q.getBoundingClientRect(),Ne=60,Xe=15,_e=0;if(L.clientX<me.left+Ne){let $e=me.left+Ne-L.clientX;_e=-Math.min(Xe,$e/2);}else if(L.clientX>me.right-Ne){let $e=L.clientX-(me.right-Ne);_e=Math.min(Xe,$e/2);}return _e!==0&&(q.scrollLeft+=_e),_e!==0},[]),bt=useCallback(L=>{if(E==="none")return;T.current=true,w.current=L;let j=N.current?.ownerSVGElement;if(!j)return;if(E==="move"||E==="resize-start"||E==="resize-end"){let Ne=wt(L);Ne&&!k.current?k.current=window.setInterval(()=>{w.current&&(wt(w.current),bt(w.current));},16):!Ne&&k.current&&(window.clearInterval(k.current),k.current=null);}let q=j.createSVGPoint();q.x=L.clientX,q.y=L.clientY;let me=q.matrixTransform(j.getScreenCTM()?.inverse());if(E==="connect"){Se({x:me.x,y:me.y});let Ne=Mt(me.x,me.y);_(Ne);}else if(E==="move"){let Ne=me.x-S,Xe=rt(Ne);$(Xe),Y(r);let _e=Math.round((Xe-t)/s);if(y?.(e.id,_e,true),e.segments&&e.segments.length>0&&z!==null){let $e=Xe-J;Ue($e);}}else if(E==="resize-start"){let Ne=me.x,Xe=rt(Ne),_e=t+r-Xe;_e>=s&&($(Xe),Y(_e));}else if(E==="resize-end"){let Ne=me.x,_e=rt(Ne)-t;_e>=s&&Y(_e);}},[E,t,r,s,S,e,rt,z,J,Mt,_,Se,$,Y,Ue,y,wt]),Ut=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),w.current=null,E!=="none"){if(E==="connect")B&&p&&p(e,B),Se(null),_(null);else {let L=e.endDate.getTime()-e.startDate.getTime(),j,q,me=true;if(E==="move"){if(j=Gt(O),q=new Date(j.getTime()+L),e.segments&&e.segments.length>0&&z!==null){let Ne=Math.round(xe/s),Xe=e.segments.map((mt,Wt)=>{if(Wt===z){let Ta=new Date(mt.startDate),Xt=new Date(mt.endDate);return Ta.setDate(Ta.getDate()+Ne),Xt.setDate(Xt.getDate()+Ne),{startDate:Ta,endDate:Xt}}return mt}),_e=Xe.flatMap(mt=>[mt.startDate,mt.endDate]),$e=new Date(Math.min(..._e.map(mt=>mt.getTime()))),kt=new Date(Math.max(..._e.map(mt=>mt.getTime())));d?.({...e,segments:Xe},$e,kt),At(t,r);return}}else E==="resize-start"?(j=Gt(O),q=e.endDate,j>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),me=false)):E==="resize-end"?(j=e.startDate,q=Gt(O+F),q.setDate(q.getDate()-1),q<j&&(console.warn("Invalid date range: end date must be after or equal to start date"),me=false)):me=false;me&&j&&q&&(q.getTime()<j.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,j,q));}y?.(e.id,0,false),At(t,r);}},[E,O,F,e,d,B,p,t,r,s,Gt,xe,z,At,y]);useEffect(()=>{if(E==="none")return;let L=q=>{bt(q);},j=()=>{Ut();};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",j),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",j),k.current&&(window.clearInterval(k.current),k.current=null);}},[E,bt,Ut]);let Ve=de&&!ot?O:t,Le=de&&!ot?F:r,nt=l.taskClass(e),oe=24,be=b?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:N,"data-task-bar":"true",style:{opacity:be,transition:"opacity 300ms ease"},onClick:()=>{!de&&!T.current&&c?.(e),T.current=false;},onDoubleClick:L=>{!de&&!T.current&&(L.stopPropagation(),i?.(e));},onContextMenu:L=>{L.preventDefault(),m?.(e,L);},onMouseEnter:()=>!de&&lt(true),onMouseMove:L=>{x&&ee&&!de&&!e.segments&&x({task:e,x:t,y:a,width:r,height:we,showBelow:false,mouseX:L.clientX,mouseY:L.clientY});},onMouseLeave:()=>{de||(lt(false),Je(null));},children:[jsx("rect",{x:t,y:a,width:r+oe,height:we,fill:"transparent",style:{pointerEvents:"all"}}),ee&&!de&&!Ke&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Fe,height:we,fill:ye==="resize-start"?o.accent:"transparent",opacity:ye==="resize-start"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>Je("resize-start"),onMouseDown:L=>Dt(L,"resize-start")}),jsx("rect",{x:t+Fe,y:a,width:r-Fe*2,height:we,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Je("move"),onMouseDown:L=>Dt(L,"move")}),jsx("rect",{x:t+r-Fe,y:a,width:Fe,height:we,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>Je("resize-end"),onMouseDown:L=>Dt(L,"resize-end")})]}),ee&&!de&&ft&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:we,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Je("move"),onMouseDown:L=>Dt(L,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:we,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.2:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>Je("resize-end"),onMouseDown:L=>Dt(L,"resize-end")}),ee&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+we-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),de&&!ot&&!e.segments&&jsx(motion.rect,{x:O,y:a,width:F,height:we,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&&!de&&(()=>{let L=e.baselineStartDate.getTime(),j=e.baselineEndDate.getTime(),q=n.getTime(),me=864e5,Ne=(L-q)/me,Xe=(j-L)/me,_e=Ne*s,$e=Math.max(Xe*s,s),kt=Ve+Le,mt=_e+$e,Wt=e.endDate?.getTime()??0,Ta=Math.ceil((Wt-j)/me),Xt=Ta>0,U=Ta<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:_e,y:a,width:$e,height:we,rx:at,fill:"none",stroke:gt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Xt&&kt>mt&&jsx("rect",{x:mt,y:a,width:kt-mt,height:we,rx:0,fill:"#EF4444",opacity:.2}),Xt&&jsxs("text",{x:Math.max(kt,mt)+6,y:a+we/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ta,"d"]}),U&&jsxs("text",{x:kt+6,y:a+we/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ta,"d"]})]})})(),!e.segments&&vt&&H&&(()=>{let j=a+(we-8)/2,q=4,me=e.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Xe=e.startDate&&Ne>=e.startDate,_e=e.endDate&&(()=>{let Xt=new Date(e.endDate);return Xt.setHours(0,0,0,0),Ne>Xt})(),$e=e.startDate&&Ne<e.startDate,kt=1;if(Xe&&e.startDate&&e.endDate&&!$e){let Xt=new Date(e.startDate);Xt.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let ne=Math.max(1,(U.getTime()-Xt.getTime())/(1e3*60*60*24)),A=Math.min((Ne.getTime()-Xt.getTime())/(1e3*60*60*24),ne)/ne*100;kt=A>0?me/A:1;}let mt;me>=100?mt="#00E5CC":$e?mt="#4B5563":_e&&me<100?mt="#EF4444":kt>=.95?mt="#22C55E":kt>=.8?mt="#F59E0B":mt="#EF4444";let Wt=Math.max(me/100*Le,me>0?q*2:0),Ta=Le>100&&me>0;return jsxs("g",{"data-task-class":nt,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Ve,y:j,width:Le,height:8,rx:q,fill:"rgba(255,255,255,0.10)"}),me>0&&jsx("rect",{x:Ve,y:j,width:Wt,height:8,rx:q,fill:mt}),Ta&&jsxs("text",{x:Ve+Wt+6,y:j+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(me),"%"]})]})})(),!e.segments&&vt&&!H&&jsx(motion.rect,{x:Ve,y:a,width:Le,height:we,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":nt,initial:{opacity:0,scale:.95},animate:{opacity:de&&!ot?.15:e.parentId?.6:1,scale:ee&&!de?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:L=>Dt(L),style:{cursor:Oe,pointerEvents:"all"}}),!e.segments&&!vt&&jsx(motion.rect,{x:Ve,y:a,width:Le,height:we,rx:at,fill:te,"data-task-class":nt,initial:{opacity:0,scale:.95},animate:{opacity:de&&!ot?.15:e.parentId?.6:ee?.9:.8,scale:ee&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:L=>Dt(L),style:{cursor:H?"default":Oe,pointerEvents:"all"}}),vt&&(le||D)&&!e.segments&&jsx("rect",{x:Ve,y:a,width:Le,height:we,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&&!H&&jsx("rect",{x:Ve,y:a,width:Math.max(Le*(e.progress/100),at*2),height:we,rx:at,fill:te,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let L=e.progress>0?Le*(e.progress/100):0,j=Ve+L,q=Le-L,me=e.progress===0?at:0,Ne=e.progress===0?Ve:j,Xe=e.progress===0?Le:q;return jsxs(Fragment,{children:[jsx("rect",{x:Ne,y:a,width:Xe,height:we,rx:me,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Ne,y:a,width:Xe,height:we,rx:me,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),vt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!de&&(()=>{let L=Ve+Le*(e.progress/100),j=8,q=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:L,cy:a+we/2,r:j,fill:q?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:L,y:a+we/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:q?.initials||q?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((L,j)=>{let q=(L.startDate.getTime()-n.getTime())/864e5*s,Ne=(L.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,Xe=de&&E==="move"&&z===j,_e=Re===j,$e=Xe?q+xe:q;return jsxs("g",{onMouseEnter:()=>!de&&it(j),onMouseLeave:()=>!de&&it(null),children:[jsx(motion.rect,{x:$e,y:a,width:Ne,height:we,rx:at,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:Xe||e.parentId?.6:_e?.9:.8,scale:_e&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:kt=>{kt.stopPropagation(),re(j),Ae(q),Dt(kt,void 0,q);},style:{cursor:Oe,pointerEvents:"all"}}),jsx("rect",{x:$e,y:a,width:Ne*(e.progress/100),height:we,rx:at,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${j}`)}),K&&(le||D)&&!e.segments&&jsxs(Fragment,{children:[D&&!le&&jsx("rect",{x:Ve,y:a,width:Le,height:we,rx:at,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),le&&jsx("rect",{x:Ve,y:a,width:Le,height:we,rx:at,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Le>60&&!e.segments&&!(vt&&H)&&(()=>{let L=l.taskLabel(e),j=typeof L=="string"?L:e.name,q=j.length>Math.floor(Le/8)?`${j.substring(0,Math.floor(Le/8))}...`:j;return jsx("text",{x:Ve+8,y:a+we/2,dominantBaseline:"middle",fill:pe?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pe?"line-through":"none"},children:q})})(),!de&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(vt?jsxs("text",{x:Ve+Le+6,y:a+we/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Le>100?jsxs("text",{x:Ve+Le-12,y:a+we/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&&Le>80&&!de&&!e.segments&&!(vt&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ve+Le-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ve+Le-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ee||dt)&&!ot&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ve-2,y:a,width:16,height:we,fill:"transparent",style:{cursor:De},onMouseEnter:()=>Je("resize-start"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),Dt(L,"resize-start");}}),jsx(motion.rect,{x:Ve+4,y:a+8,width:3,height:we-16,rx:1.5,fill:ye==="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:Ve+Le-14,y:a,width:16,height:we,fill:"transparent",style:{cursor:De},onMouseEnter:()=>Je("resize-end"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),Dt(L,"resize-end");}}),jsx(motion.rect,{x:Ve+Le-7,y:a+8,width:3,height:we-16,rx:1.5,fill:ye==="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:ee&&!de&&!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+we/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Je("connect"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),Dt(L,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+we/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ye==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ot&&Z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+we/2,x2:Z.x,y2:Z.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Z.x,cy:Z.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsx(motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(ee||de)&&!ot&&!e.segments&&jsx(motion.rect,{x:Ve-1,y:a-1,width:Le+2,height:we+2,rx:at+1,fill:"none",stroke:de?o.accent:vt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:vt?1:2,opacity:de||vt?.6:.4,initial:{opacity:0},animate:{opacity:de||vt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),dt&&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:ee&&!de&&!e.segments&&!x&&(()=>{let q=a<100,me=q?a+we+13:a-82-13,Ne=q?`M ${Ve+Le/2-6} ${a+we+3} L ${Ve+Le/2} ${a+we+13} L ${Ve+Le/2+6} ${a+we+3}`:`M ${Ve+Le/2-6} ${a-13} L ${Ve+Le/2} ${a-3} L ${Ve+Le/2+6} ${a-13}`,Xe=me+22,_e=me+40,$e=me+55,kt=me+70,mt=q?me+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Ve+Le/2-120,y:me,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:Ve+Le/2,y:Xe,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:Ve+Le/2-110,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ve+Le/2-70,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ct(e.startDate)}),jsx("text",{x:Ve+Le/2-110,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ve+Le/2-70,y:$e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ct(e.endDate)}),jsx("text",{x:Ve+Le/2+10,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ve+Le/2+65,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pt()}),jsx("text",{x:Ve+Le/2+10,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ve+Le/2+65,y:$e,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:Ve+Le/2-110,y:kt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ve+Le/2-50,y:kt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Wt=>Wt.name).join(", ").substring(0,30),e.assignees.map(Wt=>Wt.name).join(", ").length>30?"...":""]})]}),!q&&jsx("text",{x:Ve+Le/2,y:mt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ft?"Left: move \u2022 Right: resize":Ke?"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,In=8,hm=16,Dv=-12;function ym({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,N=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null,T=b.lastActivity!=null,k=(N?155:105)+(T?28:0),w=v+hm,E=C+Dv-k;w+Ad>window.innerWidth-In&&(w=v-Ad-hm),w<In&&(w=In);let I=E<In;I&&(E=C+20),E+k>window.innerHeight-In&&(E=window.innerHeight-In-k),o({left:w,top:E,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{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: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(Di,{label:l.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:p}),jsx(Di,{label:l.duration,value:i(),labelColor:d,valueColor:p}),jsx(Di,{label:l.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:p}),jsx(Di,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:p})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:s.assignees.map(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:[l.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsx("span",{style:{color:y,fontWeight:600},children:m(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.soldEffortMinutes)})]})]}),s.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:p},children:s.lastActivity.userName})," ",jsx("span",{children:s.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:s.lastActivity.relativeTime})]})]}),jsx("style",{children:`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function cd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(p){s.current&&!s.current.contains(p.target)&&n.current&&!n.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},c=e.reduce((i,p)=>{let d=p.category||"Other";return i[d]||(i[d]=[]),i[d].push(p),i},{});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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className: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(([i,p])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:p.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function pd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[c,i]=useState("json"),[p,d]=useState(null),m=useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await du(e,c,x);cu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await mu(h),b=h.name.endsWith(".json")?"json":"csv",v=pu(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"}`]});}m.current&&(m.current.value="");}};return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("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:()=>l("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:()=>i(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:m,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxs("div",{className:u("p-4 rounded-lg",p.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",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:p.errors.map((x,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var ex=["URGENT","HIGH","MEDIUM","LOW"],tx=[{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"}],ax=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function md({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:p=[],showQuickFilters:d=true,compact:m=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 ${m?"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"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange: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"}),ex.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))]})}),i.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"}),i.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:tx.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:ax.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 gd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,p]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&p(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),p(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>p(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>m(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>m(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>m(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>m(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>m(()=>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:()=>m(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>m(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var fd={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"}},bd={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"}},hd={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"}},tn={dark:fd,light:bd,neutral:hd},bi="dark";var hi=createContext(void 0),px="asakaa-theme";function Up({children:e,defaultTheme:t=bi,storageKey:a=px}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=tn[r];Object.entries(c.colors).forEach(([p,d])=>{d&&l.style.setProperty(`--theme-${mx(p)}`,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(([p,d])=>{let m=c.colors[p];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:tn};return jsx(hi.Provider,{value:n,children:e})}function En(){let e=useContext(hi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function mx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function yd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=En();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(tn).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 Wp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ft[e]||ft.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ft[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ft[e].bgSecondary),bgGrid:r("--theme-bg-card",ft[e].bgGrid),bgWeekend:r("--theme-bg-hover",ft[e].bgWeekend),border:r("--theme-border-primary",ft[e].border),borderLight:r("--theme-border-subtle",ft[e].borderLight),textPrimary:r("--theme-text-primary",ft[e].textPrimary),textSecondary:r("--theme-text-secondary",ft[e].textSecondary),textTertiary:r("--theme-text-tertiary",ft[e].textTertiary),accent:r("--theme-accent-primary",ft[e].accent),accentHover:r("--theme-accent-hover",ft[e].accentHover),accentLight:r("--theme-accent-primary",ft[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ft[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ft[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ft[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ft[e].dependency),dependencyHover:r("--theme-border-secondary",ft[e].dependencyHover),criticalPath:r("--theme-error",ft[e].criticalPath),criticalPathLight:r("--theme-error",ft[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ft[e].today):e==="neutral"?r("--theme-text-primary",ft[e].today):r("--theme-error",ft[e].today),todayLight:e==="light"?r("--theme-accent-primary",ft[e].todayLight):e==="neutral"?r("--theme-text-primary",ft[e].todayLight):r("--theme-error",ft[e].todayLight),milestone:r("--theme-warning",ft[e].milestone),milestoneLight:r("--theme-warning",ft[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ft[e].statusTodo),statusInProgress:r("--theme-accent-primary",ft[e].statusInProgress),statusCompleted:r("--theme-success",ft[e].statusCompleted),hoverBg:r("--theme-bg-hover",ft[e].hoverBg),focusRing:r("--theme-accent-primary",ft[e].focusRing),...ft[e].dotGrid&&{dotGrid:ft[e].dotGrid},...ft[e].glassHeader&&{glassHeader:ft[e].glassHeader},...ft[e].glassToolbar&&{glassToolbar:ft[e].glassToolbar},...ft[e].forecastHud&&{forecastHud:ft[e].forecastHud},...ft[e].neonRedGlow&&{neonRedGlow:ft[e].neonRedGlow},...ft[e].executionBarBg&&{executionBarBg:ft[e].executionBarBg}}}var yi={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"}},Vp={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"}},xd={en:yi,es:Vp};function Gp(e){return xd[e]||xd.en}function vd(e,t){let a=Gp(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 Fn=createContext(yi);function Br(){return useContext(Fn)}function ms(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),l=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),o}function Zp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=useState(false),[i,p]=useState(null),d=useRef(null),m=useRef(null),g=Br(),y=ms(d,l,"right",176);if(useEffect(()=>{if(!l)return;let b=v=>{let C=v.target;d.current&&!d.current.contains(C)&&m.current&&!m.current.contains(C)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!(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){p(b);try{await v();}catch(C){console.error(`Export ${b} failed:`,C);}finally{p(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-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:i!==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:i===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 _p({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=useState(false),[c,i]=useState(null),[p,d]=useState(false),m=useRef(null),g=useRef(null),y=Br(),x=ms(m,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;m.current&&!m.current.contains(k)&&g.current&&!g.current.contains(k)&&l(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){i(N);try{await T();}catch(k){console.error(`Export ${N} failed:`,k);}finally{i(null),l(false);}}},C=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>l(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title: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:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?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:p?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Rx({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 Ox({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 Kp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),l=useRef(null),c=Br(),i=ms(n,o,"left");useEffect(()=>{if(!o)return;let m=g=>{let y=g.target;n.current&&!n.current.contains(y)&&l.current&&!l.current.contains(y)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,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:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:p.map((m,g)=>{let y=t===m.value;return jsxs(motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<p.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:m.label}),y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function qp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),c=useRef(null),i=Br(),p=ms(l,s,"left");useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;l.current&&!l.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:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,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:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),m&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref: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:p.top,left:p.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(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:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function $x({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 l=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Hx({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,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,p=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,m=t?.currency||"$",g=d!=null?d>=1e6?`${m}${(d/1e6).toFixed(2)}M`:d>=1e3?`${m}${(d/1e3).toFixed(1)}K`:`${m}${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&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),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 zx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:p,hasDependencies:d=true}){let[m,g]=useState(false),y=useRef(null),x=useRef(null),h=Br(),f=ms(y,m,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!m)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)},[m]);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:l,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(!m),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:m?e.accent:e.textTertiary,backgroundColor:m?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:m&&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,F=T.disabled,I=T.tooltip;return jsxs(motion.button,{onClick:()=>!F&&T.onChange?.(!T.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:F?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:F?"not-allowed":"pointer"},whileHover:F?{}:{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:F?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&&!F&&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=i===T.value;return jsxs(motion.button,{onClick:()=>p(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 xi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,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:F,onExportExcel:I,onExportCSV:S,onExportJSON:X,onExportMSProject:O,showCriticalPath:$=true,onShowCriticalPathChange:A,showDependencies:q=true,onShowDependenciesChange:Z,highlightWeekends:Ee=true,onHighlightWeekendsChange:B,showBaseline:_=false,onShowBaselineChange:he,onCopySnapshotLink:Ye,hasDependencies:z=true}){let re=Br(),J=w||F||I||S||X||O,Le=!!e.glassToolbar,[we,Oe]=useState(false),Be=useRef(null);useEffect(()=>{we&&Be.current&&Be.current.focus();},[we]);let lt=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.toolbar.month}],ee=[{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"})}],ct=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Le){let pe=ct?"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:ct?"#1A1A1A":e.bgSecondary,border:`1px solid ${ct?"rgba(255,255,255,0.08)":e.border}`},animate:{width:we?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Oe(!we),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"})}),we&&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:()=>Oe(false),onKeyDown:et=>{et.key==="Escape"&&Oe(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),T&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:ct?"#000000":e.bgSecondary,border:`1px solid ${ct?"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"?ct?"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"?ct?"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($x,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),v&&jsx(Kp,{theme:e,value:b??"all",onChange:v,maxDepth:C}),y&&jsx(qp,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:pe}}),jsx(zx,{theme:e,showCriticalPath:$,onShowCriticalPathChange:A,showBaseline:_,onShowBaselineChange:he,highlightWeekends:Ee,onHighlightWeekendsChange:B,showDependencies:q,onShowDependenciesChange:Z,rowDensity:l,onRowDensityChange:c,hasDependencies:z}),jsx(_p,{theme:e,onExportPNG:w,onExportPDF:F,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Ye}),p&&m&&jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${ct?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${ct?"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(Hx,{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(Ox,{options:lt,value:t,onChange:pe=>a(pe),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(Kp,{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(qp,{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}})]}),p&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #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||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(_p,{theme:e,onExportPNG:w,onExportPDF:F,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Ye}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(Rx,{options:ee,value:s,onChange:pe=>n(pe),theme:e})]})]})}function vi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let i=e.filter(p=>p.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let p=c.current.getBoundingClientRect();n({x:p.left,y:p.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(Jt,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(p=>jsxs("button",{onClick:()=>{t(p.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:p.label}),p.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function An({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[l,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let p=200,d=r.length*36+8,m=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+p+m>g&&(x=t-p,x<m&&(x=m)),a+d+m>y&&(h=y-d-m,h<m&&(h=m)),c({x,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let p=m=>{n.current&&!n.current.contains(m.target)&&o();},d=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(p=>jsxs("div",{children:[p.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:d=>{p.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var ca={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 sm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:p,onOpenTaskModal:d,enableKeyboard:m=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 F=N[w];a(F.id,C);},[e,h,x,a]),b=useCallback(v=>{if(!m)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),F=h();if(v.key==="ArrowUp"){v.preventDefault(),f("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),f("down",v.shiftKey);return}if(F&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){F.subtasks&&F.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!F.isExpanded||v.key==="ArrowLeft"&&F.isExpanded)&&p(F.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(),l(w));return}if(v.key==="Tab"&&v.shiftKey){w.length>0&&(v.preventDefault(),c(w));return}if(v.key==="Enter"&&!v.shiftKey&&!k){F&&(v.preventDefault(),r(F.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!k){F&&(v.preventDefault(),r(F.id,"above"));return}if(v.key==="Enter"&&k){F&&(v.preventDefault(),d(F.id));return}if(v.key==="F2"){F&&(v.preventDefault(),i(F.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}},[m,t,h,f,r,o,s,n,l,c,i,p,d]);return useEffect(()=>{if(m)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[m,b]),{setIsEditing:y}}function lm(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(m=>{let g=new Set(m);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,m)=>{if(!a){o(d);return}let g=m.indexOf(a),y=m.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=m.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),l=useCallback((d,m,g,y)=>{y?n(d,m):g?s(d):o(d);},[o,s,n]),c=useCallback((d,m)=>{m?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),p=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:p}}function Nd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Nd(t.subtasks):t.subtasks}))}function Ln(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function In(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=In(a.subtasks,t);if(r)return r}}return null}function Td(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Td(a.subtasks,t);if(r)return r}return null}function Dd(e,t){if(t.length===0)return e;let a=Ln(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let y=[];return {tasks:m.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}},l=(m,g,y)=>m.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,y)}:x),c=new Set(t),{tasks:i,removed:p}=n(e,c),d=l(i,s.id,p);return Nd(d)}function Sd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Td(a,r);if(!o)continue;let s=Td(a,o.id),n=(i,p,d)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===p&&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,p,d);if(y)return y}}return null},l=(i,p,d)=>{let m=i.findIndex(g=>g.id===p);if(m!==-1)return i.splice(m+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,p,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(a,o.id,c));}return Nd(a)}function Ed(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,c))return true;return false}let p=c==="up"?i-1:i+1;return p<0||p>=n.length?false:([n[i],n[p]]=[n[p],n[i]],n[i]={...n[i],position:i},n[p]={...n[p],position:p},true)};return s(r,o,a),r}function Md(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 fs(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((p,d)=>({...p,id:`${p.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let p=c[i],d=`${p.id}-copy-${Date.now()}`,m={...p,id:d,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,d):void 0};return c.splice(i+1,0,m),m},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function dm(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let p=a==="above"?i:i+1;return c.splice(p,0,n),true};return l(r),{tasks:r,newTask:n}}function Fd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Fd(r.subtasks,t,a)}:r)}function Pd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Pd(a.subtasks,t)}:a)}function Ad(e,t){let a=m=>{for(let g of m){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,l=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},i=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=m=>m.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,p],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:p}}function cm(e,t,a,r){if(t===a)return e;let o=In(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===i||l(p,i))return true;return false};if(l(o,a))return e}let s=l=>{let c=l.filter(p=>p.id!==t),i=c.length<l.length;return c.map((p,d)=>{let m=i?{...p,position:d}:p;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let p=i.subtasks||[],d=r!==void 0?r:p.length,m=[...p];m.splice(d,0,{...o,parentId:a});let g=m.map((y,x)=>({...y,position:x}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function Rr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Rr(t.subtasks),r=a.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ki({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:p,onToggleColumn:d,onColumnResize:m,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:F,showCriticalPath:I=false}){let S=useContext(Fn),[X,O]=useState(null),[$,A]=useState(null),[q,Z]=useState(""),Ee=useRef(null),[B,_]=useState(null),[he,Ye]=useState(0),[z,re]=useState(0),[J,Le]=useState({isOpen:false,x:0,y:0,type:"header"}),[we,Oe]=useState(null),[Be,lt]=useState(null),[ee,ct]=useState(null),pe=useRef(0),et=5,nt=useRef(false),[Ut,Ce]=useState(null),[mt,Dt]=useState(false),Xe=useRef(null),[H,ne]=useState(null),[D,K]=useState(false),ce=useRef(null);useEffect(()=>{function ie(me){ce.current&&!ce.current.contains(me.target)&&K(false);}if(D)return document.addEventListener("mousedown",ie),()=>document.removeEventListener("mousedown",ie)},[D]),useEffect(()=>{$&&Ee.current&&(Ee.current.focus(),Ee.current.select());},[$]),useEffect(()=>{if(!B)return;let ie=L=>{let j=L.clientX-he,Y=z+j;m?.(B,Y);},me=()=>{_(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ie),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[B,he,z,m]);let{selectedTaskIds:Te,handleTaskClick:V,isTaskSelected:te}=lm(),{setIsEditing:$e}=sm({tasks:e,selectedTaskIds:Te,onTaskSelect:(ie,me)=>{let j=Ln(e).map(Y=>Y.id);V(ie,j,me||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:ie=>{let me=Ln(e).find(L=>L.id===ie);me&&dt(me);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:ie=>{let me=Ln(e).find(L=>L.id===ie);me&&T&&T(me);},enableKeyboard:true}),Ne=(ie,me=0,L="")=>{let j=[],Y=[...ie].sort((ge,De)=>(ge.position??0)-(De.position??0));for(let ge=0;ge<Y.length;ge++){let De=Y[ge],Je=ge+1,_e=L?`${L}.${Je}`:`${Je}.0`;if(De.wbsCode=_e,j.push({task:De,level:me}),De.subtasks&&De.subtasks.length>0&&De.isExpanded){let ze=L?`${L}.${Je}`:`${Je}`;j.push(...Ne(De.subtasks,me+1,ze));}}return j},He=Ne(e),Fe=48,Ge=Math.max(He.length*a,600-Fe),ht=ie=>!ie.startDate||!ie.endDate?"-":`${Math.ceil((ie.endDate.getTime()-ie.startDate.getTime())/(1e3*60*60*24))}d`,dt=ie=>{A(ie.id),Z(ie.name),$e(true);},gt=ie=>{q.trim()&&q!==e.find(me=>me.id===ie)?.name&&C?.(ie,q.trim()),A(null),Z(""),$e(false);},ot=()=>{A(null),Z(""),$e(false);},jt=(ie,me)=>{me.stopPropagation(),N?.(ie.id);},Et=(ie,me)=>{me.preventDefault(),pe.current=me.clientY,Oe(ie),nt.current=false,Dt(false),Ce({x:me.clientX,y:me.clientY});},Nt=ie=>{if(!we||(Math.abs(ie.clientY-pe.current)>et&&!nt.current&&(nt.current=true,Dt(true)),Ce({x:ie.clientX,y:ie.clientY}),!nt.current))return;if(F?.current){let ge=F.current,De=ge.getBoundingClientRect(),Je=60,_e=12;Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null);let ze=ie.clientY-De.top,vt=De.bottom-ie.clientY;if(ze<Je&&ge.scrollTop>0){let ut=Math.round(_e*(1-ze/Je)),Wt=()=>{ge.scrollTop-=ut,nt.current&&ge.scrollTop>0&&(Xe.current=requestAnimationFrame(Wt));};Xe.current=requestAnimationFrame(Wt);}else if(vt<Je&&ge.scrollTop<ge.scrollHeight-ge.clientHeight){let ut=Math.round(_e*(1-vt/Je)),Wt=()=>{ge.scrollTop+=ut,nt.current&&ge.scrollTop<ge.scrollHeight-ge.clientHeight&&(Xe.current=requestAnimationFrame(Wt));};Xe.current=requestAnimationFrame(Wt);}}let L=document.querySelectorAll("[data-task-row]"),j=null,Y=null;L.forEach(ge=>{let De=ge.getBoundingClientRect(),Je=ge.getAttribute("data-task-row");if(Je&&Je!==we&&ie.clientY>=De.top&&ie.clientY<=De.bottom){j=Je;let _e=ie.clientY-De.top,ze=De.height;_e<ze*.25?Y="above":_e>ze*.75?Y="below":Y="child";}}),lt(j),ct(Y);},Tt=()=>{if(nt.current&&we&&Be&&ee){if(ee==="child")w?.(we,Be);else if(ee==="above"||ee==="below"){let ie=(Y,ge,De=null)=>{for(let Je of Y){if(Je.id===ge)return De;if(Je.subtasks){let _e=ie(Je.subtasks,ge,Je.id);if(_e!==void 0)return _e}}},me=ie(e,we,null),L=ie(e,Be,null),j=(Y,ge,De,Je)=>{let _e=Y.findIndex(ut=>ut.id===ge),ze=Je?Y.findIndex(ut=>ut.id===De):-1,vt=ee==="below"?_e+1:_e;return Je&&ze!==-1&&ze<_e&&(vt-=1),Math.max(0,vt)};if(L===null){let ge=j(e,Be,we,me===null);w?.(we,null,ge);}else {let Y=In(e,L);if(Y?.subtasks){let ge=me===L,De=j(Y.subtasks,Be,we,ge);w?.(we,L,De);}}}}Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null),Oe(null),lt(null),ct(null),Ce(null),nt.current=false,Dt(false);};useEffect(()=>{if(we)return document.addEventListener("mousemove",Nt),document.addEventListener("mouseup",Tt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Nt),document.removeEventListener("mouseup",Tt),document.body.style.cursor="",document.body.style.userSelect="";}},[we,Be,ee]);let yt=(ie,me,L)=>{let j=me.subtasks&&me.subtasks.length>0;switch(ie.id){case "name":let Y=$===me.id,ge=X===me.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:ge?1:.3},onMouseDown:U=>Et(me.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),me.subtasks&&me.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),c?.(me.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:me.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),Y?jsx("input",{ref:Ee,type:"text",value:q,onChange:U=>Z(U.target.value),onKeyDown:U=>{U.key==="Enter"?gt(me.id):U.key==="Escape"&&ot();},onBlur:()=>gt(me.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:U=>U.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:me.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:me.parentId?"13px":"14px",fontWeight:me.isMilestone?600:me.parentId?400:600,letterSpacing:me.parentId?"0":"-0.01em"},title:me.name,children:[me.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:me.wbsCode}),me.isHighlighted&&me.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:me.name}),me.subtasks&&me.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(me.progress||0),"%"]}),I&&me.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),I&&me.cpmData&&jsxs("span",{style:{color:me.cpmData.totalFloat<=0?"#EF4444":me.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(me.cpmData.totalFloat),"d"]})]}),ge&&!Y&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>jt(me,U),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:U=>{U.stopPropagation(),dt(me);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Je=ie.id==="startDate"?"startDate":"endDate",_e=me[Je],ze=H?.taskId===me.id&&H?.field===Je,vt=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:j?.5:1,cursor:j?"default":"pointer"},title:j?"Auto-calculated from subtasks":void 0,onClick:U=>{if(!j)if(ze)ne(null);else {let Ze=U.currentTarget.getBoundingClientRect();ne({taskId:me.id,field:Je,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:Ze.bottom+4,left:Ze.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:vt(_e)}),j&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),ze&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ne(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:H?.position.top,left:H?.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,Ze=new Date(U);Ze.setDate(U.getDate()+1);let ye=new Date(U);ye.setDate(U.getDate()+7);let E=new Date(U);return E.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:Ze},{label:"Pr\xF3xima semana",date:ye},{label:"2 semanas",date:E}].map((je,tt)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ra=>ra.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ra=>ra.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Je]:je.date}),ne(null);},children:je.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?.(me.id,{[Je]:void 0}),ne(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:()=>ne(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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>ne(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,Ze)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},Ze))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=H?.month||new Date,Ze=U.getFullYear(),ye=U.getMonth(),E=new Date(Ze,ye,1).getDay(),fe=new Date(Ze,ye+1,0).getDate(),je=new Date,tt=[];for(let Vt=E-1;Vt>=0;Vt--)tt.push({day:new Date(Ze,ye,-Vt).getDate(),date:new Date(Ze,ye-1,new Date(Ze,ye,-Vt).getDate()),isCurrentMonth:false});for(let Vt=1;Vt<=fe;Vt++)tt.push({day:Vt,date:new Date(Ze,ye,Vt),isCurrentMonth:true});let ra=42-tt.length;for(let Vt=1;Vt<=ra;Vt++)tt.push({day:Vt,date:new Date(Ze,ye+1,Vt),isCurrentMonth:false});return tt.map((Vt,Ua)=>{let lr=Vt.date.toDateString()===je.toDateString(),ya=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===Vt.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:Vt.isCurrentMonth?ya?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ya?"#2E94FF":"transparent",boxShadow:lr&&!ya?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(me.id,{[Je]:Vt.date}),ne(null);},children:Vt.day},Ua)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:ht(me)})});case "assignees":if(j)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let ut=r.filter(U=>me.assignees?.some(Ze=>Ze.name===U.name||Ze.initials===U.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Yo,{assignedUsers:ut,availableUsers:r,onChange:U=>{let Ze=U.map(ye=>({id:ye.id,name:ye.name,initials:ye.initials,color:ye.color}));g?.(me.id,{assignees:Ze.length>0?Ze:void 0});}})});case "status":if(j){let U=me.progress===100?"\u2713":me.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:U})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Au,{status:me.status||"todo",onChange:U=>{g?.(me.id,{status:U,progress:U==="completed"?100:me.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:j?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${me.progress}%`,backgroundColor:me.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[me.progress,"%"]})]});case "priority":let Wt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ha={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ta=Wt[me.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Ko,{priority:ta,onChange:U=>{U&&g?.(me.id,{priority:ha[U]||"medium"});}})});default:return null}},$t=ie=>[{id:"hide",label:"Hide Column",icon:ca.Hide,onClick:()=>d(ie),disabled:ie==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ca.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ca.SortDesc,onClick:()=>{}}],We=ie=>ie.subtasks&&ie.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{N?.(ie.id);}},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([ie.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(ie.id,ie.name):f?.([ie.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{n?.(ie);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{N?.(ie.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{g?.(ie.id,{status:"todo",progress:0});},disabled:ie.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{g?.(ie.id,{status:"in-progress"});},disabled:ie.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{g?.(ie.id,{status:"completed",progress:100});},disabled:ie.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([ie.id]);}},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(ie.id,ie.name):f?.([ie.id]);}}],Re=p.filter(ie=>ie.visible),at=Re.reduce((ie,me)=>ie+me.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:at},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Fe}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Re.map((ie,me)=>{let L=me===Re.length-1,j=ie.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j?"":"justify-center"}`,style:{width:`${ie.width}px`,minWidth:`${ie.minWidth??(j?200:60)}px`,maxWidth:`${ie.maxWidth??2e3}px`,flexShrink:j&&Re.length===1?1:0,flexGrow:j&&Re.length===1?1:0,borderRight:L?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Y=>{Y.preventDefault(),Le({isOpen:true,x:Y.clientX,y:Y.clientY,type:"header",columnId:ie.id});},onMouseEnter:Y=>{Y.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Y=>{Y.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:ie.label,children:ie.label}),ie.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:B===ie.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Y=>{Y.preventDefault(),Y.stopPropagation(),_(ie.id),Ye(Y.clientX),re(ie.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:B===ie.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ie.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(vi,{columns:p,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>K(!D),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),D&&jsxs("div",{ref:ce,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:ie=>ie.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:()=>K(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ge},children:He.map(({task:ie,level:me},L)=>{let j=te(ie.id),Y=Be===ie.id,ge=Y&&ee==="above",De=Y&&ee==="below",Je=Y&&ee==="child",_e={};return Je&&(_e.backgroundColor=`${t.accent}15`,_e.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":ie.id,className:`flex items-center cursor-pointer group ${we===ie.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:Je?`${t.accent}15`:L%2===0?t.bgPrimary:t.bgGrid,opacity:I?ie.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",..._e},onMouseEnter:()=>O(ie.id),onMouseLeave:()=>O(null),onClick:ze=>{let ut=Ln(e).map(ta=>ta.id),ha=navigator.platform.toUpperCase().indexOf("MAC")>=0?ze.metaKey:ze.ctrlKey;V(ie.id,ut,ha,ze.shiftKey),s?.(ie);},onDoubleClick:ze=>{ze.stopPropagation(),n?.(ie);},onContextMenu:ze=>{ze.preventDefault(),Le({isOpen:true,x:ze.clientX,y:ze.clientY,type:"task",task:ie}),l?.(ie,ze);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[ge&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),De&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Re.map((ze,vt)=>{let ut=vt===Re.length-1,Wt=ze.id==="name";return jsx("div",{className:`px-4 flex items-center ${Wt?"justify-start":"justify-center"}`,style:{width:`${ze.width}px`,minWidth:`${ze.minWidth??(Wt?200:60)}px`,maxWidth:`${ze.maxWidth??2e3}px`,flexShrink:Wt&&Re.length===1?1:0,flexGrow:Wt&&Re.length===1?1:0,borderRight:ut?"none":`1px solid ${X===ie.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:yt(ze,ie,Wt?me:0)},`${ie.id}-${ze.id}`)})]},ie.id)})}),jsx(An,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?$t(J.columnId):J.type==="task"&&J.task?We(J.task):[],onClose:()=>Le({...J,isOpen:false}),theme:t}),mt&&Ut&&we&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Ut.x+12,top:Ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ie=He.find(me=>me.task.id===we)?.task;return ie?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:ie.name})}):null})()}),document.body)]})}function fm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[c,i]=useState(t),[p,d]=useState(null),[m,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,v]=useState(0),[C,N]=useState(0),[T,k]=useState(null),[w,F]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:p,setConnectionLine:d,hoveredTaskId:m,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:F,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,A)=>{r("none"),d(null),g(null),l($),i(A),N(0),f(null),v(0);}}}function Ni({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:p,onDateChange:d,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:v=false}){let C=fm(t,r),N=useRef(null),T=useRef(false),k=useRef(null),w=useRef(null),{dragMode:F,setDragMode:I,dragOffset:S,setDragOffset:X,ghostX:O,setGhostX:$,ghostWidth:A,setGhostWidth:q,connectionLine:Z,setConnectionLine:Ee,hoveredTaskId:B,setHoveredTaskId:_,activeZone:he,setActiveZone:Ye,draggedSegmentIndex:z,setDraggedSegmentIndex:re,draggedSegmentStartX:J,setDraggedSegmentStartX:Le,segmentDragOffsetX:we,setSegmentDragOffsetX:Oe,hoveredSegmentIndex:Be,setHoveredSegmentIndex:lt,isHovered:ee,setIsHovered:ct,isDragging:pe,isResizing:et,isConnecting:nt,resetDragState:Ut}=C,Ce=18,mt=!!o.executionBarBg,Dt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Xe=mt?3:6,H=e.subtasks&&e.subtasks.length>0,ne=e.endDate&&(()=>{let L=new Date;L.setHours(0,0,0,0);let j=new Date(e.endDate);return j.setHours(0,0,0,0),j<L})()&&e.progress<100,D=b&&e.isCriticalPath,K=o.name==="neutral"||o.today==="#1C1917",ce=e.status==="completed"||e.progress===100,Te={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=b&&e.isCriticalPath||ne?"#EF4444":e.color?e.color:e.priority&&Te[e.priority]?Te[e.priority]:o.taskBarPrimary,$e=v?"default":pe?nt?"crosshair":et?"ew-resize":"grabbing":"grab",Ne=v?"default":"ew-resize",Fe=(L=>L>=80?20:L>=60?15:L>=50?12:10)(r),Ge=r<50,ht=r<40;useEffect(()=>{x&&(!ee||pe||e.segments)&&x(null);},[ee,pe,e.segments,x]);let dt=L=>L.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),gt=()=>{let L=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${L} day${L!==1?"s":""}`},ot=L=>Math.round(L/s)*s,jt=L=>{let j=Math.round(L/s),Y=new Date(n);return Y.setDate(Y.getDate()+j),Y},Et=(L,j)=>{for(let Y of g){if(Y.id===e.id)continue;let ge=5;if(L>=Y.x-ge&&L<=Y.x+Y.width+ge&&j>=Y.y-ge&&j<=Y.y+Y.height+ge)return Y.id}return null},Nt=useCallback((L,j,Y)=>{if(v)return;L.preventDefault(),L.stopPropagation();let ge=N.current?.ownerSVGElement;if(!ge)return;let De=ge.createSVGPoint();De.x=L.clientX,De.y=L.clientY;let Je=De.matrixTransform(ge.getScreenCTM()?.inverse()),_e=Y!==void 0?Y:t,ze=j;if(!ze){let vt=Je.x-_e;L.shiftKey?(ze="connect",Ee({x:t+r,y:a+Ce/2})):L.ctrlKey||L.metaKey?ze="move":L.altKey?ze=vt<r/2?"resize-start":"resize-end":ht?vt<r/2?ze="move":ze="resize-end":Ge?vt<=Fe/2?ze="resize-start":vt>=r-Fe/2?ze="resize-end":ze="move":vt<=Fe?ze="resize-start":vt>=r-Fe?ze="resize-end":ze="move";}T.current=false,I(ze),ct(false),Ye(null),ze==="move"?X(Je.x-_e):ze==="connect"?Ee({x:t+r,y:a+Ce/2}):X(0),$(_e),q(r);},[t,r,a,Ce,v]),Tt=useCallback(L=>{let j=N.current?.ownerSVGElement;if(!j)return;let Y=j.closest(".gantt-timeline-scroll");if(!Y)return;let ge=Y.getBoundingClientRect(),De=60,Je=15,_e=0;if(L.clientX<ge.left+De){let ze=ge.left+De-L.clientX;_e=-Math.min(Je,ze/2);}else if(L.clientX>ge.right-De){let ze=L.clientX-(ge.right-De);_e=Math.min(Je,ze/2);}return _e!==0&&(Y.scrollLeft+=_e),_e!==0},[]),yt=useCallback(L=>{if(F==="none")return;T.current=true,w.current=L;let j=N.current?.ownerSVGElement;if(!j)return;if(F==="move"||F==="resize-start"||F==="resize-end"){let De=Tt(L);De&&!k.current?k.current=window.setInterval(()=>{w.current&&(Tt(w.current),yt(w.current));},16):!De&&k.current&&(window.clearInterval(k.current),k.current=null);}let Y=j.createSVGPoint();Y.x=L.clientX,Y.y=L.clientY;let ge=Y.matrixTransform(j.getScreenCTM()?.inverse());if(F==="connect"){Ee({x:ge.x,y:ge.y});let De=Et(ge.x,ge.y);_(De);}else if(F==="move"){let De=ge.x-S,Je=ot(De);$(Je),q(r);let _e=Math.round((Je-t)/s);if(y?.(e.id,_e,true),e.segments&&e.segments.length>0&&z!==null){let ze=Je-J;Oe(ze);}}else if(F==="resize-start"){let De=ge.x,Je=ot(De),_e=t+r-Je;_e>=s&&($(Je),q(_e));}else if(F==="resize-end"){let De=ge.x,_e=ot(De)-t;_e>=s&&q(_e);}},[F,t,r,s,S,e,ot,z,J,Et,_,Ee,$,q,Oe,y,Tt]),$t=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),w.current=null,F!=="none"){if(F==="connect")B&&m&&m(e,B),Ee(null),_(null);else {let L=e.endDate.getTime()-e.startDate.getTime(),j,Y,ge=true;if(F==="move"){if(j=jt(O),Y=new Date(j.getTime()+L),e.segments&&e.segments.length>0&&z!==null){let De=Math.round(we/s),Je=e.segments.map((ut,Wt)=>{if(Wt===z){let ha=new Date(ut.startDate),ta=new Date(ut.endDate);return ha.setDate(ha.getDate()+De),ta.setDate(ta.getDate()+De),{startDate:ha,endDate:ta}}return ut}),_e=Je.flatMap(ut=>[ut.startDate,ut.endDate]),ze=new Date(Math.min(..._e.map(ut=>ut.getTime()))),vt=new Date(Math.max(..._e.map(ut=>ut.getTime())));d?.({...e,segments:Je},ze,vt),Ut(t,r);return}}else F==="resize-start"?(j=jt(O),Y=e.endDate,j>Y&&(console.warn("Invalid date range: start date must be before or equal to end date"),ge=false)):F==="resize-end"?(j=e.startDate,Y=jt(O+A),Y.setDate(Y.getDate()-1),Y<j&&(console.warn("Invalid date range: end date must be after or equal to start date"),ge=false)):ge=false;ge&&j&&Y&&(Y.getTime()<j.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,j,Y));}y?.(e.id,0,false),Ut(t,r);}},[F,O,A,e,d,B,m,t,r,s,jt,we,z,Ut,y]);useEffect(()=>{if(F==="none")return;let L=Y=>{yt(Y);},j=()=>{$t();};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",j),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",j),k.current&&(window.clearInterval(k.current),k.current=null);}},[F,yt,$t]);let We=pe&&!nt?O:t,Re=pe&&!nt?A:r,at=l.taskClass(e),ie=24,me=b?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:N,"data-task-bar":"true",style:{opacity:me,transition:"opacity 300ms ease"},onClick:()=>{!pe&&!T.current&&c?.(e),T.current=false;},onDoubleClick:L=>{!pe&&!T.current&&(L.stopPropagation(),i?.(e));},onContextMenu:L=>{L.preventDefault(),p?.(e,L);},onMouseEnter:()=>!pe&&ct(true),onMouseMove:L=>{x&&ee&&!pe&&!e.segments&&x({task:e,x:t,y:a,width:r,height:Ce,showBelow:false,mouseX:L.clientX,mouseY:L.clientY});},onMouseLeave:()=>{pe||(ct(false),Ye(null));},children:[jsx("rect",{x:t,y:a,width:r+ie,height:Ce,fill:"transparent",style:{pointerEvents:"all"}}),ee&&!pe&&!Ge&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Fe,height:Ce,fill:he==="resize-start"?o.accent:"transparent",opacity:he==="resize-start"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ye("resize-start"),onMouseDown:L=>Nt(L,"resize-start")}),jsx("rect",{x:t+Fe,y:a,width:r-Fe*2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ye("move"),onMouseDown:L=>Nt(L,"move")}),jsx("rect",{x:t+r-Fe,y:a,width:Fe,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.15:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ye("resize-end"),onMouseDown:L=>Nt(L,"resize-end")})]}),ee&&!pe&&ht&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Ce,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ye("move"),onMouseDown:L=>Nt(L,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ce,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.2:0,style:{cursor:Ne,pointerEvents:"all"},onMouseEnter:()=>Ye("resize-end"),onMouseDown:L=>Nt(L,"resize-end")}),ee&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ce-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),pe&&!nt&&!e.segments&&jsx(motion.rect,{x:O,y:a,width:A,height:Ce,rx:Xe,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&&!pe&&(()=>{let L=e.baselineStartDate.getTime(),j=e.baselineEndDate.getTime(),Y=n.getTime(),ge=864e5,De=(L-Y)/ge,Je=(j-L)/ge,_e=De*s,ze=Math.max(Je*s,s),vt=We+Re,ut=_e+ze,Wt=e.endDate?.getTime()??0,ha=Math.ceil((Wt-j)/ge),ta=ha>0,U=ha<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:_e,y:a,width:ze,height:Ce,rx:Xe,fill:"none",stroke:Dt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ta&&vt>ut&&jsx("rect",{x:ut,y:a,width:vt-ut,height:Ce,rx:0,fill:"#EF4444",opacity:.2}),ta&&jsxs("text",{x:Math.max(vt,ut)+6,y:a+Ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",ha,"d"]}),U&&jsxs("text",{x:vt+6,y:a+Ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[ha,"d"]})]})})(),!e.segments&&mt&&H&&(()=>{let j=a+(Ce-8)/2,Y=4,ge=e.progress||0,De=new Date;De.setHours(0,0,0,0);let Je=e.startDate&&De>=e.startDate,_e=e.endDate&&(()=>{let ta=new Date(e.endDate);return ta.setHours(0,0,0,0),De>ta})(),ze=e.startDate&&De<e.startDate,vt=1;if(Je&&e.startDate&&e.endDate&&!ze){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 Ze=Math.max(1,(U.getTime()-ta.getTime())/(1e3*60*60*24)),E=Math.min((De.getTime()-ta.getTime())/(1e3*60*60*24),Ze)/Ze*100;vt=E>0?ge/E:1;}let ut;ge>=100?ut="#00E5CC":ze?ut="#4B5563":_e&&ge<100?ut="#EF4444":vt>=.95?ut="#22C55E":vt>=.8?ut="#F59E0B":ut="#EF4444";let Wt=Math.max(ge/100*Re,ge>0?Y*2:0),ha=Re>100&&ge>0;return jsxs("g",{"data-task-class":at,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:We,y:j,width:Re,height:8,rx:Y,fill:"rgba(255,255,255,0.10)"}),ge>0&&jsx("rect",{x:We,y:j,width:Wt,height:8,rx:Y,fill:ut}),ha&&jsxs("text",{x:We+Wt+6,y:j+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(ge),"%"]})]})})(),!e.segments&&mt&&!H&&jsx(motion.rect,{x:We,y:a,width:Re,height:Ce,rx:Xe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":at,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!nt?.15:e.parentId?.6:1,scale:ee&&!pe?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:L=>Nt(L),style:{cursor:$e,pointerEvents:"all"}}),!e.segments&&!mt&&jsx(motion.rect,{x:We,y:a,width:Re,height:Ce,rx:Xe,fill:te,"data-task-class":at,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!nt?.15:e.parentId?.6:ee?.9:.8,scale:ee&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:L=>Nt(L),style:{cursor:H?"default":$e,pointerEvents:"all"}}),mt&&(ne||D)&&!e.segments&&jsx("rect",{x:We,y:a,width:Re,height:Ce,rx:Xe,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&&!H&&jsx("rect",{x:We,y:a,width:Math.max(Re*(e.progress/100),Xe*2),height:Ce,rx:Xe,fill:te,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let L=e.progress>0?Re*(e.progress/100):0,j=We+L,Y=Re-L,ge=e.progress===0?Xe:0,De=e.progress===0?We:j,Je=e.progress===0?Re:Y;return jsxs(Fragment,{children:[jsx("rect",{x:De,y:a,width:Je,height:Ce,rx:ge,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:De,y:a,width:Je,height:Ce,rx:ge,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),mt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!pe&&(()=>{let L=We+Re*(e.progress/100),j=8,Y=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:L,cy:a+Ce/2,r:j,fill:Y?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:L,y:a+Ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:Y?.initials||Y?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((L,j)=>{let Y=(L.startDate.getTime()-n.getTime())/864e5*s,De=(L.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Y+s,Je=pe&&F==="move"&&z===j,_e=Be===j,ze=Je?Y+we:Y;return jsxs("g",{onMouseEnter:()=>!pe&&lt(j),onMouseLeave:()=>!pe&&lt(null),children:[jsx(motion.rect,{x:ze,y:a,width:De,height:Ce,rx:Xe,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:Je||e.parentId?.6:_e?.9:.8,scale:_e&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:vt=>{vt.stopPropagation(),re(j),Le(Y),Nt(vt,void 0,Y);},style:{cursor:$e,pointerEvents:"all"}}),jsx("rect",{x:ze,y:a,width:De*(e.progress/100),height:Ce,rx:Xe,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${j}`)}),K&&(ne||D)&&!e.segments&&jsxs(Fragment,{children:[D&&!ne&&jsx("rect",{x:We,y:a,width:Re,height:Ce,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ne&&jsx("rect",{x:We,y:a,width:Re,height:Ce,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Re>60&&!e.segments&&!(mt&&H)&&(()=>{let L=l.taskLabel(e),j=typeof L=="string"?L:e.name,Y=j.length>Math.floor(Re/8)?`${j.substring(0,Math.floor(Re/8))}...`:j;return jsx("text",{x:We+8,y:a+Ce/2,dominantBaseline:"middle",fill:ce?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ce?"line-through":"none"},children:Y})})(),!pe&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(mt?jsxs("text",{x:We+Re+6,y:a+Ce/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Re>100?jsxs("text",{x:We+Re-12,y:a+Ce/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&&Re>80&&!pe&&!e.segments&&!(mt&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:We+Re-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:We+Re-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ee||et)&&!nt&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:We-2,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ye("resize-start"),onMouseLeave:()=>Ye(null),onMouseDown:L=>{L.stopPropagation(),Nt(L,"resize-start");}}),jsx(motion.rect,{x:We+4,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-start"||F==="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:We+Re-14,y:a,width:16,height:Ce,fill:"transparent",style:{cursor:Ne},onMouseEnter:()=>Ye("resize-end"),onMouseLeave:()=>Ye(null),onMouseDown:L=>{L.stopPropagation(),Nt(L,"resize-end");}}),jsx(motion.rect,{x:We+Re-7,y:a+8,width:3,height:Ce-16,rx:1.5,fill:he==="resize-end"||F==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ee&&!pe&&!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+Ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Ye("connect"),onMouseLeave:()=>Ye(null),onMouseDown:L=>{L.stopPropagation(),Nt(L,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Ce/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:he==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),nt&&Z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Ce/2,x2:Z.x,y2:Z.y,stroke:B?o.statusCompleted:o.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Z.x,cy:Z.y,r:B?8:6,fill:B?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsx(motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(ee||pe)&&!nt&&!e.segments&&jsx(motion.rect,{x:We-1,y:a-1,width:Re+2,height:Ce+2,rx:Xe+1,fill:"none",stroke:pe?o.accent:mt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:mt?1:2,opacity:pe||mt?.6:.4,initial:{opacity:0},animate:{opacity:pe||mt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),et&&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+A,y1:0,x2:O+A,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ee&&!pe&&!e.segments&&!x&&(()=>{let Y=a<100,ge=Y?a+Ce+13:a-82-13,De=Y?`M ${We+Re/2-6} ${a+Ce+3} L ${We+Re/2} ${a+Ce+13} L ${We+Re/2+6} ${a+Ce+3}`:`M ${We+Re/2-6} ${a-13} L ${We+Re/2} ${a-3} L ${We+Re/2+6} ${a-13}`,Je=ge+22,_e=ge+40,ze=ge+55,vt=ge+70,ut=Y?ge+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Y?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Y?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:De,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:We+Re/2-120,y:ge,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:We+Re/2,y:Je,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:We+Re/2-110,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:We+Re/2-70,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.startDate)}),jsx("text",{x:We+Re/2-110,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:We+Re/2-70,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.endDate)}),jsx("text",{x:We+Re/2+10,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:We+Re/2+65,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:gt()}),jsx("text",{x:We+Re/2+10,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:We+Re/2+65,y:ze,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:We+Re/2-110,y:vt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:We+Re/2-50,y:vt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Wt=>Wt.name).join(", ").substring(0,30),e.assignees.map(Wt=>Wt.name).join(", ").length>30?"...":""]})]}),!Y&&jsx("text",{x:We+Re/2,y:ut,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ht?"Left: move \u2022 Right: resize":Ge?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Ld=260,Bn=8,ym=16,Sv=-12;function xm({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,N=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null,T=b.lastActivity!=null,k=(N?155:105)+(T?28:0),w=v+ym,F=C+Sv-k;w+Ld>window.innerWidth-Bn&&(w=v-Ld-ym),w<Bn&&(w=Bn);let I=F<Bn;I&&(F=C+20),F+k>window.innerHeight-Bn&&(F=window.innerHeight-Bn-k),o({left:w,top:F,showBelow:I});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{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":""}`},p=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",m=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:Ld,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(Di,{label:l.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:m}),jsx(Di,{label:l.duration,value:i(),labelColor:d,valueColor:m}),jsx(Di,{label:l.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:m}),jsx(Di,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsx("span",{style:{color:m,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:[l.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsx("span",{style:{color:y,fontWeight:600},children:p(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(s.soldEffortMinutes)})]})]}),s.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:m},children:s.lastActivity.userName})," ",jsx("span",{children:s.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:s.lastActivity.relativeTime})]})]}),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 Di({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 hs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=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,v=20,C=!b&&a<=e,N,T,k=a-e,w=e+k/2;T=w;let E=8;if(n==="squared")if(b)N=`M ${e} ${t} L ${a} ${r}`;else if(C){let xe=e+15,Ue=a-v,Re=f?t+20:t-20;T=Ue;let it=f?1:-1;N=`M ${e} ${t} L ${xe-E} ${t} Q ${xe} ${t} ${xe} ${t+it*E} L ${xe} ${Re-it*E} Q ${xe} ${Re} ${xe-E} ${Re} L ${Ue+E} ${Re} Q ${Ue} ${Re} ${Ue} ${Re+it*E} L ${Ue} ${r-it*E} Q ${Ue} ${r} ${Ue+E} ${r} L ${a} ${r}`;}else {T=a-v;let Ae=f?1:-1;N=`M ${e} ${t} L ${T-E} ${t} Q ${T} ${t} ${T} ${t+Ae*E} L ${T} ${r-Ae*E} Q ${T} ${r} ${T+E} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let I=6,S=5,X=`M ${a} ${r} L ${a-I} ${r-S/2} L ${a-I} ${r+S/2} Z`,O=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),$=m||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),F=d||1,Y=o.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),Z="#f87171",Se="rgba(248, 113, 113, 0.15)",B=T,_=(t+r)/2;if(y)if(n==="squared")if(b)B=Math.max(e+10,Math.min(a-10,y.x)),_=t;else if(C){let Ae=e+15,xe=a-v,Ue=f?t+20:t-20,Re=[[e,t,Ae,t],[Ae,t,Ae,Ue],[Ae,Ue,xe,Ue],[xe,Ue,xe,r],[xe,r,a,r]],it=1/0,ee={x:B,y:_};for(let lt of Re){let de=ye(y.x,y.y,lt[0],lt[1],lt[2],lt[3]),dt=Math.hypot(y.x-de.x,y.y-de.y);dt<it&&(it=dt,ee=de);}B=ee.x,_=ee.y;}else {let Ae=[[e,t,T,t],[T,t,T,r],[T,r,a,r]],xe=1/0,Ue={x:B,y:_};for(let Re of Ae){let it=ye(y.x,y.y,Re[0],Re[1],Re[2],Re[3]),ee=Math.hypot(y.x-it.x,y.y-it.y);ee<xe&&(xe=ee,Ue=it);}B=Ue.x,_=Ue.y;}else {let Ae=w,xe=t,Ue=w,Re=r,it=1/0,ee=B,lt=_;for(let de=0;de<=1;de+=.02){let dt=1-de,ot=dt*dt*dt*e+3*dt*dt*de*Ae+3*dt*de*de*Ue+de*de*de*a,At=dt*dt*dt*t+3*dt*dt*de*xe+3*dt*de*de*Re+de*de*de*r,we=Math.hypot(y.x-ot,y.y-At);we<it&&(it=we,ee=ot,lt=At);}B=ee,_=lt;}function ye(Ae,xe,Ue,Re,it,ee){let lt=it-Ue,de=ee-Re,dt=lt*lt+de*de;if(dt===0)return {x:Ue,y:Re};let ot=((Ae-Ue)*lt+(xe-Re)*de)/dt;return ot=Math.max(0,Math.min(1,ot)),{x:Ue+ot*lt,y:Re+ot*de}}let Je=Ae=>{let xe=Ae.currentTarget.ownerSVGElement;if(!xe)return;let Ue=xe.getScreenCTM();if(!Ue)return;let Re=Ue.inverse();x({x:Re.a*Ae.clientX+Re.c*Ae.clientY+Re.e,y:Re.b*Ae.clientX+Re.d*Ae.clientY+Re.f});},z=()=>{g(false),x(null),c?.(false);},re=()=>{g(true),c?.(true);},J=Ae=>s?jsxs(motion.g,{initial:Ae,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:xe=>{xe.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:B,cy:_,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:B,cy:_,r:9,fill:Se,stroke:Z,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:B-3,y1:_-3,x2:B+3,y2:_+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:B+3,y1:_-3,x2:B-3,y2:_+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:z,onMouseMove:Je,children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:X,fill:Y,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:Y,opacity:.9,style:{pointerEvents:"none"}}),J({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Je,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:Y,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:X,fill:Y,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:Y,style:{pointerEvents:"none"}}),J({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Je,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:$,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:$,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:$,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Fi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),l=16,c=i=>i.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:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Ee={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let 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=i=>{i.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,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let m=r.get(i)||[];for(let d of m){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),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=Ee.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ee.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Ee.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=Ee.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=Ee.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Ee.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Ee.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ee.findTaskById(e,t);return !a||!a.dependencies?[]:Ee.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Ee.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ee.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let 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=Ee.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=>Ee.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=Ee.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"]],l=s.map(c=>{let i=c.startDate&&c.endDate?Ee.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Ee.formatDate(c.startDate):"N/A",c.endDate?Ee.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=Ee.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,l=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,v)=>b+v,0)/f.length},c=new Map,i=(h,f="")=>{[...h].sort((v,C)=>(v.position??0)-(C.position??0)).forEach((v,C)=>{let N=f?`${f}.${C+1}`:`${C+1}`;c.set(v.id,N),v.subtasks?.length&&i(v.subtasks,N);});};i(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?Ee.calculateDuration(h.startDate,h.endDate):0,b=h.effortMinutes,v=h.timeLoggedMinutes,C=h.soldEffortMinutes,N=typeof b=="number"?+(b/60).toFixed(1):0,T=typeof v=="number"?+(v/60).toFixed(1):0,k=typeof C=="number"?+(C/60).toFixed(1):0,w=h._costRate>0?h._costRate:l(h),E={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Ee.formatDate(h.startDate):"","End Date":h.endDate?Ee.formatDate(h.endDate):"","Duration (days)":f>0?f:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(S=>S.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":T||"","Quoted (h)":k||""};m&&(E["$ Estimated"]=N>0&&w>0?Math.round(N*w):"",E["$ Executed"]=T>0&&w>0?Math.round(T*w):"",E["$ Quoted"]=k>0&&w>0?Math.round(k*w):"",E["Rate ($/h)"]=w>0?w:"");let I=h.weight;return E["Weight (%)"]=typeof I=="number"&&I>0?I:"",E["Is Milestone"]=h.isMilestone?"Yes":"No",E}),p=a?.projectName||"";if(p||d.length>0){let h=0,f=0,b=0,v=0,C=0,N=0,T=0,k=0,w=o.filter(S=>S.startDate).map(S=>S.startDate.getTime()),E=o.filter(S=>S.endDate).map(S=>S.endDate.getTime());for(let S of d)typeof S["Estimated (h)"]=="number"&&(h+=S["Estimated (h)"]),typeof S["Logged (h)"]=="number"&&(f+=S["Logged (h)"]),typeof S["Quoted (h)"]=="number"&&(b+=S["Quoted (h)"]),m&&(typeof S["$ Estimated"]=="number"&&(v+=S["$ Estimated"]),typeof S["$ Executed"]=="number"&&(C+=S["$ Executed"]),typeof S["$ Quoted"]=="number"&&(N+=S["$ Quoted"])),typeof S["Progress (%)"]=="number"&&(T+=S["Progress (%)"],k++);let I={WBS:"0","Task Name":`\u{1F4CB} ${p||"PROJECT TOTAL"}`,"Start Date":w.length>0?Ee.formatDate(new Date(Math.min(...w))):"","End Date":E.length>0?Ee.formatDate(new Date(Math.max(...E))):"","Duration (days)":w.length>0&&E.length>0?Ee.calculateDuration(new Date(Math.min(...w)),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"]=v||"",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=v=>String(v).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=Ee.flattenTasks(e),o=new Map;r.forEach((p,g)=>{o.set(p.id,g+1);});let s=p=>p.toISOString().replace("Z",""),n=Ee.getEarliestStartDate(e)||new Date,l=Ee.getLatestEndDate(e)||new Date,c=r.map((p,g)=>{let y=o.get(p.id),x=p.startDate&&p.endDate?Ee.calculateDuration(p.startDate,p.endDate):0,h=(p.dependencies||[]).filter(f=>o.has(f)).map(f=>`
130
+ `})]});return createPortal(f,document.body)}function Di({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 hs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:p,strokeWidthOverride:d,glowFilter:m}){let[,g]=useState(false),[y,x]=useState(null),h=r-t,f=h>0,b=Math.abs(h)<5,v=20,C=!b&&a<=e,N,T,k=a-e,w=e+k/2;T=w;let F=8;if(n==="squared")if(b)N=`M ${e} ${t} L ${a} ${r}`;else if(C){let we=e+15,Oe=a-v,Be=f?t+20:t-20;T=Oe;let lt=f?1:-1;N=`M ${e} ${t} L ${we-F} ${t} Q ${we} ${t} ${we} ${t+lt*F} L ${we} ${Be-lt*F} Q ${we} ${Be} ${we-F} ${Be} L ${Oe+F} ${Be} Q ${Oe} ${Be} ${Oe} ${Be+lt*F} L ${Oe} ${r-lt*F} Q ${Oe} ${r} ${Oe+F} ${r} L ${a} ${r}`;}else {T=a-v;let Le=f?1:-1;N=`M ${e} ${t} L ${T-F} ${t} Q ${T} ${t} ${T} ${t+Le*F} L ${T} ${r-Le*F} Q ${T} ${r} ${T+F} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let I=6,S=5,X=`M ${a} ${r} L ${a-I} ${r-S/2} L ${a-I} ${r+S/2} Z`,O=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),$=p||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),A=d||1,q=o.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),Z="#f87171",Ee="rgba(248, 113, 113, 0.15)",B=T,_=(t+r)/2;if(y)if(n==="squared")if(b)B=Math.max(e+10,Math.min(a-10,y.x)),_=t;else if(C){let Le=e+15,we=a-v,Oe=f?t+20:t-20,Be=[[e,t,Le,t],[Le,t,Le,Oe],[Le,Oe,we,Oe],[we,Oe,we,r],[we,r,a,r]],lt=1/0,ee={x:B,y:_};for(let ct of Be){let pe=he(y.x,y.y,ct[0],ct[1],ct[2],ct[3]),et=Math.hypot(y.x-pe.x,y.y-pe.y);et<lt&&(lt=et,ee=pe);}B=ee.x,_=ee.y;}else {let Le=[[e,t,T,t],[T,t,T,r],[T,r,a,r]],we=1/0,Oe={x:B,y:_};for(let Be of Le){let lt=he(y.x,y.y,Be[0],Be[1],Be[2],Be[3]),ee=Math.hypot(y.x-lt.x,y.y-lt.y);ee<we&&(we=ee,Oe=lt);}B=Oe.x,_=Oe.y;}else {let Le=w,we=t,Oe=w,Be=r,lt=1/0,ee=B,ct=_;for(let pe=0;pe<=1;pe+=.02){let et=1-pe,nt=et*et*et*e+3*et*et*pe*Le+3*et*pe*pe*Oe+pe*pe*pe*a,Ut=et*et*et*t+3*et*et*pe*we+3*et*pe*pe*Be+pe*pe*pe*r,Ce=Math.hypot(y.x-nt,y.y-Ut);Ce<lt&&(lt=Ce,ee=nt,ct=Ut);}B=ee,_=ct;}function he(Le,we,Oe,Be,lt,ee){let ct=lt-Oe,pe=ee-Be,et=ct*ct+pe*pe;if(et===0)return {x:Oe,y:Be};let nt=((Le-Oe)*ct+(we-Be)*pe)/et;return nt=Math.max(0,Math.min(1,nt)),{x:Oe+nt*ct,y:Be+nt*pe}}let Ye=Le=>{let we=Le.currentTarget.ownerSVGElement;if(!we)return;let Oe=we.getScreenCTM();if(!Oe)return;let Be=Oe.inverse();x({x:Be.a*Le.clientX+Be.c*Le.clientY+Be.e,y:Be.b*Le.clientX+Be.d*Le.clientY+Be.f});},z=()=>{g(false),x(null),c?.(false);},re=()=>{g(true),c?.(true);},J=Le=>s?jsxs(motion.g,{initial:Le,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:we=>{we.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:B,cy:_,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:B,cy:_,r:9,fill:Ee,stroke:Z,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:B-3,y1:_-3,x2:B+3,y2:_+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:B+3,y1:_-3,x2:B-3,y2:_+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:z,onMouseMove:Ye,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})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Ye,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:Ye,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:$,strokeWidth:A,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:m||"none"}}),jsx(motion.path,{d:X,fill:$,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:$,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Fi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),l=16,c=i=>i.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:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Se={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=i=>{i.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let p=r.get(i)||[];for(let d of p){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),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=Se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Se.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=Se.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=Se.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=Se.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)=>Se.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Se.findTaskById(e,t);return !a||!a.dependencies?[]:Se.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Se.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Se.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=Se.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=>Se.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=Se.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"]],l=s.map(c=>{let i=c.startDate&&c.endDate?Se.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Se.formatDate(c.startDate):"N/A",c.endDate?Se.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=Se.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,l=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,v)=>b+v,0)/f.length},c=new Map,i=(h,f="")=>{[...h].sort((v,C)=>(v.position??0)-(C.position??0)).forEach((v,C)=>{let N=f?`${f}.${C+1}`:`${C+1}`;c.set(v.id,N),v.subtasks?.length&&i(v.subtasks,N);});};i(e);let p=s&&Object.keys(s).length>0||o.some(h=>h._costRate>0),d=o.map(h=>{let f=h.startDate&&h.endDate?Se.calculateDuration(h.startDate,h.endDate):0,b=h.effortMinutes,v=h.timeLoggedMinutes,C=h.soldEffortMinutes,N=typeof b=="number"?+(b/60).toFixed(1):0,T=typeof v=="number"?+(v/60).toFixed(1):0,k=typeof C=="number"?+(C/60).toFixed(1):0,w=h._costRate>0?h._costRate:l(h),F={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Se.formatDate(h.startDate):"","End Date":h.endDate?Se.formatDate(h.endDate):"","Duration (days)":f>0?f:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(S=>S.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":T||"","Quoted (h)":k||""};p&&(F["$ Estimated"]=N>0&&w>0?Math.round(N*w):"",F["$ Executed"]=T>0&&w>0?Math.round(T*w):"",F["$ Quoted"]=k>0&&w>0?Math.round(k*w):"",F["Rate ($/h)"]=w>0?w:"");let I=h.weight;return F["Weight (%)"]=typeof I=="number"&&I>0?I:"",F["Is Milestone"]=h.isMilestone?"Yes":"No",F}),m=a?.projectName||"";if(m||d.length>0){let h=0,f=0,b=0,v=0,C=0,N=0,T=0,k=0,w=o.filter(S=>S.startDate).map(S=>S.startDate.getTime()),F=o.filter(S=>S.endDate).map(S=>S.endDate.getTime());for(let S of d)typeof S["Estimated (h)"]=="number"&&(h+=S["Estimated (h)"]),typeof S["Logged (h)"]=="number"&&(f+=S["Logged (h)"]),typeof S["Quoted (h)"]=="number"&&(b+=S["Quoted (h)"]),p&&(typeof S["$ Estimated"]=="number"&&(v+=S["$ Estimated"]),typeof S["$ Executed"]=="number"&&(C+=S["$ Executed"]),typeof S["$ Quoted"]=="number"&&(N+=S["$ Quoted"])),typeof S["Progress (%)"]=="number"&&(T+=S["Progress (%)"],k++);let I={WBS:"0","Task Name":`\u{1F4CB} ${m||"PROJECT TOTAL"}`,"Start Date":w.length>0?Se.formatDate(new Date(Math.min(...w))):"","End Date":F.length>0?Se.formatDate(new Date(Math.max(...F))):"","Duration (days)":w.length>0&&F.length>0?Se.calculateDuration(new Date(Math.min(...w)),new Date(Math.max(...F))):"","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)||""};p&&(I["$ Estimated"]=v||"",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},...p?[{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=v=>String(v).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=Se.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Se.getEarliestStartDate(e)||new Date,l=Se.getLatestEndDate(e)||new Date,c=r.map((m,g)=>{let y=o.get(m.id),x=m.startDate&&m.endDate?Se.calculateDuration(m.startDate,m.endDate):0,h=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${o.get(f)}</PredecessorUID>
134
134
  <Type>1</Type>
@@ -139,36 +139,36 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
139
139
  <Task>
140
140
  <UID>${y}</UID>
141
141
  <ID>${g+1}</ID>
142
- <Name>${p.name.replace(/[<>&'"]/g,f=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[f]||f)}</Name>
142
+ <Name>${m.name.replace(/[<>&'"]/g,f=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[f]||f)}</Name>
143
143
  <Type>0</Type>
144
144
  <IsNull>0</IsNull>
145
145
  <CreateDate>${s(new Date)}</CreateDate>
146
146
  <WBS>${g+1}</WBS>
147
147
  <OutlineNumber>${g+1}</OutlineNumber>
148
- <OutlineLevel>${p.level||0}</OutlineLevel>
148
+ <OutlineLevel>${m.level||0}</OutlineLevel>
149
149
  <Priority>500</Priority>
150
- <Start>${p.startDate?s(p.startDate):""}</Start>
151
- <Finish>${p.endDate?s(p.endDate):""}</Finish>
150
+ <Start>${m.startDate?s(m.startDate):""}</Start>
151
+ <Finish>${m.endDate?s(m.endDate):""}</Finish>
152
152
  <Duration>PT${x*8}H0M0S</Duration>
153
153
  <DurationFormat>7</DurationFormat>
154
154
  <Work>PT${x*8}H0M0S</Work>
155
- <Stop>${p.endDate?s(p.endDate):""}</Stop>
156
- <Resume>${p.startDate?s(p.startDate):""}</Resume>
155
+ <Stop>${m.endDate?s(m.endDate):""}</Stop>
156
+ <Resume>${m.startDate?s(m.startDate):""}</Resume>
157
157
  <ResumeValid>0</ResumeValid>
158
158
  <EffortDriven>1</EffortDriven>
159
159
  <Recurring>0</Recurring>
160
160
  <OverAllocated>0</OverAllocated>
161
161
  <Estimated>0</Estimated>
162
- <Milestone>${p.isMilestone?"1":"0"}</Milestone>
163
- <Summary>${p.subtasks&&p.subtasks.length>0?"1":"0"}</Summary>
164
- <Critical>${p.isCriticalPath?"1":"0"}</Critical>
162
+ <Milestone>${m.isMilestone?"1":"0"}</Milestone>
163
+ <Summary>${m.subtasks&&m.subtasks.length>0?"1":"0"}</Summary>
164
+ <Critical>${m.isCriticalPath?"1":"0"}</Critical>
165
165
  <IsSubproject>0</IsSubproject>
166
166
  <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
167
167
  <ExternalTask>0</ExternalTask>
168
- <EarlyStart>${p.startDate?s(p.startDate):""}</EarlyStart>
169
- <EarlyFinish>${p.endDate?s(p.endDate):""}</EarlyFinish>
170
- <LateStart>${p.startDate?s(p.startDate):""}</LateStart>
171
- <LateFinish>${p.endDate?s(p.endDate):""}</LateFinish>
168
+ <EarlyStart>${m.startDate?s(m.startDate):""}</EarlyStart>
169
+ <EarlyFinish>${m.endDate?s(m.endDate):""}</EarlyFinish>
170
+ <LateStart>${m.startDate?s(m.startDate):""}</LateStart>
171
+ <LateFinish>${m.endDate?s(m.endDate):""}</LateFinish>
172
172
  <StartVariance>0</StartVariance>
173
173
  <FinishVariance>0</FinishVariance>
174
174
  <WorkVariance>0</WorkVariance>
@@ -176,22 +176,22 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
176
176
  <TotalSlack>0</TotalSlack>
177
177
  <FixedCost>0</FixedCost>
178
178
  <FixedCostAccrual>3</FixedCostAccrual>
179
- <PercentComplete>${p.progress}</PercentComplete>
180
- <PercentWorkComplete>${p.progress}</PercentWorkComplete>
179
+ <PercentComplete>${m.progress}</PercentComplete>
180
+ <PercentWorkComplete>${m.progress}</PercentWorkComplete>
181
181
  <Cost>0</Cost>
182
182
  <OvertimeCost>0</OvertimeCost>
183
183
  <OvertimeWork>PT0H0M0S</OvertimeWork>
184
- <ActualStart>${p.progress>0&&p.startDate?s(p.startDate):""}</ActualStart>
185
- <ActualFinish>${p.progress===100&&p.endDate?s(p.endDate):""}</ActualFinish>
186
- <ActualDuration>PT${Math.round(x*p.progress/100)*8}H0M0S</ActualDuration>
184
+ <ActualStart>${m.progress>0&&m.startDate?s(m.startDate):""}</ActualStart>
185
+ <ActualFinish>${m.progress===100&&m.endDate?s(m.endDate):""}</ActualFinish>
186
+ <ActualDuration>PT${Math.round(x*m.progress/100)*8}H0M0S</ActualDuration>
187
187
  <ActualCost>0</ActualCost>
188
188
  <ActualOvertimeCost>0</ActualOvertimeCost>
189
- <ActualWork>PT${Math.round(x*p.progress/100)*8}H0M0S</ActualWork>
189
+ <ActualWork>PT${Math.round(x*m.progress/100)*8}H0M0S</ActualWork>
190
190
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
191
191
  <RegularWork>PT${x*8}H0M0S</RegularWork>
192
- <RemainingDuration>PT${Math.round(x*(100-p.progress)/100)*8}H0M0S</RemainingDuration>
192
+ <RemainingDuration>PT${Math.round(x*(100-m.progress)/100)*8}H0M0S</RemainingDuration>
193
193
  <RemainingCost>0</RemainingCost>
194
- <RemainingWork>PT${Math.round(x*(100-p.progress)/100)*8}H0M0S</RemainingWork>
194
+ <RemainingWork>PT${Math.round(x*(100-m.progress)/100)*8}H0M0S</RemainingWork>
195
195
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
196
196
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
197
197
  <ACWP>0</ACWP>
@@ -214,8 +214,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
214
214
  </Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
215
215
  <Project xmlns="http://schemas.microsoft.com/project">
216
216
  <SaveVersion>14</SaveVersion>
217
- <Name>${t.replace(/[<>&'"]/g,p=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[p]||p)}</Name>
218
- <Title>${t.replace(/[<>&'"]/g,p=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[p]||p)}</Title>
217
+ <Name>${t.replace(/[<>&'"]/g,m=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[m]||m)}</Name>
218
+ <Title>${t.replace(/[<>&'"]/g,m=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[m]||m)}</Title>
219
219
  <CreationDate>${s(new Date)}</CreationDate>
220
220
  <LastSaved>${s(new Date)}</LastSaved>
221
221
  <ScheduleFromStart>1</ScheduleFromStart>
@@ -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([i],{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=Ee.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let m=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.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(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let m=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),p=s;if(d.length>0)for(let y of d){l(y);let x=n.get(y.id)?.ls||0;p=Math.min(p,x);}let g=p-m;n.set(i.id,{ls:g,lf:p});};a.forEach(l);let c=[];for(let i of a){let m=r.get(i.id),d=n.get(i.id);if(m&&d){let p=d.ls-m.es;Math.abs(p)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Ee.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 l=new Map,c=[],i=[];for(let p of r)(n.get(p.id)||0)===0&&i.push(p.id);for(;i.length>0;){let p=i.shift();c.push(p);let g=o.get(p);if(!g||!g.startDate||!g.endDate)continue;let y=Ee.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=l.get(f);b&&(x=Math.max(x,b.ef));}l.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&&i.push(f);}}if(c.length<r.length)return t;let m=Math.max(...Array.from(l.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=Ee.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=l.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=>l.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=Ee.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ee.calculateCriticalPath(e).includes(t))return 0;let o=Ee.getDependentTasks(e,t);if(o.length===0){let l=Ee.getLatestEndDate(e);if(!l)return null;let c=Ee.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=Ee.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Ee.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=Ee.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Ee.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let i=Ee.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=Ee.calculateEndDate(m,i),p=g=>g.map(y=>y.id===c.id?{...y,startDate:m,endDate:d}:y.subtasks?{...y,subtasks:p(y.subtasks)}:y);l=p(l),l=Ee.autoScheduleDependents(l,c.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),m=1e3*60*60*24,d=Ee.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=Ee.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(S=>S.id===f.id);if(b===-1)continue;let v=f.startDate.getTime(),N=(f.endDate.getTime()-v)/m,k=(v-i)/m*s,w=k+y*s,E=Math.max(N*s,s),I=l+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=Ee.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=m=>m.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ai({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="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([]),[S,X]=useState(null),[O,$]=useState(null),[F,Y]=useState(null),Z=useRef(false),[Se,B]=useState(new Set),[_,ye]=useState(null),Je=useCallback(H=>{if(F&&!Z.current){let le=H.target,D=false;for(;le&&le!==H.currentTarget;){if(le.getAttribute?.("data-dependency-line")==="true"||le.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}le=le.parentElement;}D||Y(null);}},[F]),z=useCallback(H=>{$(H);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,Ae=re*J*n,xe=H=>{let le=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),D=le.getUTCDay()||7;le.setUTCDate(le.getUTCDate()+4-D);let K=new Date(Date.UTC(le.getUTCFullYear(),0,1));return Math.ceil(((le.getTime()-K.getTime())/864e5+1)/7)},Ue=H=>{let le=H.getDay();return le===0||le===6},Re=useCallback(H=>{let le=Math.round(H/(J*n)),D=new Date(o);return D.setDate(D.getDate()+le),D},[o,J,n]),it=useCallback((H,le)=>{if(le.startDate&&le.endDate)return;let D=H.currentTarget.ownerSVGElement;if(!D)return;let K=D.createSVGPoint();K.x=H.clientX,K.y=H.clientY;let pe=K.matrixTransform(D.getScreenCTM()?.inverse()),Te=Re(pe.x),V=new Date(Te);V.setDate(V.getDate()+1),ye(null),y?.(le,Te,V);},[Re,y]),ee=useCallback((H,le,D)=>{let K=H.currentTarget.ownerSVGElement;if(!K)return;let pe=K.createSVGPoint();pe.x=H.clientX,pe.y=H.clientY;let Te=pe.matrixTransform(K.getScreenCTM()?.inverse()),V=Re(Te.x),Oe=Math.round(Te.x/(J*n))*J*n;ye({taskId:le.id,x:Oe,y:D*a+a/2,date:V});},[Re,J,n,a]),lt=useCallback(()=>{ye(null);},[]),de=useMemo(()=>{let H=pe=>pe.map(Te=>{if(Te.subtasks&&Te.subtasks.length>0){let V=H(Te.subtasks),te=V.filter(Oe=>Oe.startDate&&Oe.endDate);if(te.length>0){let Oe=te.map(Ke=>Ke.startDate.getTime()),De=te.map(Ke=>Ke.endDate.getTime()),We=new Date(Math.min(...Oe)),Fe=new Date(Math.max(...De));return {...Te,subtasks:V,startDate:We,endDate:Fe}}return {...Te,subtasks:V}}return Te}),le=(pe,Te=[])=>{let V=[...pe].sort((te,Oe)=>(te.position??0)-(Oe.position??0));for(let te of V)Te.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&le(te.subtasks,Te);return Te},D=H(e);return le(D)},[e]),dt=useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let le=H.startDate.getTime(),D=H.endDate.getTime(),K=o.getTime(),pe=(le-K)/(1e3*60*60*24),Te=(D-le)/(1e3*60*60*24)+1,V=pe*J*n,te=Math.max(J*n,40),Oe=Math.max(Te*J*n,te);return {x:V,width:Oe}},[o,J,n]),ot=useMemo(()=>de.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:le,width:D}=dt(H),pe=de.findIndex(Te=>Te.id===H.id)*a+(a-18)/2;return {id:H.id,x:le,y:pe,width:D,height:18}}),[de,dt]),At=useCallback((H,le,D)=>{if(!D){I([]),X(null);return}if(X({taskId:H,daysDelta:le}),le===0){I([]);return}let K=Ee.calculateCascadePreview(e,H,le,de,o,J*n,a,48);I(K);},[e,de,o,J,n,a,48]),we=useCallback((H,le)=>{if(!S)return le;let D=J*n,K=S.daysDelta*D;if(H===S.taskId)return {x:le.x+K,width:le.width};let pe=E.find(Te=>Te.taskId===H);return pe?{x:pe.previewX,width:pe.width}:le},[S,E,J,n]),vt=useMemo(()=>{let H=[],le=new Date(o);for(;le<=s;){let pe=(le.getTime()-o.getTime())/864e5*J*n;if(r==="day")H.push({date:new Date(le),label:le.toLocaleDateString(l,{day:"numeric",month:"short"}),x:pe}),le.setDate(le.getDate()+1);else if(r==="week"){let Te=xe(le);H.push({date:new Date(le),label:`${k.labels.week} ${Te}`,x:pe}),le.setDate(le.getDate()+7);}else H.push({date:new Date(le),label:le.toLocaleDateString(l,{month:"short",year:"numeric"}),x:pe}),le.setMonth(le.getMonth()+1);}return H},[o,s,r,J,n,l,k.labels.week]),gt=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),at=Math.max(de.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(Ae,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Ae,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),vt.map((H,le)=>jsxs("g",{children:[le>0&&jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${le}`)),gt>=0&&gt<=Ae&&jsxs("g",{children:[jsx("circle",{cx:gt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:gt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${gt-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(Ae,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(Ae,1e3),height:at,fill:t.bgPrimary}),de.map((H,le)=>jsx("rect",{x:0,y:le*a,width:Math.max(Ae,1e3),height:a,fill:le%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),vt.map((H,le)=>le>0?jsx("line",{x1:H.x,y1:0,x2:H.x,y2:de.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${le}`):null),C&&vt.map((H,le)=>{let D=vt[le+1]?.x||Ae;return Ue(H.date)?jsxs("g",{children:[jsx("rect",{x:H.x,y:0,width:D-H.x,height:de.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:H.x,y:0,width:D-H.x,height:de.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${le}`):null}),de.map((H,le)=>{let D=H.startDate&&H.endDate;return jsx("g",{children:!D&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:le*a,width:Ae,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>it(K,H),onMouseMove:K=>ee(K,H,le),onMouseLeave:()=>{lt();}},`clickable-${H.id}`),_&&_.taskId===H.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:_.x,y1:le*a+4,x2:_.x,y2:le*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:_.x,cy:_.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:_.x,cy:_.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${_.x}, ${le*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:_.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!_||_.taskId!==H.id)&&jsx("text",{x:gt>0?gt:100,y:le*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:k.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),de.map((H,le)=>{if(!H.startDate||!H.endDate)return null;let{x:D,width:K}=dt(H),pe=le*a+(a-18)/2,Te=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsx(Fi,{task:H,x:D+K/2,y:pe+12,theme:t,onClick:d},H.id);if(Te){let V=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),te=8,Oe=pe+(a-18)/2+(18-te)/2,De=4,We=H.progress||0,Fe=new Date;Fe.setHours(0,0,0,0);let Ke=H.startDate&&Fe>=H.startDate,ft=H.endDate&&(()=>{let bt=new Date(H.endDate);return bt.setHours(0,0,0,0),Fe>bt})(),ct=H.startDate&&Fe<H.startDate,pt=1;if(Ke&&H.startDate&&H.endDate&&!ct){let bt=new Date(H.startDate);bt.setHours(0,0,0,0);let Ut=new Date(H.endDate);Ut.setHours(0,0,0,0);let Ve=Math.max(1,(Ut.getTime()-bt.getTime())/(1e3*60*60*24)),nt=Math.min((Fe.getTime()-bt.getTime())/(1e3*60*60*24),Ve)/Ve*100;pt=nt>0?We/nt:1;}let rt;We>=100?rt="#00E5CC":ct?rt="#4B5563":ft&&We<100?rt="#EF4444":pt>=.95?rt="#22C55E":pt>=.8?rt="#F59E0B":rt="#EF4444";let Gt=Math.max(We/100*K,We>0?De*2:0),Mt=K>100&&We>0,Dt=H.isCriticalPath;return jsxs("g",{onClick:()=>d?.(H),onContextMenu:bt=>{bt.preventDefault(),bt.stopPropagation(),g?.(H,bt);},onMouseMove:bt=>{z({task:H,x:D,y:Oe,width:K,height:te,showBelow:Oe<100,mouseX:bt.clientX,mouseY:bt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:b?Dt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:D,y:pe,width:K,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:D,y:Oe,width:K,height:te,rx:De,fill:V?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),We>0&&jsx("rect",{x:D,y:Oe,width:Gt,height:te,rx:De,fill:rt}),b&&Dt&&jsx("rect",{x:D,y:Oe,width:K,height:te,rx:De,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Mt&&jsxs("text",{x:D+Gt+6,y:Oe+te/2,dominantBaseline:"central",fill:V?"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(We),"%"]})]},H.id)}return jsx(Ni,{task:H,x:D,y:pe,width:K,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:d,onDoubleClick:p,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:ot,onDragMove:At,onHoverChange:z,showBaseline:f,showTaskBarLabels:m,showCriticalPath:b,readOnly:N?!N(H):false},H.id)}),v&&de.map((H,le)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(D=>{let K=de.find(rt=>rt.id===D);if(!K||!K.startDate||!K.endDate)return null;let pe=de.findIndex(rt=>rt.id===D),Te=we(K.id,dt(K)),V=we(H.id,dt(H)),te=Te.x+Te.width,Oe=pe*a+26,De=V.x,We=le*a+26,Fe=`dep-${D}-${H.id}`;if(Se.has(Fe))return null;let Ke=b&&H.isCriticalPath&&K.isCriticalPath;return jsx(hs,{x1:te,y1:Oe,x2:De,y2:We,theme:t,lineStyle:i,colorOverride:b?Ke?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?Ke?2:1:void 0,glowFilter:Ke?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(H.id,D),onHoverChange:rt=>{Z.current=rt,rt&&Y({key:Fe,fromId:D,toId:H.id,exitX:te,exitY:Oe,enterX:De,enterY:We});}},Fe)})),E.map(H=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),v&&F&&jsx(hs,{x1:F.exitX,y1:F.exitY,x2:F.enterX,y2:F.enterY,theme:t,lineStyle:i,onDelete:()=>{let H=F.key;Y(null),Z.current=false,B(le=>new Set(le).add(H)),h?.(F.toId,F.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{Z.current=H,H||Y(null);}},`${F.key}-hover-overlay`),gt>=0&&gt<=Ae&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:gt,y1:0,x2:gt,y2:at,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:gt,y1:0,x2:gt,y2:at,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsx(ym,{tooltipData:O,theme:t,locale:l==="es"?"es":"en"})]})}var Fv=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],wm=({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"})}),Pv=()=>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"})}),Av=()=>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"})}),Lv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Iv=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Bi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,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),[S,X]=useState(0),O=useRef(null),$=useRef(null),F=useRef(null),Y=useRef(null),{enabled:Z=true,placeholder:Se='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:_,suggestions:ye=Fv,maxHistory:Je=50,persistHistory:z,mentionableUsers:re=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ae=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",xe=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)",Re=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",it=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ee=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",lt=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",de=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",dt=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ot=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",At=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)",we=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",vt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",gt=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)",H=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",le=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",K=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",pe=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Te="rgba(46, 148, 255, 0.04)",V=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)",Oe=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",De=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",We=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Fe=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ke=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ft=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ct="rgba(46, 148, 255, 0.06)",pt=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",rt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Gt=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Mt=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Dt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",wt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",bt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ut=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ve=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Le=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",nt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",oe=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",be=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=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",q=z?.storageKey||"gantt-ai-history",me=z?.maxMessages??5,Ne=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),Xe=useCallback(U=>{if(h(U),re.length===0)return;let ne=O.current;if(!ne)return;let He=ne.selectionStart||U.length,A=U.slice(0,He),ge=A.lastIndexOf("@");if(ge>=0&&((ge>0?A[ge-1]:" ")===" "||ge===0)){let et=A.slice(ge+1);if(et.length<=40){T(et),w(ge),I(true),X(0);return}}I(false),T(""),w(-1);},[re.length]),_e=useCallback(U=>{let ne=x.slice(0,k),He=x.slice(k+1+N.length),A=`${ne}@${U.name} ${He}`;h(A),I(false),T(""),w(-1),setTimeout(()=>O.current?.focus(),0);},[x,k,N]),$e=useCallback(U=>{if(!E||Ne.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),X(ne=>ne<Ne.length-1?ne+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),X(ne=>ne>0?ne-1:Ne.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let ne=Ne[S];return ne&&_e(ne),true}return U.key==="Escape"?(I(false),true):false},[E,Ne,S,_e]);useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(q);if(U){let He=JSON.parse(U).map(A=>({...A,timestamp:new Date(A.timestamp)}));y(He.slice(-me));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,q,me]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(ne=>!ne.isLoading).slice(-me);localStorage.setItem(q,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,q,me]),useEffect(()=>{$.current&&$.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,d]);let kt=useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&c?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,c]),mt=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 He={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(A=>[...A,He]);try{if(_){let A=await _(U,e);y(ge=>{let je=ge.filter(oa=>!oa.isLoading),et={id:`assistant-${Date.now()}`,role:"assistant",content:A.message,timestamp:new Date,command:A};return [...je,et]}),kt(A);}else y(A=>[...A.filter(je=>!je.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(et=>!et.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,_,e,kt]),Wt=U=>{U.preventDefault(),mt(x);},Ta=U=>{h(U),O.current?.focus();};if(useEffect(()=>{let U=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="k"&&(ne.preventDefault(),m(He=>!He),i||p(false)),ne.key==="Escape"&&i&&m(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=He=>{let A=He.target;F.current&&!F.current.contains(A)&&m(false);},ne=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(ne),document.removeEventListener("mousedown",U);}},[i]),!Z)return null;let Xt={"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(Qt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${Xt[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ae,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${xe}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ue,overflow:"visible"},onClick:()=>m(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Re}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${it}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(wm,{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:de,background:ee,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${lt}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
361
+ </Project>`,p=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(p),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Se.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let p=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.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 m=d+p;r.set(i.id,{es:d,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let p=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),m=s;if(d.length>0)for(let y of d){l(y);let x=n.get(y.id)?.ls||0;m=Math.min(m,x);}let g=m-p;n.set(i.id,{ls:g,lf:m});};a.forEach(l);let c=[];for(let i of a){let p=r.get(i.id),d=n.get(i.id);if(p&&d){let m=d.ls-p.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Se.flattenTasks(e).filter(m=>m.startDate&&m.endDate);if(r.length===0)return t;let o=new Map(r.map(m=>[m.id,m])),s=new Map;for(let m of r)s.has(m.id)||s.set(m.id,[]);for(let m of r)if(m.dependencies){for(let g of m.dependencies)if(o.has(g)){let y=s.get(g);y&&y.push(m.id);}}let n=new Map;for(let m of r)n.set(m.id,0);for(let m of r)if(m.dependencies)for(let g of m.dependencies)o.has(g)&&n.set(m.id,(n.get(m.id)||0)+1);let l=new Map,c=[],i=[];for(let m of r)(n.get(m.id)||0)===0&&i.push(m.id);for(;i.length>0;){let m=i.shift();c.push(m);let g=o.get(m);if(!g||!g.startDate||!g.endDate)continue;let y=Se.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=l.get(f);b&&(x=Math.max(x,b.ef));}l.set(m,{es:x,ef:x+y});let h=s.get(m)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&i.push(f);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(l.values()).map(m=>m.ef)),d=new Map;for(let m=c.length-1;m>=0;m--){let g=c[m];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=Se.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=p;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 m of c){let g=l.get(m),y=d.get(m),x=y.ls-g.es,h=s.get(m)||[],f;h.length>0?f=Math.min(...h.map(b=>l.get(b).es))-g.ef:f=p-g.ef,t.set(m,{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=Se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Se.calculateCriticalPath(e).includes(t))return 0;let o=Se.getDependentTasks(e,t);if(o.length===0){let l=Se.getLatestEndDate(e);if(!l)return null;let c=Se.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=Se.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Se.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=Se.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Se.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let i=Se.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),p<y&&(p=y);}let d=Se.calculateEndDate(p,i),m=g=>g.map(y=>y.id===c.id?{...y,startDate:p,endDate:d}:y.subtasks?{...y,subtasks:m(y.subtasks)}:y);l=m(l),l=Se.autoScheduleDependents(l,c.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),p=1e3*60*60*24,d=Se.findTaskById(e,t);if(!d||!d.endDate)return [];let m=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=Se.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(S=>S.id===f.id);if(b===-1)continue;let v=f.startDate.getTime(),N=(f.endDate.getTime()-v)/p,k=(v-i)/p*s,w=k+y*s,F=Math.max(N*s,s),I=l+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:k,previewX:w,width:F,y:I,rowIndex:b,daysDelta:y,color:f.color}),m(f.id,y,x);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Se.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=p=>p.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ai({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:p=true,onTaskClick:d,onTaskDblClick:m,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),[F,I]=useState([]),[S,X]=useState(null),[O,$]=useState(null),[A,q]=useState(null),Z=useRef(false),[Ee,B]=useState(new Set),[_,he]=useState(null),Ye=useCallback(H=>{if(A&&!Z.current){let ne=H.target,D=false;for(;ne&&ne!==H.currentTarget;){if(ne.getAttribute?.("data-dependency-line")==="true"||ne.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}ne=ne.parentElement;}D||q(null);}},[A]),z=useCallback(H=>{$(H);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,Le=re*J*n,we=H=>{let ne=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),D=ne.getUTCDay()||7;ne.setUTCDate(ne.getUTCDate()+4-D);let K=new Date(Date.UTC(ne.getUTCFullYear(),0,1));return Math.ceil(((ne.getTime()-K.getTime())/864e5+1)/7)},Oe=H=>{let ne=H.getDay();return ne===0||ne===6},Be=useCallback(H=>{let ne=Math.round(H/(J*n)),D=new Date(o);return D.setDate(D.getDate()+ne),D},[o,J,n]),lt=useCallback((H,ne)=>{if(ne.startDate&&ne.endDate)return;let D=H.currentTarget.ownerSVGElement;if(!D)return;let K=D.createSVGPoint();K.x=H.clientX,K.y=H.clientY;let ce=K.matrixTransform(D.getScreenCTM()?.inverse()),Te=Be(ce.x),V=new Date(Te);V.setDate(V.getDate()+1),he(null),y?.(ne,Te,V);},[Be,y]),ee=useCallback((H,ne,D)=>{let K=H.currentTarget.ownerSVGElement;if(!K)return;let ce=K.createSVGPoint();ce.x=H.clientX,ce.y=H.clientY;let Te=ce.matrixTransform(K.getScreenCTM()?.inverse()),V=Be(Te.x),$e=Math.round(Te.x/(J*n))*J*n;he({taskId:ne.id,x:$e,y:D*a+a/2,date:V});},[Be,J,n,a]),ct=useCallback(()=>{he(null);},[]),pe=useMemo(()=>{let H=ce=>ce.map(Te=>{if(Te.subtasks&&Te.subtasks.length>0){let V=H(Te.subtasks),te=V.filter($e=>$e.startDate&&$e.endDate);if(te.length>0){let $e=te.map(Ge=>Ge.startDate.getTime()),Ne=te.map(Ge=>Ge.endDate.getTime()),He=new Date(Math.min(...$e)),Fe=new Date(Math.max(...Ne));return {...Te,subtasks:V,startDate:He,endDate:Fe}}return {...Te,subtasks:V}}return Te}),ne=(ce,Te=[])=>{let V=[...ce].sort((te,$e)=>(te.position??0)-($e.position??0));for(let te of V)Te.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&ne(te.subtasks,Te);return Te},D=H(e);return ne(D)},[e]),et=useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let ne=H.startDate.getTime(),D=H.endDate.getTime(),K=o.getTime(),ce=(ne-K)/(1e3*60*60*24),Te=(D-ne)/(1e3*60*60*24)+1,V=ce*J*n,te=Math.max(J*n,40),$e=Math.max(Te*J*n,te);return {x:V,width:$e}},[o,J,n]),nt=useMemo(()=>pe.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:ne,width:D}=et(H),ce=pe.findIndex(Te=>Te.id===H.id)*a+(a-18)/2;return {id:H.id,x:ne,y:ce,width:D,height:18}}),[pe,et]),Ut=useCallback((H,ne,D)=>{if(!D){I([]),X(null);return}if(X({taskId:H,daysDelta:ne}),ne===0){I([]);return}let K=Se.calculateCascadePreview(e,H,ne,pe,o,J*n,a,48);I(K);},[e,pe,o,J,n,a,48]),Ce=useCallback((H,ne)=>{if(!S)return ne;let D=J*n,K=S.daysDelta*D;if(H===S.taskId)return {x:ne.x+K,width:ne.width};let ce=F.find(Te=>Te.taskId===H);return ce?{x:ce.previewX,width:ce.width}:ne},[S,F,J,n]),mt=useMemo(()=>{let H=[],ne=new Date(o);for(;ne<=s;){let ce=(ne.getTime()-o.getTime())/864e5*J*n;if(r==="day")H.push({date:new Date(ne),label:ne.toLocaleDateString(l,{day:"numeric",month:"short"}),x:ce}),ne.setDate(ne.getDate()+1);else if(r==="week"){let Te=we(ne);H.push({date:new Date(ne),label:`${k.labels.week} ${Te}`,x:ce}),ne.setDate(ne.getDate()+7);}else H.push({date:new Date(ne),label:ne.toLocaleDateString(l,{month:"short",year:"numeric"}),x:ce}),ne.setMonth(ne.getMonth()+1);}return H},[o,s,r,J,n,l,k.labels.week]),Dt=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),Xe=Math.max(pe.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(Le,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Le,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),mt.map((H,ne)=>jsxs("g",{children:[ne>0&&jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${ne}`)),Dt>=0&&Dt<=Le&&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(Le,1e3),height:Xe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ye,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(Le,1e3),height:Xe,fill:t.bgPrimary}),pe.map((H,ne)=>jsx("rect",{x:0,y:ne*a,width:Math.max(Le,1e3),height:a,fill:ne%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),mt.map((H,ne)=>ne>0?jsx("line",{x1:H.x,y1:0,x2:H.x,y2:pe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${ne}`):null),C&&mt.map((H,ne)=>{let D=mt[ne+1]?.x||Le;return Oe(H.date)?jsxs("g",{children:[jsx("rect",{x:H.x,y:0,width:D-H.x,height:pe.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:H.x,y:0,width:D-H.x,height:pe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${ne}`):null}),pe.map((H,ne)=>{let D=H.startDate&&H.endDate;return jsx("g",{children:!D&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:ne*a,width:Le,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>lt(K,H),onMouseMove:K=>ee(K,H,ne),onMouseLeave:()=>{ct();}},`clickable-${H.id}`),_&&_.taskId===H.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:_.x,y1:ne*a+4,x2:_.x,y2:ne*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:_.x,cy:_.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:_.x,cy:_.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${_.x}, ${ne*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:_.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!_||_.taskId!==H.id)&&jsx("text",{x:Dt>0?Dt:100,y:ne*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-${H.id}`)]})},`row-group-${H.id}`)}),pe.map((H,ne)=>{if(!H.startDate||!H.endDate)return null;let{x:D,width:K}=et(H),ce=ne*a+(a-18)/2,Te=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsx(Fi,{task:H,x:D+K/2,y:ce+12,theme:t,onClick:d},H.id);if(Te){let V=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),te=8,$e=ce+(a-18)/2+(18-te)/2,Ne=4,He=H.progress||0,Fe=new Date;Fe.setHours(0,0,0,0);let Ge=H.startDate&&Fe>=H.startDate,ht=H.endDate&&(()=>{let yt=new Date(H.endDate);return yt.setHours(0,0,0,0),Fe>yt})(),dt=H.startDate&&Fe<H.startDate,gt=1;if(Ge&&H.startDate&&H.endDate&&!dt){let yt=new Date(H.startDate);yt.setHours(0,0,0,0);let $t=new Date(H.endDate);$t.setHours(0,0,0,0);let We=Math.max(1,($t.getTime()-yt.getTime())/(1e3*60*60*24)),at=Math.min((Fe.getTime()-yt.getTime())/(1e3*60*60*24),We)/We*100;gt=at>0?He/at:1;}let ot;He>=100?ot="#00E5CC":dt?ot="#4B5563":ht&&He<100?ot="#EF4444":gt>=.95?ot="#22C55E":gt>=.8?ot="#F59E0B":ot="#EF4444";let jt=Math.max(He/100*K,He>0?Ne*2:0),Et=K>100&&He>0,Nt=H.isCriticalPath;return jsxs("g",{onClick:()=>d?.(H),onContextMenu:yt=>{yt.preventDefault(),yt.stopPropagation(),g?.(H,yt);},onMouseMove:yt=>{z({task:H,x:D,y:$e,width:K,height:te,showBelow:$e<100,mouseX:yt.clientX,mouseY:yt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:b?Nt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:D,y:ce,width:K,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:D,y:$e,width:K,height:te,rx:Ne,fill:V?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),He>0&&jsx("rect",{x:D,y:$e,width:jt,height:te,rx:Ne,fill:ot}),b&&Nt&&jsx("rect",{x:D,y:$e,width:K,height:te,rx:Ne,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Et&&jsxs("text",{x:D+jt+6,y:$e+te/2,dominantBaseline:"central",fill:V?"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),"%"]})]},H.id)}return jsx(Ni,{task:H,x:D,y:ce,width:K,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:d,onDoubleClick:m,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:nt,onDragMove:Ut,onHoverChange:z,showBaseline:f,showTaskBarLabels:p,showCriticalPath:b,readOnly:N?!N(H):false},H.id)}),v&&pe.map((H,ne)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(D=>{let K=pe.find(ot=>ot.id===D);if(!K||!K.startDate||!K.endDate)return null;let ce=pe.findIndex(ot=>ot.id===D),Te=Ce(K.id,et(K)),V=Ce(H.id,et(H)),te=Te.x+Te.width,$e=ce*a+26,Ne=V.x,He=ne*a+26,Fe=`dep-${D}-${H.id}`;if(Ee.has(Fe))return null;let Ge=b&&H.isCriticalPath&&K.isCriticalPath;return jsx(hs,{x1:te,y1:$e,x2:Ne,y2:He,theme:t,lineStyle:i,colorOverride:b?Ge?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?Ge?2:1:void 0,glowFilter:Ge?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(H.id,D),onHoverChange:ot=>{Z.current=ot,ot&&q({key:Fe,fromId:D,toId:H.id,exitX:te,exitY:$e,enterX:Ne,enterY:He});}},Fe)})),F.map(H=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),v&&A&&jsx(hs,{x1:A.exitX,y1:A.exitY,x2:A.enterX,y2:A.enterY,theme:t,lineStyle:i,onDelete:()=>{let H=A.key;q(null),Z.current=false,B(ne=>new Set(ne).add(H)),h?.(A.toId,A.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{Z.current=H,H||q(null);}},`${A.key}-hover-overlay`),Dt>=0&&Dt<=Le&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:Dt,y1:0,x2:Dt,y2:Xe,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:Dt,y1:0,x2:Dt,y2:Xe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsx(xm,{tooltipData:O,theme:t,locale:l==="es"?"es":"en"})]})}var Pv=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],km=({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"})}),Av=()=>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"})}),Lv=()=>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"})}),Iv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Bv=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Bi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,p]=useState(false),[d,m]=useState(false),[g,y]=useState([]),[x,h]=useState(""),[f,b]=useState(false),[v,C]=useState(true),[N,T]=useState(""),[k,w]=useState(-1),[F,I]=useState(false),[S,X]=useState(0),O=useRef(null),$=useRef(null),A=useRef(null),q=useRef(null),{enabled:Z=true,placeholder:Ee='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:_,suggestions:he=Pv,maxHistory:Ye=50,persistHistory:z,mentionableUsers:re=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Le=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",we=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Oe=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)",lt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ee=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",ct=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",pe=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",et=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",nt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Ut=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)",Ce=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",mt=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)",Xe=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ne=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",K=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ce=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Te="rgba(46, 148, 255, 0.04)",V=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)",$e=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ne=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)",Fe=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ge=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ht=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",dt="rgba(46, 148, 255, 0.06)",gt=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",ot=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",jt=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Et=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Nt=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)",yt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",$t=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",We=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Re=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",at=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ie=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",me=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=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Y=z?.storageKey||"gantt-ai-history",ge=z?.maxMessages??5,De=re.filter(U=>{if(!N)return true;let Ze=N.toLowerCase();return U.name.toLowerCase().includes(Ze)||U.email&&U.email.toLowerCase().includes(Ze)}).slice(0,5),Je=useCallback(U=>{if(h(U),re.length===0)return;let Ze=O.current;if(!Ze)return;let ye=Ze.selectionStart||U.length,E=U.slice(0,ye),fe=E.lastIndexOf("@");if(fe>=0&&((fe>0?E[fe-1]:" ")===" "||fe===0)){let tt=E.slice(fe+1);if(tt.length<=40){T(tt),w(fe),I(true),X(0);return}}I(false),T(""),w(-1);},[re.length]),_e=useCallback(U=>{let Ze=x.slice(0,k),ye=x.slice(k+1+N.length),E=`${Ze}@${U.name} ${ye}`;h(E),I(false),T(""),w(-1),setTimeout(()=>O.current?.focus(),0);},[x,k,N]),ze=useCallback(U=>{if(!F||De.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),X(Ze=>Ze<De.length-1?Ze+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),X(Ze=>Ze>0?Ze-1:De.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let Ze=De[S];return Ze&&_e(Ze),true}return U.key==="Escape"?(I(false),true):false},[F,De,S,_e]);useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(Y);if(U){let ye=JSON.parse(U).map(E=>({...E,timestamp:new Date(E.timestamp)}));y(ye.slice(-ge));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,Y,ge]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(Ze=>!Ze.isLoading).slice(-ge);localStorage.setItem(Y,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,Y,ge]),useEffect(()=>{$.current&&$.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,d]);let vt=useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&c?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,c]),ut=useCallback(async U=>{if(!U.trim()||f)return;let Ze={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};y(E=>[...E.slice(-(Ye-1)),Ze]),h(""),C(false),b(true);let ye={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(E=>[...E,ye]);try{if(_){let E=await _(U,e);y(fe=>{let je=fe.filter(ra=>!ra.isLoading),tt={id:`assistant-${Date.now()}`,role:"assistant",content:E.message,timestamp:new Date,command:E};return [...je,tt]}),vt(E);}else y(E=>[...E.filter(je=>!je.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(E){y(fe=>[...fe.filter(tt=>!tt.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${E instanceof Error?E.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,Ye,_,e,vt]),Wt=U=>{U.preventDefault(),ut(x);},ha=U=>{h(U),O.current?.focus();};if(useEffect(()=>{let U=Ze=>{(Ze.metaKey||Ze.ctrlKey)&&Ze.key==="k"&&(Ze.preventDefault(),p(ye=>!ye),i||m(false)),Ze.key==="Escape"&&i&&p(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=ye=>{let E=ye.target;A.current&&!A.current.contains(E)&&p(false);},Ze=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(Ze),document.removeEventListener("mousedown",U);}},[i]),!Z)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(Jt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ta[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Le,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${we}`,color:"#2E94FF",cursor:"pointer",boxShadow:Oe,overflow:"visible"},onClick:()=>p(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 ${lt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(km,{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:pe,background:ee,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${ct}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
362
362
  @keyframes ai-fab-pulse {
363
363
  0%, 100% { transform: scale(1); opacity: 0.4; }
364
364
  50% { transform: scale(1.15); opacity: 0; }
365
365
  }
366
- `})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref: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 ${Xt[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:dt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ot}`,boxShadow:At},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:we,borderBottom:`1px solid ${vt}`},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:gt,border:`1px solid ${at}`,color:"#2E94FF"},children:jsx(wm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:le},onMouseEnter:U=>{U.currentTarget.style.background=K,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=le;},children:jsx(Lv,{})}),jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:le},onMouseEnter:U=>{U.currentTarget.style.background=K,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=le;},children:jsx(Av,{})})]})]}),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:pe,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:ye.slice(0,4).map((U,ne)=>jsx("button",{onClick:()=>Ta(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Te,color:te,border:`1px solid ${V}`},onMouseEnter:He=>{He.currentTarget.style.borderColor=Oe,He.currentTarget.style.color="#2E94FF";},onMouseLeave:He=>{He.currentTarget.style.borderColor=V,He.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"?De:Fe,color:U.role==="user"?"#2E94FF":ft,border:U.role==="user"?`1px solid ${We}`:`1px solid ${Ke}`},children:[U.isLoading?jsx(Iv,{}):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:$})]}),jsxs("form",{onSubmit:U=>{if(E&&Ne.length>0){U.preventDefault();return}Wt(U);},className:"p-3 relative",style:{borderTop:`1px solid ${ct}`},children:[jsx(AnimatePresence,{children:E&&Ne.length>0&&jsx(motion.div,{ref:Y,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:Ut,border:`1px solid ${Ve}`,boxShadow:Le,backdropFilter:"blur(12px)"},children:Ne.map((U,ne)=>jsxs("button",{type:"button",onClick:()=>_e(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ne===S?nt:"transparent",color:oe},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 ${j}`,color:"#2E94FF"},children:U.name.split(" ").map(He=>He[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:be},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:pt,border:`1px solid ${rt}`},children:[jsx("input",{ref:O,type:"text",value:x,onChange:U=>Xe(U.target.value),onKeyDown:U=>{$e(U);},placeholder:Se,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Gt,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()?Mt:"transparent",color:x.trim()?"#2E94FF":wt,border:x.trim()?`1px solid ${Dt}`:"1px solid transparent"},children:jsx(Pv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:bt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function km(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,m=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;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(i=>{if(i.past.length===0)return i;let m=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let m=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:m,future:d}});},[]),c=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Cm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&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 $v={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ee.formatDate(e.startDate)} - ${Ee.formatDate(e.endDate)}`);let a=Ee.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Ee.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Tm(e){return {...$v,...e}}var _v=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Sm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=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:S,onViewModeChange:X,projectForecast:O,onThemeChange:$,onTaskClick:F,onTaskDblClick:Y,onTaskContextMenu:Z,onTaskUpdate:Se,onDependentTasksScheduled:B,onProgressChange:_,onTaskEdit:ye,onTaskAddSubtask:Je,onTaskMarkIncomplete:z,onTaskSetInProgress:re,onDependencyCreate:J,onDependencyDelete:Ae,onBeforeTaskAdd:xe,onAfterTaskAdd:Ue,onBeforeTaskUpdate:Re,onAfterTaskUpdate:it,onBeforeTaskDelete:ee,onAfterTaskDelete:lt,permissions:de,onCopySnapshotLink:dt}=a,At=useContext(hi)?.theme,[we,vt]=useState(At||s||"dark"),[gt,at]=useState(n),[H,le]=useState(l),[D,K]=useState(1),[pe,Te]=useState("all"),[V,te]=useState(S||"execution"),Oe=S??V,De=useCallback(P=>{te(P),X?.(P);},[X]),We=I??Oe==="oracle",[Fe,Ke]=useState(a.showCriticalPath!==false),[ft,ct]=useState(a.showDependencies!==false),[pt,rt]=useState(a.highlightWeekends!==false),Gt=useCallback(P=>{Ke(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),Mt=useCallback(P=>{ct(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),Dt=useCallback(P=>{rt(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(gt);},[gt]),useEffect(()=>{a.onZoomChange?.(D);},[D]);let wt=useRef(a.onDateRangeChange);wt.current=a.onDateRangeChange;let bt=useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Ut,Ve]=useState(()=>{if(!x)return "all";try{let P=typeof x=="string"?x:"gantt-filter-state",R=localStorage.getItem(P);if(R){let G=JSON.parse(R);if(G.taskFilter)return G.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),Le=k??Ut,nt=w??Ve,[oe,be]=useState(()=>{if(!x)return false;try{let P=typeof x=="string"?x:"gantt-filter-state",R=localStorage.getItem(P);if(R){let G=JSON.parse(R);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});useEffect(()=>{let P=bt();if(P)try{let R={taskFilter:Le,hideCompleted:oe};localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Le,oe,bt]);let L=useRef(h);useEffect(()=>{if(L.current!==h&&h!==void 0){Ve("all"),be(false);let P=bt();if(P)try{localStorage.removeItem(P);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}L.current=h;},[h,bt]);let[j,q]=useState(0),[me,Ne]=useState(false),[Xe,_e]=useState(null),[$e,kt]=useState({isOpen:false,x:0,y:0,task:null}),[mt,Wt]=useState(null),[Ta,Xt]=useState(null);useEffect(()=>{At&&At!==we&&vt(At);},[At]),useEffect(()=>{s&&s!==we&&vt(s);},[s]);let U=useCallback(P=>{vt(P),$?.(P);},[$]),{state:ne,setState:He,undo:A,redo:ge,canUndo:je,canRedo:et,clearHistory:oa}=km(t,50),jt=useMemo(()=>{let P=(R,G=0)=>{let Q=G;for(let ke of R)ke.subtasks?.length&&(Q=Math.max(Q,P(ke.subtasks,G+1)));return Q};return P(ne)+1},[ne]),La=useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),_a=useRef(new Map),Ia=useRef(false);if(!Ia.current&&y){Ia.current=true;let P=typeof y=="string"?y:"gantt-expanded-tasks";try{let R=localStorage.getItem(P);if(R){let G=JSON.parse(R);Array.isArray(G)&&(_a.current=new Map(G));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let ma=useCallback(()=>{let P=La();if(P)try{let R=Array.from(_a.current.entries());localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[La]),dr=useRef(0),Kn=useRef(ne);useEffect(()=>{Kn.current=ne;},[ne]);let Hr=useRef(false),M=useCallback(P=>{Te(P),dr.current+=1,He(R=>{let G=(ke,Pe=0)=>ke.map(Ft=>{let ut=P==="all"||Pe<P-1;return Ft.subtasks?.length&&_a.current.set(Ft.id,ut),{...Ft,isExpanded:ut,subtasks:Ft.subtasks?G(Ft.subtasks,Pe+1):void 0}}),Q=G(R);return ma(),Q});},[He,ma]);useEffect(()=>{if(dr.current>0){dr.current-=1;return}let P=G=>{let Q=new Map;for(let ke of G){let Pe=ke.id;Q.get(Pe)||Q.set(Pe,ke);}return Array.from(Q.values())},R=G=>G.map(Q=>{let ke=_a.current.get(Q.id),Pe=ke!==void 0?{...Q,isExpanded:ke}:Q;if(Pe.subtasks?.length){let Ft=P(Pe.subtasks);return {...Pe,subtasks:R(Ft)}}return Pe});if(_a.current.size>0)He(Rr(R(t)));else {let G=Q=>Q.map(ke=>ke.subtasks?.length?{...ke,subtasks:P(G(ke.subtasks))}:ke);He(Rr(G(t)));}},[t,He]);let se=useRef(t),Ce=useRef(true);useEffect(()=>{if(Ce.current){Ce.current=false,se.current=ne;return}if(Hr.current){Hr.current=false,se.current=ne;return}if(!r)return;let P=JSON.stringify(se.current),R=JSON.stringify(ne);P!==R&&(se.current=ne,r(ne));},[ne,r]);let ve=useMemo(()=>xd(b,v),[b,v]),Be=useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ze,fe]=useState(()=>Be(ve));useEffect(()=>{fe(P=>P.map(R=>({...R,label:ve.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ve]);let Ge=useMemo(()=>Ze.filter(R=>R.visible).reduce((R,G)=>R+G.width,0),[Ze]),st=useRef(Ze.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=Ze.filter(Q=>Q.visible),R=P.map(Q=>Q.id).join(","),G=st.current;if(R!==G){let Q=P.some(Pe=>Pe.id!=="name"),ke=G.includes(",");Q?!ke&&Q&&_e(null):_e(null),st.current=R;}},[Ze]);let Ct=60,Lt=.6,St=useMemo(()=>{let R=Ge+Ct,G=typeof window<"u"?window.innerWidth*Lt:800,Q=Math.max(R,G);return Xe!==null?Math.max(200,Math.min(Xe,Q)):Math.max(200,R)},[Xe,Ge]),Et=useRef(null),ga=useRef(null),la=useRef(null),rr=useRef(null),zt=useMemo(()=>Up(we),[we]),Xa=useMemo(()=>({theme:zt,themeName:we}),[zt,we]),zr=useMemo(()=>Tm(p),[p]),to=useMemo(()=>{if(!g)return ne;let P=Ee.calculateCriticalPathFull(ne),R=G=>G.map(Q=>{let ke=P.get(Q.id),Pe=Q.subtasks?R(Q.subtasks):void 0,Ft=Pe?.some(Sa=>Sa.isCriticalPath||Sa.subtasks&&Sa.subtasks.some(Jt=>Jt.isCriticalPath))||false,ut=ke?ke.isCritical:Ft;return {...Q,isCriticalPath:ut,cpmData:ke||void 0,subtasks:Pe}});return R(ne)},[ne,g]),nf=useMemo(()=>Ee.flattenTasks(ne).some(R=>R.dependencies&&R.dependencies.length>0),[ne]),Kc=useMemo(()=>{if(Le==="all"&&!oe)return to;let P=R=>{let G=[];for(let Q of R){let ke=Q.subtasks?.length?P(Q.subtasks):void 0,Pe=false;if(oe)Pe=Q.progress<100;else switch(Le){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||ke&&ke.length>0)&&G.push({...Q,subtasks:ke});}return G};return P(to)},[to,Le,oe]),Hs=_v(H);Cm({undo:A,redo:ge,canUndo:je,canRedo:et,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>Ee.findTaskById(ne,P),addTask:(P,R)=>{He(G=>{if(!R)return [...G,{...P,level:0}];let Q=ke=>ke.map(Pe=>Pe.id===R?{...Pe,subtasks:[...Pe.subtasks||[],{...P,parentId:R,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(G)});},updateTask:(P,R)=>{He(G=>{let Q=ke=>ke.map(Pe=>Pe.id===P?{...Pe,...R}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(G)});},deleteTask:P=>{He(R=>{let G=Q=>Q.filter(ke=>ke.id===P?false:(ke.subtasks&&(ke.subtasks=G(ke.subtasks)),true));return G(R)});},deleteTasks:P=>{He(R=>Ed(R,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let R=Ee.findTaskById(ne,P);R&&a.onTaskDuplicate(R);}else He(R=>fs(R,[P]).tasks);},splitTask:(P,R,G=3)=>{He(Q=>Ee.splitTask(Q,P,R,G));},calculateEndDate:Ee.calculateEndDate,calculateDuration:Ee.calculateDuration,validateDependency:(P,R)=>!Ee.validateDependencies(ne,P,R),getAllTasks:()=>Ee.flattenTasks(ne),getTasksByStatus:P=>Ee.flattenTasks(ne).filter(R=>R.status===P),getTasksByParent:P=>P?Ee.findTaskById(ne,P)?.subtasks||[]:ne.filter(G=>!G.parentId),getCriticalPath:()=>Ee.flattenTasks(ne).filter(P=>P.isCriticalPath),indentTask:P=>{He(R=>Rr(Nd(R,[P])));},outdentTask:P=>{He(R=>Rr(Dd(R,[P])));},moveTask:(P,R)=>{He(G=>Sd(G,[P],R));},createSubtask:async P=>{let{tasks:R,newTask:G}=Pd(ne,P);if(xe){let Q=xe({...G,parentId:P});if((Q instanceof Promise?await Q:Q)===false)return}He(Rr(R)),Ue&&Ue({...G,parentId:P});},scrollToTask:P=>{let G=Ee.flattenTasks(ne).findIndex(Q=>Q.id===P);if(G!==-1&&Et.current){let Q=G*Hs;Et.current.scrollTo({top:Q,behavior:"smooth"}),la.current&&la.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(P,R=2e3)=>{},expandTask:P=>{He(R=>{let G=Q=>Q.map(ke=>ke.id===P?{...ke,isExpanded:true}:ke.subtasks?{...ke,subtasks:G(ke.subtasks)}:ke);return G(R)});},collapseTask:P=>{He(R=>{let G=Q=>Q.map(ke=>ke.id===P?{...ke,isExpanded:false}:ke.subtasks?{...ke,subtasks:G(ke.subtasks)}:ke);return G(R)});},expandAll:()=>{He(P=>{let R=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(P)});},collapseAll:()=>{He(P=>{let R=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(P)});},collapseToLevel:P=>{M(P);},undo:A,redo:ge,canUndo:()=>je,canRedo:()=>et,clearHistory:oa,exportToPNG:async()=>{if(!rr.current||!Et.current||!la.current)throw new Error("Gantt container not found");let P=rr.current,R=Et.current,G=ga.current||R.querySelector(".gantt-grid-scroll"),Q=la.current,ke=G?.scrollTop||0,Pe=Q.scrollTop,Ft=P.style.overflow,ut=P.style.height,Sa=R.style.overflow;try{let Jt=G?.querySelector(".gantt-taskgrid-content"),ua=Q.querySelector("svg"),lr=Jt?.scrollHeight||G?.scrollHeight||600,Dr=ua?.getBoundingClientRect().height||Q.scrollHeight,Go=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(lr,Dr)+20;G&&(G.scrollTop=0),Q.scrollTop=0,P.style.overflow="visible",P.style.height=`${Go}px`,R.style.overflow="visible",await new Promise(bn=>setTimeout(bn,100));let ao=await toPng(P,{backgroundColor:zt.bgPrimary,pixelRatio:2,filter:bn=>{if(!(bn instanceof Element))return !0;let zs=window.getComputedStyle(bn),Yn=parseInt(zs.zIndex,10);return (isNaN(Yn)||Yn<50)&&zs.position!=="fixed"}});return await(await fetch(ao)).blob()}finally{P.style.overflow=Ft,P.style.height=ut,R.style.overflow=Sa,G&&(G.scrollTop=ke),Q.scrollTop=Pe;}},exportToPDF:async P=>{await Ee.exportToPDF(ne,P);},exportToExcel:async P=>{await Ee.exportToExcel(ne,P,pl.current);},exportToJSON:()=>Ee.exportToJSON(ne),exportToCSV:()=>Ee.exportToCSV(ne),importFromJSON:P=>{let R=Ee.importFromJSON(P);He(R);},getTasks:()=>ne,refresh:()=>{He(P=>[...P]);},clearAll:()=>{He([]);}}),[ne,A,ge,je,et,oa,zt,Hs]);let sf=useCallback(P=>{fe(R=>R.map(G=>G.id===P?{...G,visible:!G.visible}:G));},[]),lf=useCallback((P,R)=>{fe(G=>G.map(Q=>{if(Q.id!==P)return Q;let ke=Q.minWidth??100,Pe=Q.maxWidth??800,Ft=Math.max(ke,Math.min(Pe,R));return {...Q,width:Ft}}));},[]),df=useCallback(P=>{He(R=>{let G=Fd(R,P),Q=ke=>{for(let Pe of ke){if(Pe.id===P){_a.current.set(P,Pe.isExpanded??true);return}Pe.subtasks?.length&&Q(Pe.subtasks);}};return Q(G),ma(),G}),a.onTaskToggleExpand?.(P);},[a,ma]),pn=useCallback((P,R)=>{if(Re&&Re(P,R)===false)return;let Q=Ee.findTaskById(ne,P)?.progress,ke=Ft=>Ft.map(ut=>ut.id===P?{...ut,...R}:ut.subtasks?{...ut,subtasks:ke(ut.subtasks)}:ut);He(ke(ne));let Pe=Ee.findTaskById(ke(ne),P);Pe&&(Se?.(Pe),it?.(Pe),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&_?.(P,Q,R.progress));},[ne,Se,Re,it,_]),cf=useCallback(P=>{P.length!==0&&(dr.current+=1,Hr.current=true,He(R=>Rr(Nd(R,P))),a.onTaskIndent?.(P[0]));},[a]),uf=useCallback(P=>{P.length!==0&&(dr.current+=1,Hr.current=true,He(R=>Rr(Dd(R,P))),a.onTaskOutdent?.(P[0]));},[a]),pf=useCallback((P,R,G)=>{dr.current+=1,Hr.current=true,He(Q=>Rr(dm(Q,P,R,G))),a.onTaskReparent?.(P,R,G);},[a]),mf=useCallback((P,R)=>{P.length!==0&&(dr.current+=1,Hr.current=true,He(G=>Sd(G,P,R)),a.onTaskMove?.(P[0],R));},[a]),dl=useCallback(async P=>{let R=[];for(let G of P)ee&&await Promise.resolve(ee(G))===false||R.push(G);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(He(G=>Rr(Ed(G,R))),R.forEach(G=>a.onTaskDelete?.(G))),lt&&R.forEach(G=>lt(G)));},[a,ee,lt]),gf=useCallback(P=>{a.onTaskDuplicate?P.forEach(R=>{let G=Ee.findTaskById(ne,R);G&&a.onTaskDuplicate(G);}):He(R=>fs(R,P).tasks);},[a,ne]),ff=useCallback((P,R)=>{He(G=>{let{tasks:Q,newTask:ke}=lm(G,P,R);return xe&&xe(ke)===false?G:(a.onTaskCreate?.(ke.parentId,ke.position||0),Ue?.(ke),Q)});},[a,xe,Ue]),bf=useCallback((P,R)=>{He(G=>Md(G,P,R)),a.onTaskRename?.(P,R);},[a]),cl=useCallback(P=>{let{onTaskAddSubtask:R}=a;if(R){let G=Ln(ne,P);if(G){R(G);return}}He(G=>{let{tasks:Q}=Pd(G,P);return a.onTaskCreate?.(P,0),Q});},[a,ne]),hf=useCallback((P,R,G)=>{let Q=!P.startDate&&!P.endDate,ke=P.startDate?Math.round((R.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Pe=Jt=>Jt.map(ua=>ua.id===P.id?{...ua,startDate:R,endDate:G,...P.segments&&{segments:P.segments}}:ua.subtasks?{...ua,subtasks:Pe(ua.subtasks)}:ua),Ft=Pe(ne),ut=Ft;Ft=Ee.autoScheduleDependents(Ft,P.id,ke),Ft=Rr(Ft),He(Ft);let Sa={...P,startDate:R,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(P,R,G):Se?.(Sa),B&&ke!==0){let Jt=Ee.flattenTasks(ut),ua=Ee.flattenTasks(Ft),lr=[];for(let Dr of ua){if(Dr.id===P.id)continue;let Co=Jt.find(ao=>ao.id===Dr.id);if(!Co)continue;let fn=Dr.startDate?.getTime()!==Co.startDate?.getTime(),Go=Dr.endDate?.getTime()!==Co.endDate?.getTime();(fn||Go)&&lr.push(Dr);}lr.length>0&&B(lr);}},[ne,Se,B,a]),yf=useCallback((P,R)=>{Z?.(P,R),kt({isOpen:true,x:R.clientX,y:R.clientY,task:P});},[Z]),xf=useCallback((P,R)=>{let G=Ee.splitTask(ne,P.id,R);He(G),kt({isOpen:false,x:0,y:0,task:null});},[ne]),qc=useCallback(P=>{let R=Ee.findTaskById(ne,P.id)||P;Y?.(R),ye||Wt(R);},[ne,Y,ye]),Yc=useCallback((P,R,G)=>{let Q=new Map,ke=Jt=>{Jt.forEach(ua=>{ua.dependencies&&Q.set(ua.id,ua.dependencies),ua.subtasks&&ke(ua.subtasks);});};ke(G);let Pe=Q.get(R)||[];Q.set(R,[...Pe,P]);let Ft=new Set,ut=new Set,Sa=Jt=>{if(!Ft.has(Jt)){Ft.add(Jt),ut.add(Jt);let ua=Q.get(Jt)||[];for(let lr of ua){if(!Ft.has(lr)&&Sa(lr))return true;if(ut.has(lr))return true}}return ut.delete(Jt),false};return Sa(R)},[]),Xc=useCallback((P,R)=>{if(Yc(P.id,R,Kn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
366
+ `})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:A,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[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:et,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${nt}`,boxShadow:Ut},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ce,borderBottom:`1px solid ${mt}`},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 ${Xe}`,color:"#2E94FF"},children:jsx(km,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>m(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:U=>{U.currentTarget.style.background=K,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=ne;},children:jsx(Iv,{})}),jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ne},onMouseEnter:U=>{U.currentTarget.style.background=K,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=ne;},children:jsx(Lv,{})})]})]}),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:ce,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:he.slice(0,4).map((U,Ze)=>jsx("button",{onClick:()=>ha(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Te,color:te,border:`1px solid ${V}`},onMouseEnter:ye=>{ye.currentTarget.style.borderColor=$e,ye.currentTarget.style.color="#2E94FF";},onMouseLeave:ye=>{ye.currentTarget.style.borderColor=V,ye.currentTarget.style.color=te;},children:U.length>30?U.slice(0,30)+"...":U},Ze))})]}),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"?Ne:Fe,color:U.role==="user"?"#2E94FF":ht,border:U.role==="user"?`1px solid ${He}`:`1px solid ${Ge}`},children:[U.isLoading?jsx(Bv,{}):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:$})]}),jsxs("form",{onSubmit:U=>{if(F&&De.length>0){U.preventDefault();return}Wt(U);},className:"p-3 relative",style:{borderTop:`1px solid ${dt}`},children:[jsx(AnimatePresence,{children:F&&De.length>0&&jsx(motion.div,{ref:q,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:$t,border:`1px solid ${We}`,boxShadow:Re,backdropFilter:"blur(12px)"},children:De.map((U,Ze)=>jsxs("button",{type:"button",onClick:()=>_e(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:Ze===S?at:"transparent",color:ie},onMouseEnter:()=>X(Ze),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 ${j}`,color:"#2E94FF"},children:U.name.split(" ").map(ye=>ye[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:U.name}),U.email&&jsx("div",{className:"text-xs truncate",style:{color:me},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:gt,border:`1px solid ${ot}`},children:[jsx("input",{ref:O,type:"text",value:x,onChange:U=>Je(U.target.value),onKeyDown:U=>{ze(U);},placeholder:Ee,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:jt,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()?Et:"transparent",color:x.trim()?"#2E94FF":Tt,border:x.trim()?`1px solid ${Nt}`:"1px solid transparent"},children:jsx(Av,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:yt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Cm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,p=true)=>{r(d=>{let m=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:m};if(!p)return {...d,present:m};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let p=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:p,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let p=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:p,future:d}});},[]),c=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function Tm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&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 Hv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Se.formatDate(e.startDate)} - ${Se.formatDate(e.endDate)}`);let a=Se.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=>Se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Nm(e){return {...Hv,...e}}var Kv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Em=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:p,projectName:d,availableUsers:m=[],templates:g,enableAutoCriticalPath:y=true,persistExpandedState:x,persistFilter:h,clearFiltersKey:f,aiAssistant:b,locale:v="en",customTranslations:C,showCreateTaskButton:N=false,createTaskLabel:T,onCreateTask:k,taskFilter:w,onTaskFilterChange:F,toolbarRightContent:I,showBaseline:S,viewMode:X,onViewModeChange:O,projectForecast:$,onThemeChange:A,onTaskClick:q,onTaskDblClick:Z,onTaskContextMenu:Ee,onTaskUpdate:B,onDependentTasksScheduled:_,onProgressChange:he,onTaskEdit:Ye,onTaskAddSubtask:z,onTaskMarkIncomplete:re,onTaskSetInProgress:J,onDependencyCreate:Le,onDependencyDelete:we,onBeforeTaskAdd:Oe,onAfterTaskAdd:Be,onBeforeTaskUpdate:lt,onAfterTaskUpdate:ee,onBeforeTaskDelete:ct,onAfterTaskDelete:pe,permissions:et,onCopySnapshotLink:nt}=a,Ce=useContext(hi)?.theme,[mt,Dt]=useState(Ce||s||"dark"),[Xe,H]=useState(n),[ne,D]=useState(l),[K,ce]=useState(1),[Te,V]=useState("all"),[te,$e]=useState(X||"execution"),Ne=X??te,He=useCallback(P=>{$e(P),O?.(P);},[O]),Fe=S??Ne==="oracle",[Ge,ht]=useState(a.showCriticalPath!==false),[dt,gt]=useState(a.showDependencies!==false),[ot,jt]=useState(a.highlightWeekends!==false),Et=useCallback(P=>{ht(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),Nt=useCallback(P=>{gt(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),Tt=useCallback(P=>{jt(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(Xe);},[Xe]),useEffect(()=>{a.onZoomChange?.(K);},[K]);let yt=useRef(a.onDateRangeChange);yt.current=a.onDateRangeChange;let $t=useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[We,Re]=useState(()=>{if(!h)return "all";try{let P=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(P);if(R){let G=JSON.parse(R);if(G.taskFilter)return G.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),at=w??We,ie=F??Re,[me,L]=useState(()=>{if(!h)return false;try{let P=typeof h=="string"?h:"gantt-filter-state",R=localStorage.getItem(P);if(R){let G=JSON.parse(R);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});useEffect(()=>{let P=$t();if(P)try{let R={taskFilter:at,hideCompleted:me};localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[at,me,$t]);let j=useRef(f);useEffect(()=>{if(j.current!==f&&f!==void 0){Re("all"),L(false);let P=$t();if(P)try{localStorage.removeItem(P);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}j.current=f;},[f,$t]);let[Y,ge]=useState(0),[De,Je]=useState(false),[_e,ze]=useState(null),[vt,ut]=useState({isOpen:false,x:0,y:0,task:null}),[Wt,ha]=useState(null),[ta,U]=useState(null);useEffect(()=>{Ce&&Ce!==mt&&Dt(Ce);},[Ce]),useEffect(()=>{s&&s!==mt&&Dt(s);},[s]);let Ze=useCallback(P=>{Dt(P),A?.(P);},[A]),{state:ye,setState:E,undo:fe,redo:je,canUndo:tt,canRedo:ra,clearHistory:Vt}=Cm(t,50),Ua=useMemo(()=>{let P=(R,G=0)=>{let Q=G;for(let ve of R)ve.subtasks?.length&&(Q=Math.max(Q,P(ve.subtasks,G+1)));return Q};return P(ye)+1},[ye]),lr=useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),fa=useRef(new Map),ya=useRef(false);if(!ya.current&&x){ya.current=true;let P=typeof x=="string"?x:"gantt-expanded-tasks";try{let R=localStorage.getItem(P);if(R){let G=JSON.parse(R);Array.isArray(G)&&(fa.current=new Map(G));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Hr=useCallback(()=>{let P=lr();if(P)try{let R=Array.from(fa.current.entries());localStorage.setItem(P,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[lr]),Fr=useRef(0),Go=useRef(ye);useEffect(()=>{Go.current=ye;},[ye]);let M=useRef(false),se=useCallback(P=>{V(P),Fr.current+=1,E(R=>{let G=(ve,Ae=0)=>ve.map(Mt=>{let pt=P==="all"||Ae<P-1;return Mt.subtasks?.length&&fa.current.set(Mt.id,pt),{...Mt,isExpanded:pt,subtasks:Mt.subtasks?G(Mt.subtasks,Ae+1):void 0}}),Q=G(R);return Hr(),Q});},[E,Hr]);useEffect(()=>{if(Fr.current>0){Fr.current-=1;return}let P=G=>{let Q=new Map;for(let ve of G){let Ae=ve.id;Q.get(Ae)||Q.set(Ae,ve);}return Array.from(Q.values())},R=G=>G.map(Q=>{let ve=fa.current.get(Q.id),Ae=ve!==void 0?{...Q,isExpanded:ve}:Q;if(Ae.subtasks?.length){let Mt=P(Ae.subtasks);return {...Ae,subtasks:R(Mt)}}return Ae});if(fa.current.size>0)E(Rr(R(t)));else {let G=Q=>Q.map(ve=>ve.subtasks?.length?{...ve,subtasks:P(G(ve.subtasks))}:ve);E(Rr(G(t)));}},[t,E]);let xe=useRef(t),Pe=useRef(true);useEffect(()=>{if(Pe.current){Pe.current=false,xe.current=ye;return}if(M.current){M.current=false,xe.current=ye;return}if(!r)return;let P=JSON.stringify(xe.current),R=JSON.stringify(ye);P!==R&&(xe.current=ye,r(ye));},[ye,r]);let ke=useMemo(()=>vd(v,C),[v,C]),st=useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ue,Ve]=useState(()=>st(ke));useEffect(()=>{Ve(P=>P.map(R=>({...R,label:ke.columns[R.id==="name"?"taskName":R.id]||R.label})));},[ke]);let it=useMemo(()=>ue.filter(R=>R.visible).reduce((R,G)=>R+G.width,0),[ue]),wt=useRef(ue.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=ue.filter(Q=>Q.visible),R=P.map(Q=>Q.id).join(","),G=wt.current;if(R!==G){let Q=P.some(Ae=>Ae.id!=="name"),ve=G.includes(",");Q?!ve&&Q&&ze(null):ze(null),wt.current=R;}},[ue]);let At=60,St=.6,zt=useMemo(()=>{let R=it+At,G=typeof window<"u"?window.innerWidth*St:800,Q=Math.max(R,G);return _e!==null?Math.max(200,Math.min(_e,Q)):Math.max(200,R)},[_e,it]),oa=useRef(null),Sa=useRef(null),Ea=useRef(null),ar=useRef(null),Ft=useMemo(()=>Wp(mt),[mt]),eo=useMemo(()=>({theme:Ft,themeName:mt}),[Ft,mt]),mo=useMemo(()=>Nm(g),[g]),dl=useMemo(()=>{if(!y)return ye;let P=Se.calculateCriticalPathFull(ye),R=G=>G.map(Q=>{let ve=P.get(Q.id),Ae=Q.subtasks?R(Q.subtasks):void 0,Mt=Ae?.some(Ma=>Ma.isCriticalPath||Ma.subtasks&&Ma.subtasks.some(Xt=>Xt.isCriticalPath))||false,pt=ve?ve.isCritical:Mt;return {...Q,isCriticalPath:pt,cpmData:ve||void 0,subtasks:Ae}});return R(ye)},[ye,y]),sf=useMemo(()=>Se.flattenTasks(ye).some(R=>R.dependencies&&R.dependencies.length>0),[ye]),qc=useMemo(()=>{if(at==="all"&&!me)return dl;let P=R=>{let G=[];for(let Q of R){let ve=Q.subtasks?.length?P(Q.subtasks):void 0,Ae=false;if(me)Ae=Q.progress<100;else switch(at){case "all":Ae=true;break;case "incomplete":Ae=Q.progress<100;break;case "in_progress":Ae=Q.progress>0&&Q.progress<100;break;case "completed":Ae=Q.progress===100;break}(Ae||ve&&ve.length>0)&&G.push({...Q,subtasks:ve});}return G};return P(dl)},[dl,at,me]),Hs=Kv(ne);Tm({undo:fe,redo:je,canUndo:tt,canRedo:ra,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>Se.findTaskById(ye,P),addTask:(P,R)=>{E(G=>{if(!R)return [...G,{...P,level:0}];let Q=ve=>ve.map(Ae=>Ae.id===R?{...Ae,subtasks:[...Ae.subtasks||[],{...P,parentId:R,level:(Ae.level||0)+1}],isExpanded:true}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(G)});},updateTask:(P,R)=>{E(G=>{let Q=ve=>ve.map(Ae=>Ae.id===P?{...Ae,...R}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(G)});},deleteTask:P=>{E(R=>{let G=Q=>Q.filter(ve=>ve.id===P?false:(ve.subtasks&&(ve.subtasks=G(ve.subtasks)),true));return G(R)});},deleteTasks:P=>{E(R=>Md(R,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let R=Se.findTaskById(ye,P);R&&a.onTaskDuplicate(R);}else E(R=>fs(R,[P]).tasks);},splitTask:(P,R,G=3)=>{E(Q=>Se.splitTask(Q,P,R,G));},calculateEndDate:Se.calculateEndDate,calculateDuration:Se.calculateDuration,validateDependency:(P,R)=>!Se.validateDependencies(ye,P,R),getAllTasks:()=>Se.flattenTasks(ye),getTasksByStatus:P=>Se.flattenTasks(ye).filter(R=>R.status===P),getTasksByParent:P=>P?Se.findTaskById(ye,P)?.subtasks||[]:ye.filter(G=>!G.parentId),getCriticalPath:()=>Se.flattenTasks(ye).filter(P=>P.isCriticalPath),indentTask:P=>{E(R=>Rr(Dd(R,[P])));},outdentTask:P=>{E(R=>Rr(Sd(R,[P])));},moveTask:(P,R)=>{E(G=>Ed(G,[P],R));},createSubtask:async P=>{let{tasks:R,newTask:G}=Ad(ye,P);if(Oe){let Q=Oe({...G,parentId:P});if((Q instanceof Promise?await Q:Q)===false)return}E(Rr(R)),Be&&Be({...G,parentId:P});},scrollToTask:P=>{let G=Se.flattenTasks(ye).findIndex(Q=>Q.id===P);if(G!==-1&&oa.current){let Q=G*Hs;oa.current.scrollTo({top:Q,behavior:"smooth"}),Ea.current&&Ea.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(P,R=2e3)=>{},expandTask:P=>{E(R=>{let G=Q=>Q.map(ve=>ve.id===P?{...ve,isExpanded:true}:ve.subtasks?{...ve,subtasks:G(ve.subtasks)}:ve);return G(R)});},collapseTask:P=>{E(R=>{let G=Q=>Q.map(ve=>ve.id===P?{...ve,isExpanded:false}:ve.subtasks?{...ve,subtasks:G(ve.subtasks)}:ve);return G(R)});},expandAll:()=>{E(P=>{let R=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(P)});},collapseAll:()=>{E(P=>{let R=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(P)});},collapseToLevel:P=>{se(P);},undo:fe,redo:je,canUndo:()=>tt,canRedo:()=>ra,clearHistory:Vt,exportToPNG:async()=>{if(!ar.current||!oa.current||!Ea.current)throw new Error("Gantt container not found");let P=ar.current,R=oa.current,G=Sa.current||R.querySelector(".gantt-grid-scroll"),Q=Ea.current,ve=G?.scrollTop||0,Ae=Q.scrollTop,Mt=P.style.overflow,pt=P.style.height,Ma=R.style.overflow;try{let Xt=G?.querySelector(".gantt-taskgrid-content"),ua=Q.querySelector("svg"),ir=Xt?.scrollHeight||G?.scrollHeight||600,Nr=ua?.getBoundingClientRect().height||Q.scrollHeight,jo=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ir,Nr)+20;G&&(G.scrollTop=0),Q.scrollTop=0,P.style.overflow="visible",P.style.height=`${jo}px`,R.style.overflow="visible",await new Promise(hn=>setTimeout(hn,100));let to=await toPng(P,{backgroundColor:Ft.bgPrimary,pixelRatio:2,filter:hn=>{if(!(hn instanceof Element))return !0;let zs=window.getComputedStyle(hn),Yn=parseInt(zs.zIndex,10);return (isNaN(Yn)||Yn<50)&&zs.position!=="fixed"}});return await(await fetch(to)).blob()}finally{P.style.overflow=Mt,P.style.height=pt,R.style.overflow=Ma,G&&(G.scrollTop=ve),Q.scrollTop=Ae;}},exportToPDF:async P=>{await Se.exportToPDF(ye,P);},exportToExcel:async P=>{await Se.exportToExcel(ye,P,ml.current);},exportToJSON:()=>Se.exportToJSON(ye),exportToCSV:()=>Se.exportToCSV(ye),importFromJSON:P=>{let R=Se.importFromJSON(P);E(R);},getTasks:()=>ye,refresh:()=>{E(P=>[...P]);},clearAll:()=>{E([]);}}),[ye,fe,je,tt,ra,Vt,Ft,Hs]);let lf=useCallback(P=>{Ve(R=>R.map(G=>G.id===P?{...G,visible:!G.visible}:G));},[]),df=useCallback((P,R)=>{Ve(G=>G.map(Q=>{if(Q.id!==P)return Q;let ve=Q.minWidth??100,Ae=Q.maxWidth??800,Mt=Math.max(ve,Math.min(Ae,R));return {...Q,width:Mt}}));},[]),cf=useCallback(P=>{E(R=>{let G=Pd(R,P),Q=ve=>{for(let Ae of ve){if(Ae.id===P){fa.current.set(P,Ae.isExpanded??true);return}Ae.subtasks?.length&&Q(Ae.subtasks);}};return Q(G),Hr(),G}),a.onTaskToggleExpand?.(P);},[a,Hr]),mn=useCallback((P,R)=>{if(lt&&lt(P,R)===false)return;let Q=Se.findTaskById(ye,P)?.progress,ve=Mt=>Mt.map(pt=>pt.id===P?{...pt,...R}:pt.subtasks?{...pt,subtasks:ve(pt.subtasks)}:pt);E(ve(ye));let Ae=Se.findTaskById(ve(ye),P);Ae&&(B?.(Ae),ee?.(Ae),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&he?.(P,Q,R.progress));},[ye,B,lt,ee,he]),uf=useCallback(P=>{P.length!==0&&(Fr.current+=1,M.current=true,E(R=>Rr(Dd(R,P))),a.onTaskIndent?.(P[0]));},[a]),pf=useCallback(P=>{P.length!==0&&(Fr.current+=1,M.current=true,E(R=>Rr(Sd(R,P))),a.onTaskOutdent?.(P[0]));},[a]),mf=useCallback((P,R,G)=>{Fr.current+=1,M.current=true,E(Q=>Rr(cm(Q,P,R,G))),a.onTaskReparent?.(P,R,G);},[a]),gf=useCallback((P,R)=>{P.length!==0&&(Fr.current+=1,M.current=true,E(G=>Ed(G,P,R)),a.onTaskMove?.(P[0],R));},[a]),cl=useCallback(async P=>{let R=[];for(let G of P)ct&&await Promise.resolve(ct(G))===false||R.push(G);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(E(G=>Rr(Md(G,R))),R.forEach(G=>a.onTaskDelete?.(G))),pe&&R.forEach(G=>pe(G)));},[a,ct,pe]),ff=useCallback(P=>{a.onTaskDuplicate?P.forEach(R=>{let G=Se.findTaskById(ye,R);G&&a.onTaskDuplicate(G);}):E(R=>fs(R,P).tasks);},[a,ye]),bf=useCallback((P,R)=>{E(G=>{let{tasks:Q,newTask:ve}=dm(G,P,R);return Oe&&Oe(ve)===false?G:(a.onTaskCreate?.(ve.parentId,ve.position||0),Be?.(ve),Q)});},[a,Oe,Be]),hf=useCallback((P,R)=>{E(G=>Fd(G,P,R)),a.onTaskRename?.(P,R);},[a]),ul=useCallback(P=>{let{onTaskAddSubtask:R}=a;if(R){let G=In(ye,P);if(G){R(G);return}}E(G=>{let{tasks:Q}=Ad(G,P);return a.onTaskCreate?.(P,0),Q});},[a,ye]),yf=useCallback((P,R,G)=>{let Q=!P.startDate&&!P.endDate,ve=P.startDate?Math.round((R.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Ae=Xt=>Xt.map(ua=>ua.id===P.id?{...ua,startDate:R,endDate:G,...P.segments&&{segments:P.segments}}:ua.subtasks?{...ua,subtasks:Ae(ua.subtasks)}:ua),Mt=Ae(ye),pt=Mt;Mt=Se.autoScheduleDependents(Mt,P.id,ve),Mt=Rr(Mt),E(Mt);let Ma={...P,startDate:R,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(P,R,G):B?.(Ma),_&&ve!==0){let Xt=Se.flattenTasks(pt),ua=Se.flattenTasks(Mt),ir=[];for(let Nr of ua){if(Nr.id===P.id)continue;let Co=Xt.find(to=>to.id===Nr.id);if(!Co)continue;let bn=Nr.startDate?.getTime()!==Co.startDate?.getTime(),jo=Nr.endDate?.getTime()!==Co.endDate?.getTime();(bn||jo)&&ir.push(Nr);}ir.length>0&&_(ir);}},[ye,B,_,a]),xf=useCallback((P,R)=>{Ee?.(P,R),ut({isOpen:true,x:R.clientX,y:R.clientY,task:P});},[Ee]),vf=useCallback((P,R)=>{let G=Se.splitTask(ye,P.id,R);E(G),ut({isOpen:false,x:0,y:0,task:null});},[ye]),Yc=useCallback(P=>{let R=Se.findTaskById(ye,P.id)||P;Z?.(R),Ye||ha(R);},[ye,Z,Ye]),Xc=useCallback((P,R,G)=>{let Q=new Map,ve=Xt=>{Xt.forEach(ua=>{ua.dependencies&&Q.set(ua.id,ua.dependencies),ua.subtasks&&ve(ua.subtasks);});};ve(G);let Ae=Q.get(R)||[];Q.set(R,[...Ae,P]);let Mt=new Set,pt=new Set,Ma=Xt=>{if(!Mt.has(Xt)){Mt.add(Xt),pt.add(Xt);let ua=Q.get(Xt)||[];for(let ir of ua){if(!Mt.has(ir)&&Ma(ir))return true;if(pt.has(ir))return true}}return pt.delete(Xt),false};return Ma(R)},[]),Jc=useCallback((P,R)=>{if(Xc(P.id,R,Go.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 G=Q=>Q.map(ke=>{if(ke.id===R){let Pe=ke.dependencies||[];if(!Pe.includes(P.id))return {...ke,dependencies:[...Pe,P.id]}}return ke.subtasks?{...ke,subtasks:G(ke.subtasks)}:ke});dr.current+=1,He(Q=>G(Q)),J?.(P.id,R);},[J,Yc]),Jc=useCallback((P,R)=>{let G=Q=>Q.map(ke=>{if(ke.id===P&&ke.dependencies){let Pe=ke.dependencies.filter(Ft=>Ft!==R);return {...ke,dependencies:Pe}}return ke.subtasks?{...ke,subtasks:G(ke.subtasks)}:ke});dr.current+=1,He(Q=>G(Q)),Ae?.(P,R);},[Ae]),{startDate:mn,endDate:ul}=useMemo(()=>{let P=ne.filter(Pe=>Pe.startDate&&Pe.endDate);if(P.length===0){let Pe=new Date,Ft=new Date(Pe);Ft.setDate(Ft.getDate()-30);let ut=new Date(Pe);return ut.setDate(ut.getDate()+60),{startDate:Ft,endDate:ut}}let R=P.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),G=new Date(Math.min(...R.map(Pe=>Pe.getTime()))),Q=new Date(Math.max(...R.map(Pe=>Pe.getTime()))),ke=gt==="day"?7:gt==="week"?14:30;return G.setDate(G.getDate()-ke),Q.setDate(Q.getDate()+ke),{startDate:G,endDate:Q}},[ne,gt]);useEffect(()=>{wt.current?.(mn,ul);},[mn,ul]);let vf=useCallback(async()=>{if(!rr.current||!Et.current||!la.current)return;await new Promise(Go=>setTimeout(Go,200));let P=rr.current,R=Et.current,G=ga.current||R.querySelector(".gantt-grid-scroll"),Q=la.current,ke=G?.scrollTop||0,Pe=G?.scrollLeft||0,Ft=Q.scrollTop,ut=Q.scrollLeft,Sa=P.style.overflow,Jt=P.style.height,ua=G?.style.overflow||"",lr=Q.style.overflow,Dr=R.style.overflow,Co=P.style.width,fn=Q.style.width;try{let Go=G?.querySelector(".gantt-taskgrid-content"),ao=Q.querySelector("svg"),gl=ao?.getAttribute("height")?parseInt(ao.getAttribute("height"),10):ao?.getBoundingClientRect().height||0,bn=Go?.scrollHeight||G?.scrollHeight||600,zs=Math.max(gl,Q.scrollHeight),Yn=ao?.getAttribute("width")?parseInt(ao.getAttribute("width"),10):ao?.getBoundingClientRect().width||Q.scrollWidth,Ef=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,fl=Math.max(bn,zs,gl),eu=Ef+fl+50,tu=(G?.offsetWidth||R.offsetWidth||300)+Yn+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,P.style.overflow="visible",P.style.height=`${eu}px`,P.style.width=`${tu}px`,R.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${fl+50}px`),Q.style.overflow="visible",Q.style.height=`${fl+50}px`,Q.style.width=`${Yn+10}px`,await new Promise(Us=>setTimeout(Us,150));let Mf=await toPng(P,{backgroundColor:zt.bgPrimary,pixelRatio:2,width:tu,height:eu,skipFonts:!1,filter:Us=>{if(!(Us instanceof Element))return !0;let au=window.getComputedStyle(Us),ru=parseInt(au.zIndex,10);return !(!isNaN(ru)&&ru>=50||au.position==="fixed")}}),bl=document.createElement("a");bl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,bl.href=Mf,bl.click();}finally{P.style.overflow=Sa,P.style.height=Jt,P.style.width=Co,R.style.overflow=Dr,G&&(G.style.overflow=ua,G.style.height="",G.scrollTop=ke,G.scrollLeft=Pe),Q.style.overflow=lr,Q.style.height="",Q.style.width=fn,Q.scrollTop=Ft,Q.scrollLeft=ut;}},[zt]),wf=useCallback(async()=>{await Ee.exportToPDF(ne);},[ne]),pl=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});pl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let kf=useCallback(async()=>{let P=new Date,R=ke=>String(ke).padStart(2,"0"),G=`${P.getFullYear()}-${R(P.getMonth()+1)}-${R(P.getDate())}_${R(P.getHours())}${R(P.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ee.exportToExcel(ne,`${Q}_${G}.xlsx`,pl.current);},[ne,m]),Cf=useCallback(()=>{let P=Ee.exportToCSV(ne),R=new Blob([P],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[ne]),Tf=useCallback(()=>{let P=Ee.exportToJSON(ne),R=new Blob([P],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[ne]),Nf=useCallback(()=>{Ee.exportToMSProject(ne,"Gantt Project","project.xml");},[ne]),Df=P=>{P.preventDefault(),Ne(true);},gn=useRef(false),[ml,Qc]=useState(false),qn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=la.current,R=Et.current?.querySelector(".gantt-grid-scroll");if(!P||!R)return;let G=()=>{if(gn.current)return;gn.current=true;let ut=P.scrollTop;q(ut),R.scrollTop=ut,requestAnimationFrame(()=>{gn.current=false;});},Q=()=>{if(gn.current)return;gn.current=true;let ut=R.scrollTop;q(ut),P.scrollTop=ut,requestAnimationFrame(()=>{gn.current=false;});},ke=ut=>{if(me&&R){let Jt=R.parentElement?.getBoundingClientRect()?.left||0,ua=ut.clientX-Jt,lr=200,Dr=Ge+Ct,Co=window.innerWidth*Lt,fn=Math.max(Dr,Co);ua>=lr&&ua<=fn&&_e(ua);}if(ml&&P){let Sa=ut.clientX-qn.current.x,Jt=ut.clientY-qn.current.y;P.scrollLeft=qn.current.scrollLeft-Sa,P.scrollTop=qn.current.scrollTop-Jt;}},Pe=()=>{Ne(false),Qc(false);},Ft=ut=>{if(ut.button!==0)return;let Sa=ut.target;Sa.closest("[data-task-bar]")||Sa.closest("[data-dependency-line]")||Sa.closest("button")||Sa.closest('[role="button"]')||Sa.tagName==="rect"&&Sa.getAttribute("data-clickable")==="true"||(Qc(true),qn.current={x:ut.clientX,y:ut.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},ut.preventDefault());};return P.addEventListener("scroll",G),R.addEventListener("scroll",Q),P.addEventListener("mousedown",Ft),document.addEventListener("mousemove",ke),document.addEventListener("mouseup",Pe),()=>{P.removeEventListener("scroll",G),R.removeEventListener("scroll",Q),P.removeEventListener("mousedown",Ft),document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",Pe);}},[me,ml,Ge]);let Zc=useRef(false),Sf=useRef(null);return useLayoutEffect(()=>{if(Zc.current||ne.length===0||!la.current)return;Zc.current=true,Sf.current=mn;let P=la.current,R=new Date,G=gt==="day"?60:gt==="week"?20:8,Q=(R.getTime()-mn.getTime())/(1e3*60*60*24),ke=P.clientWidth,Ft=Q*G*D-ke/2;Q>=0&&ke>0&&(P.scrollLeft=Math.max(0,Ft));},[ne.length,mn,gt,D]),jsx(Mn.Provider,{value:ve,children:jsx(wl.Provider,{value:Xa,children:jsxs("div",{ref:rr,className:"flex flex-col h-full w-full",style:{backgroundColor:zt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...zt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${zt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(xi,{theme:zt,timeScale:gt,onTimeScaleChange:at,zoom:D,onZoomChange:K,currentTheme:we,onThemeChange:U,rowDensity:H,onRowDensityChange:le,showThemeSelector:c,showCreateTaskButton:C&&de?.canCreateTask!==false&&!de?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:T,taskFilter:Le,onTaskFilterChange:nt,hideCompleted:oe,onHideCompletedChange:be,toolbarRightContent:E,wbsLevel:pe,onWbsLevelChange:M,maxWbsDepth:jt,viewMode:Oe,onViewModeChange:De,projectForecast:O,onExportPNG:i?vf:void 0,onExportPDF:i?wf:void 0,onExportExcel:i?kf:void 0,onExportCSV:i?Cf:void 0,onExportJSON:i?Tf:void 0,onExportMSProject:i?Nf:void 0,showCriticalPath:Fe,onShowCriticalPathChange:Gt,showDependencies:ft,onShowDependenciesChange:Mt,highlightWeekends:pt,onHighlightWeekendsChange:Dt,showBaseline:We,onShowBaselineChange:P=>{P&&Oe!=="oracle"&&De("oracle"),!P&&Oe==="oracle"&&De("execution");},onCopySnapshotLink:dt,hasDependencies:nf})}),jsxs("div",{ref:Et,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:St,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(ki,{tasks:Kc,theme:zt,rowHeight:Hs,availableUsers:d,templates:zr,showCriticalPath:Fe,onTaskClick:F,onTaskDblClick:qc,onTaskContextMenu:Z,onTaskToggle:df,scrollTop:j,columns:Ze,onToggleColumn:sf,onColumnResize:lf,onTaskUpdate:pn,onTaskIndent:cf,onTaskOutdent:uf,onTaskMove:mf,onMultiTaskDelete:dl,onTaskDuplicate:gf,onTaskCreate:ff,onTaskRename:bf,onCreateSubtask:cl,onOpenTaskModal:F?P=>F(P):void 0,onDeleteRequest:(P,R)=>Xt({taskId:P,taskName:R}),onTaskReparent:pf,scrollContainerRef:ga})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:zt.border,zIndex:15},onMouseDown:Df}),jsx("div",{ref:la,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(Ai,{tasks:Kc,theme:zt,rowHeight:Hs,timeScale:gt,startDate:mn,endDate:ul,zoom:D,locale:b,templates:zr,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:qc,onTaskContextMenu:yf,onTaskDateChange:hf,onDependencyCreate:Xc,onDependencyDelete:Jc,showBaseline:We,showCriticalPath:Fe,showDependencies:ft,highlightWeekends:pt,canEditTask:de?.canEditTask})})]}),$e.task&&jsx(Pn,{isOpen:$e.isOpen,x:$e.x,y:$e.y,theme:zt,onClose:()=>kt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=$e.task;if(!P)return [];let R=Ee.findTaskById(ne,P.id)||P,G=R.subtasks&&R.subtasks.length>0,Q=de?.canCreateTask!==false,ke=de?.canDeleteTask!==false;if(G){let Jt=[],ua=de?.canDuplicateTask!==false;return Q&&Jt.push({id:"addSubtask",label:ve.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{Je?Je(R):cl(R.id);}}),ua&&Jt.push({id:"duplicate",label:ve.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):He(lr=>fs(lr,[R.id]).tasks),kt({isOpen:false,x:0,y:0,task:null});}}),ke&&(Jt.length>0&&Jt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Jt.push({id:"delete",label:ve.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{Xt({taskId:R.id,taskName:R.name});}})),Jt}let Pe=de?.canUpdateTask!==false,Ft=de?.canDuplicateTask!==false,ut=[];return Pe&&ut.push({id:"edit",label:ve.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{ye?ye(R):Wt(R);}}),Q&&ut.push({id:"addSubtask",label:ve.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{Je?Je(R):cl(R.id);}}),ut.length>0&&Pe&&ut.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(ut.push({id:"markIncomplete",label:ve.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{z?z(R):pn(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),ut.push({id:"setInProgress",label:ve.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{re?re(R):pn(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),ut.push({id:"markComplete",label:ve.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{pn(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(Ft||Pe&&R.startDate&&R.endDate)&&ut.length>0&&ut.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ft&&ut.push({id:"duplicate",label:ve.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):He(Jt=>fs(Jt,[R.id]).tasks),kt({isOpen:false,x:0,y:0,task:null});}}),Pe&&R.startDate&&R.endDate&&ut.push({id:"split",label:ve.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{let Jt=R.startDate.getTime(),ua=R.endDate.getTime(),lr=Jt+(ua-Jt)/2,Dr=new Date(lr);xf(R,Dr);}}),ke&&(ut.length>0&&ut.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ut.push({id:"delete",label:ve.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{Xt({taskId:R.id,taskName:R.name});}})),ut})()}),jsx(bo,{task:mt,isOpen:!!mt,onClose:()=>Wt(null),onTaskUpdate:P=>{mt&&(pn(mt.id,P),Wt(null));},theme:we==="light"?"light":"dark",locale:b==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Ta&&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:()=>Xt(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:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:zt.bgSecondary,border:`1px solid ${zt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${zt.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:zt.textPrimary,fontFamily:"Inter, sans-serif"},children:[ve.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:zt.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:zt.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:zt.textPrimary},children:['"',Ta.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:zt.bgPrimary,borderTop:`1px solid ${zt.border}`},children:[jsx("button",{onClick:()=>Xt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:zt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=zt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:b==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{dl([Ta.taskId]),Xt(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:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),b==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(Bi,{tasks:ne,theme:zt,config:f,onTasksUpdate:He,onTaskUpdate:pn,onTaskCreate:P=>{He(R=>[...R,P]);},onTaskDelete:P=>{dl([P]);},onDependencyCreate:(P,R)=>{let G=Ee.findTaskById(ne,P);G&&Xc(G,R);},onDependencyDelete:Jc})]})})})});function r2(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 o2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let 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:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Id,...i.filter(D=>!Id.some(K=>K.id===D.id))],f=ht[c]||ht.dark,[b,v]=useState(false),[C,N]=useState(false),[T,k]=useState(false),[w,E]=useState(false),[I,S]=useState({top:0,left:0}),[X$1,O]=useState(null),[$,F]=useState(new Date),[Y,Z]=useState({top:0,left:0}),[Se,B]=useState(false),[_,ye]=useState([]),[Je,z]=useState(false),[re,J]=useState(""),Ae=useRef(null),xe=useRef(null),Ue=useRef(null),Re=useRef(null),it=useRef(null),[ee,lt]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[de,dt]=useState({});useEffect(()=>{a?(lt({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||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(lt({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),ye([]));},[a,e,x]),useEffect(()=>{let D=K=>{Ae.current&&!Ae.current.contains(K.target)&&v(false),xe.current&&!xe.current.contains(K.target)&&N(false),Ue.current&&!Ue.current.contains(K.target)&&k(false),Re.current&&!Re.current.contains(K.target)&&E(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let ot=()=>{let D={};return ee.name.trim()||(D.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),dt(D),Object.keys(D).length===0},At=async D=>{if(D.preventDefault(),!!ot())try{let K=l==="create"&&_.length>0?{...ee,pendingFiles:_}:ee;await s(K),ye([]),t();}catch(K){console.error("Error submitting task:",K);}},we=(D,K)=>{lt(pe=>{let Te={...pe,[D]:K};if(D==="status"){let V=K;V==="todo"?Te.progress=0:V==="in-progress"?(pe.progress===0||pe.progress===100)&&(Te.progress=50):V==="completed"||V==="closed"?Te.progress=100:(V==="in-review"||V==="review")&&(Te.progress=75);}if(D==="progress"){let V=typeof K=="number"?K:parseInt(K,10);V===100&&pe.status!=="completed"?Te.status="completed":V>0&&V<100&&pe.status==="todo"?Te.status="in-progress":V===0&&pe.status!=="todo"&&(Te.status="todo");}return Te}),de[D]&&dt(pe=>{let Te={...pe};return delete Te[D],Te});},vt=h.find(D=>D.id===ee.status)??Id[0],gt=Bd.find(D=>D.id===ee.priority)??Bd[1],at=Xo.find(D=>D.value===ee.color)??Xo[0],H=c==="dark",le={backgroundColor:H?"#1d1f27":f.bgSecondary,border:`1px solid ${H?"rgba(65,71,84,0.1)":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-[9999]",style:{backgroundColor:H?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"rgba(65,71,84,0.1)":f.border}`,boxShadow:H?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:D=>D.stopPropagation(),children:jsxs("form",{onSubmit:At,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ee.name,onChange:D=>we("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),de.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),de.name]}),jsx("textarea",{value:ee.description||"",onChange:D=>we("description",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Ae,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:{...le,borderColor:vt.color,backgroundColor:`${vt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:vt.color}}),jsx("span",{style:{color:vt.color},children:vt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:vt.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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("status",D.id),v(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ee.status===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxs("div",{ref:xe,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:le,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:gt.color}}),jsx("span",{children:gt.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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Bd.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("priority",D.id),N(false);},children:[jsx("span",{children:D.icon}),D.label,ee.priority===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxs("div",{ref: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:le,disabled:n,children:[ee.assignees&&ee.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((D,K)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},K))}),ee.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",ee.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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let K=ee.assignees?.some(pe=>pe.name===D.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:pe=>pe.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:pe=>pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let pe=K?(ee.assignees||[]).filter(Te=>Te.name!==D.name):[...ee.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:f.accent}];we("assignees",pe);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:D.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:D.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:K&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxs("div",{ref:Re,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(w)E(false);else {if(Re.current){let D=Re.current.getBoundingClientRect(),K=window.innerHeight,pe=120,V=K-D.bottom<pe?D.top-pe-8:D.bottom+8;S({top:V,left:D.left});}E(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsx("span",{children:at.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsxs(Qt,{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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Xo.slice(0,18).map(D=>{let K=ee.color===D.value;return jsx("button",{type:"button",onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),we("color",D.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:D.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:K?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),m.length>0||d?jsx(So,{selectedTags:ee.tags||[],availableTags:m,onChange:D=>we("tags",D),onCreateTag:d,theme:f,disabled:n}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:H?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${H?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxs("div",{ref:it,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X$1==="start")O(null);else {if(it.current){let D=it.current.getBoundingClientRect();Z({top:D.bottom+8,left:Math.max(16,D.left-40)});}O("start"),F(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...le,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X$1==="end")O(null);else {if(it.current){let D=it.current.getBoundingClientRect();Z({top:D.bottom+8,left:Math.max(16,D.left-40)});}O("end"),F(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...le,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:X$1&&jsxs(Qt,{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:`${Y.top}px`,left:`${Y.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let D=new Date,K=new Date(D);K.setDate(D.getDate()+1);let pe=new Date(D);pe.setDate(D.getDate()+7);let Te=new Date(D);return Te.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:K},{label:"Pr\xF3xima semana",date:pe},{label:"2 semanas",date:Te}].map((te,Oe)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:De=>De.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:De=>De.currentTarget.style.backgroundColor="transparent",onClick:()=>{X$1==="start"?(we("startDate",te.date),(!ee.endDate||te.date>ee.endDate)&&we("endDate",te.date),O("end")):(we("endDate",te.date),(!ee.startDate||te.date<ee.startDate)&&we("startDate",te.date),O(null));},children:te.label},Oe))})(),jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("startDate",void 0),we("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($.getFullYear(),$.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>F(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,K)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},K))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=$.getFullYear(),K=$.getMonth(),pe=new Date(D,K,1).getDay(),Te=new Date(D,K+1,0).getDate(),V=new Date,te=[];for(let De=pe-1;De>=0;De--)te.push({day:new Date(D,K,-De).getDate(),date:new Date(D,K-1,new Date(D,K,-De).getDate()),isCurrentMonth:false});for(let De=1;De<=Te;De++)te.push({day:De,date:new Date(D,K,De),isCurrentMonth:true});let Oe=42-te.length;for(let De=1;De<=Oe;De++)te.push({day:De,date:new Date(D,K+1,De),isCurrentMonth:false});return te.map((De,We)=>{let Fe=De.date.toDateString()===V.toDateString(),Ke=ee.startDate?.toDateString()===De.date.toDateString(),ft=ee.endDate?.toDateString()===De.date.toDateString(),ct=ee.startDate&&ee.endDate&&De.date>=ee.startDate&&De.date<=ee.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:De.isCurrentMonth?Ke||ft?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ke?f.accent:ft?"#7C3AED":ct?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!Ke&&!ft?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{X$1==="start"?(we("startDate",De.date),ee.endDate&&De.date>ee.endDate&&we("endDate",De.date),O("end")):(we("endDate",De.date),ee.startDate&&De.date<ee.startDate&&we("startDate",De.date),O(null));},children:De.day},We)})})()})]})]})]})})]}),de.endDate&&jsx("span",{className:"text-xs text-red-400",children:de.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ee.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:H?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let K=D.currentTarget.getBoundingClientRect(),pe=Math.round((D.clientX-K.left)/K.width*100/5)*5;we("progress",Math.max(0,Math.min(100,pe)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ee.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${H?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>B(!Se),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Se?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"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:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ee.effortMinutes?r2(ee.effortMinutes):"",onChange:D=>{let K=o2(D.target.value);we("effortMinutes",K);},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}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ee.parentId||"",onChange:D=>we("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(D=>D.id!==a?.id).map(D=>jsx("option",{value:D.id,children:D.name},D.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ee.location||"",onChange:D=>we("location",D.target.value),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}`},disabled:n})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ee.equipment||"",onChange:D=>we("equipment",D.target.value),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}`},disabled:n})]})]}),(g||p.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",l==="create"?_.length>0&&`(${_.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(io,{cardId:"pending",attachments:_.map((D,K)=>({id:`pending-${K}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>ye(K=>[...K,...D]),onDelete:D=>{let K=parseInt(D.replace("pending-",""),10);ye(pe=>pe.filter((Te,V)=>V!==K));},maxSizeMB:10,maxFiles:20}):jsx(io,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&_.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[_.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:D=>we("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(D=>{let K=r.find(pe=>pe.id===D);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[K?.name||D.slice(0,8),jsx("button",{type:"button",onClick:()=>{let pe=(ee.dependencies||[]).filter(Te=>Te!==D);we("dependencies",pe);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{type:"button",onClick:()=>{z(!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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsx("input",{type:"text",value:re,onChange:D=>J(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>re===""||D.name.toLowerCase().includes(re.toLowerCase())).map(D=>{let K=ee.dependencies?.includes(D.id);return jsxs("button",{type:"button",onClick:()=>{let pe=ee.dependencies||[],Te;K?Te=pe.filter(V=>V!==D.id):Te=[...pe,D.id],we("dependencies",Te);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:K?`${f.accent}10`:"transparent"},onMouseEnter:pe=>{K||(pe.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:pe=>{pe.currentTarget.style.backgroundColor=K?`${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:K?f.accent:"transparent",borderColor:K?f.accent:f.borderLight},children:K&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:D.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${H?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:H?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=f.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:D=>!n&&(D.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:D=>!n&&(D.currentTarget.style.filter="brightness(1)"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Pm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
368
+ Task dependencies must flow in one direction only.`);return}let G=Q=>Q.map(ve=>{if(ve.id===R){let Ae=ve.dependencies||[];if(!Ae.includes(P.id))return {...ve,dependencies:[...Ae,P.id]}}return ve.subtasks?{...ve,subtasks:G(ve.subtasks)}:ve});Fr.current+=1,E(Q=>G(Q)),Le?.(P.id,R);},[Le,Xc]),Qc=useCallback((P,R)=>{let G=Q=>Q.map(ve=>{if(ve.id===P&&ve.dependencies){let Ae=ve.dependencies.filter(Mt=>Mt!==R);return {...ve,dependencies:Ae}}return ve.subtasks?{...ve,subtasks:G(ve.subtasks)}:ve});Fr.current+=1,E(Q=>G(Q)),we?.(P,R);},[we]),{startDate:gn,endDate:pl}=useMemo(()=>{let P=ye.filter(Ae=>Ae.startDate&&Ae.endDate);if(P.length===0){let Ae=new Date,Mt=new Date(Ae);Mt.setDate(Mt.getDate()-30);let pt=new Date(Ae);return pt.setDate(pt.getDate()+60),{startDate:Mt,endDate:pt}}let R=P.flatMap(Ae=>[Ae.startDate,Ae.endDate]).filter(Ae=>Ae!==void 0),G=new Date(Math.min(...R.map(Ae=>Ae.getTime()))),Q=new Date(Math.max(...R.map(Ae=>Ae.getTime()))),ve=Xe==="day"?7:Xe==="week"?14:30;return G.setDate(G.getDate()-ve),Q.setDate(Q.getDate()+ve),{startDate:G,endDate:Q}},[ye,Xe]);useEffect(()=>{yt.current?.(gn,pl);},[gn,pl]);let wf=useCallback(async()=>{if(!ar.current||!oa.current||!Ea.current)return;await new Promise(jo=>setTimeout(jo,200));let P=ar.current,R=oa.current,G=Sa.current||R.querySelector(".gantt-grid-scroll"),Q=Ea.current,ve=G?.scrollTop||0,Ae=G?.scrollLeft||0,Mt=Q.scrollTop,pt=Q.scrollLeft,Ma=P.style.overflow,Xt=P.style.height,ua=G?.style.overflow||"",ir=Q.style.overflow,Nr=R.style.overflow,Co=P.style.width,bn=Q.style.width;try{let jo=G?.querySelector(".gantt-taskgrid-content"),to=Q.querySelector("svg"),fl=to?.getAttribute("height")?parseInt(to.getAttribute("height"),10):to?.getBoundingClientRect().height||0,hn=jo?.scrollHeight||G?.scrollHeight||600,zs=Math.max(fl,Q.scrollHeight),Yn=to?.getAttribute("width")?parseInt(to.getAttribute("width"),10):to?.getBoundingClientRect().width||Q.scrollWidth,Mf=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,bl=Math.max(hn,zs,fl),tu=Mf+bl+50,au=(G?.offsetWidth||R.offsetWidth||300)+Yn+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,P.style.overflow="visible",P.style.height=`${tu}px`,P.style.width=`${au}px`,R.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${bl+50}px`),Q.style.overflow="visible",Q.style.height=`${bl+50}px`,Q.style.width=`${Yn+10}px`,await new Promise(Us=>setTimeout(Us,150));let Ff=await toPng(P,{backgroundColor:Ft.bgPrimary,pixelRatio:2,width:au,height:tu,skipFonts:!1,filter:Us=>{if(!(Us instanceof Element))return !0;let ru=window.getComputedStyle(Us),ou=parseInt(ru.zIndex,10);return !(!isNaN(ou)&&ou>=50||ru.position==="fixed")}}),hl=document.createElement("a");hl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,hl.href=Ff,hl.click();}finally{P.style.overflow=Ma,P.style.height=Xt,P.style.width=Co,R.style.overflow=Nr,G&&(G.style.overflow=ua,G.style.height="",G.scrollTop=ve,G.scrollLeft=Ae),Q.style.overflow=ir,Q.style.height="",Q.style.width=bn,Q.scrollTop=Mt,Q.scrollLeft=pt;}p?.("png");},[Ft,p]),kf=useCallback(async()=>{await Se.exportToPDF(ye),p?.("pdf");},[ye,p]),ml=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d});ml.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:d};let Cf=useCallback(async()=>{let P=new Date,R=ve=>String(ve).padStart(2,"0"),G=`${P.getFullYear()}-${R(P.getMonth()+1)}-${R(P.getDate())}_${R(P.getHours())}${R(P.getMinutes())}`,Q=d?d.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(ye,`${Q}_${G}.xlsx`,ml.current),p?.("excel");},[ye,d,p]),Tf=useCallback(()=>{let P=Se.exportToCSV(ye),R=new Blob([P],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href),p?.("csv");},[ye,p]),Nf=useCallback(()=>{let P=Se.exportToJSON(ye),R=new Blob([P],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(R),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href),p?.("json");},[ye,p]),Df=useCallback(()=>{Se.exportToMSProject(ye,"Gantt Project","project.xml"),p?.("msproject");},[ye,p]),Sf=P=>{P.preventDefault(),Je(true);},fn=useRef(false),[gl,Zc]=useState(false),qn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=Ea.current,R=oa.current?.querySelector(".gantt-grid-scroll");if(!P||!R)return;let G=()=>{if(fn.current)return;fn.current=true;let pt=P.scrollTop;ge(pt),R.scrollTop=pt,requestAnimationFrame(()=>{fn.current=false;});},Q=()=>{if(fn.current)return;fn.current=true;let pt=R.scrollTop;ge(pt),P.scrollTop=pt,requestAnimationFrame(()=>{fn.current=false;});},ve=pt=>{if(De&&R){let Xt=R.parentElement?.getBoundingClientRect()?.left||0,ua=pt.clientX-Xt,ir=200,Nr=it+At,Co=window.innerWidth*St,bn=Math.max(Nr,Co);ua>=ir&&ua<=bn&&ze(ua);}if(gl&&P){let Ma=pt.clientX-qn.current.x,Xt=pt.clientY-qn.current.y;P.scrollLeft=qn.current.scrollLeft-Ma,P.scrollTop=qn.current.scrollTop-Xt;}},Ae=()=>{Je(false),Zc(false);},Mt=pt=>{if(pt.button!==0)return;let Ma=pt.target;Ma.closest("[data-task-bar]")||Ma.closest("[data-dependency-line]")||Ma.closest("button")||Ma.closest('[role="button"]')||Ma.tagName==="rect"&&Ma.getAttribute("data-clickable")==="true"||(Zc(true),qn.current={x:pt.clientX,y:pt.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},pt.preventDefault());};return P.addEventListener("scroll",G),R.addEventListener("scroll",Q),P.addEventListener("mousedown",Mt),document.addEventListener("mousemove",ve),document.addEventListener("mouseup",Ae),()=>{P.removeEventListener("scroll",G),R.removeEventListener("scroll",Q),P.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",ve),document.removeEventListener("mouseup",Ae);}},[De,gl,it]);let eu=useRef(false),Ef=useRef(null);return useLayoutEffect(()=>{if(eu.current||ye.length===0||!Ea.current)return;eu.current=true,Ef.current=gn;let P=Ea.current,R=new Date,G=Xe==="day"?60:Xe==="week"?20:8,Q=(R.getTime()-gn.getTime())/(1e3*60*60*24),ve=P.clientWidth,Mt=Q*G*K-ve/2;Q>=0&&ve>0&&(P.scrollLeft=Math.max(0,Mt));},[ye.length,gn,Xe,K]),jsx(Fn.Provider,{value:ke,children:jsx(kl.Provider,{value:eo,children:jsxs("div",{ref:ar,className:"flex flex-col h-full w-full",style:{backgroundColor:Ft.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Ft.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Ft.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(xi,{theme:Ft,timeScale:Xe,onTimeScaleChange:H,zoom:K,onZoomChange:ce,currentTheme:mt,onThemeChange:Ze,rowDensity:ne,onRowDensityChange:D,showThemeSelector:c,showCreateTaskButton:N&&et?.canCreateTask!==false&&!et?.canCreateSubtaskOnly,createTaskLabel:T,onCreateTask:k,taskFilter:at,onTaskFilterChange:ie,hideCompleted:me,onHideCompletedChange:L,toolbarRightContent:I,wbsLevel:Te,onWbsLevelChange:se,maxWbsDepth:Ua,viewMode:Ne,onViewModeChange:He,projectForecast:$,onExportPNG:i?wf:void 0,onExportPDF:i?kf:void 0,onExportExcel:i?Cf:void 0,onExportCSV:i?Tf:void 0,onExportJSON:i?Nf:void 0,onExportMSProject:i?Df:void 0,showCriticalPath:Ge,onShowCriticalPathChange:Et,showDependencies:dt,onShowDependenciesChange:Nt,highlightWeekends:ot,onHighlightWeekendsChange:Tt,showBaseline:Fe,onShowBaselineChange:P=>{P&&Ne!=="oracle"&&He("oracle"),!P&&Ne==="oracle"&&He("execution");},onCopySnapshotLink:nt,hasDependencies:sf})}),jsxs("div",{ref:oa,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Sa,className:"gantt-grid-scroll flex-shrink-0",style:{width:zt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(ki,{tasks:qc,theme:Ft,rowHeight:Hs,availableUsers:m,templates:mo,showCriticalPath:Ge,onTaskClick:q,onTaskDblClick:Yc,onTaskContextMenu:Ee,onTaskToggle:cf,scrollTop:Y,columns:ue,onToggleColumn:lf,onColumnResize:df,onTaskUpdate:mn,onTaskIndent:uf,onTaskOutdent:pf,onTaskMove:gf,onMultiTaskDelete:cl,onTaskDuplicate:ff,onTaskCreate:bf,onTaskRename:hf,onCreateSubtask:ul,onOpenTaskModal:q?P=>q(P):void 0,onDeleteRequest:(P,R)=>U({taskId:P,taskName:R}),onTaskReparent:mf,scrollContainerRef:Sa})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Ft.border,zIndex:15},onMouseDown:Sf}),jsx("div",{ref:Ea,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:gl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Ai,{tasks:qc,theme:Ft,rowHeight:Hs,timeScale:Xe,startDate:gn,endDate:pl,zoom:K,locale:v,templates:mo,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:q,onTaskDblClick:Yc,onTaskContextMenu:xf,onTaskDateChange:yf,onDependencyCreate:Jc,onDependencyDelete:Qc,showBaseline:Fe,showCriticalPath:Ge,showDependencies:dt,highlightWeekends:ot,canEditTask:et?.canEditTask})})]}),vt.task&&jsx(An,{isOpen:vt.isOpen,x:vt.x,y:vt.y,theme:Ft,onClose:()=>ut({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=vt.task;if(!P)return [];let R=Se.findTaskById(ye,P.id)||P,G=R.subtasks&&R.subtasks.length>0,Q=et?.canCreateTask!==false,ve=et?.canDeleteTask!==false;if(G){let Xt=[],ua=et?.canDuplicateTask!==false;return Q&&Xt.push({id:"addSubtask",label:ke.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{z?z(R):ul(R.id);}}),ua&&Xt.push({id:"duplicate",label:ke.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):E(ir=>fs(ir,[R.id]).tasks),ut({isOpen:false,x:0,y:0,task:null});}}),ve&&(Xt.length>0&&Xt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Xt.push({id:"delete",label:ke.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{U({taskId:R.id,taskName:R.name});}})),Xt}let Ae=et?.canUpdateTask!==false,Mt=et?.canDuplicateTask!==false,pt=[];return Ae&&pt.push({id:"edit",label:ke.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{Ye?Ye(R):ha(R);}}),Q&&pt.push({id:"addSubtask",label:ke.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{z?z(R):ul(R.id);}}),pt.length>0&&Ae&&pt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ae&&(pt.push({id:"markIncomplete",label:ke.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{re?re(R):mn(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),pt.push({id:"setInProgress",label:ke.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{J?J(R):mn(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),pt.push({id:"markComplete",label:ke.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{mn(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(Mt||Ae&&R.startDate&&R.endDate)&&pt.length>0&&pt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Mt&&pt.push({id:"duplicate",label:ke.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):E(Xt=>fs(Xt,[R.id]).tasks),ut({isOpen:false,x:0,y:0,task:null});}}),Ae&&R.startDate&&R.endDate&&pt.push({id:"split",label:ke.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{let Xt=R.startDate.getTime(),ua=R.endDate.getTime(),ir=Xt+(ua-Xt)/2,Nr=new Date(ir);vf(R,Nr);}}),ve&&(pt.length>0&&pt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),pt.push({id:"delete",label:ke.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{U({taskId:R.id,taskName:R.name});}})),pt})()}),jsx(bo,{task:Wt,isOpen:!!Wt,onClose:()=>ha(null),onTaskUpdate:P=>{Wt&&(mn(Wt.id,P),ha(null));},theme:mt==="light"?"light":"dark",locale:v==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsx(AnimatePresence,{children:ta&&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:()=>U(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:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Ft.bgSecondary,border:`1px solid ${Ft.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Ft.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:Ft.textPrimary,fontFamily:"Inter, sans-serif"},children:[ke.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Ft.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="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:Ft.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Ft.textPrimary},children:['"',ta.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Ft.bgPrimary,borderTop:`1px solid ${Ft.border}`},children:[jsx("button",{onClick:()=>U(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Ft.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Ft.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{cl([ta.taskId]),U(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:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),b?.enabled&&jsx(Bi,{tasks:ye,theme:Ft,config:b,onTasksUpdate:E,onTaskUpdate:mn,onTaskCreate:P=>{E(R=>[...R,P]);},onTaskDelete:P=>{cl([P]);},onDependencyCreate:(P,R)=>{let G=Se.findTaskById(ye,P);G&&Jc(G,R);},onDependencyDelete:Qc})]})})})});function o2(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 n2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let 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 Bd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Rd=[{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 Pm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:p=[],onCreateTag:d,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Bd,...i.filter(D=>!Bd.some(K=>K.id===D.id))],f=ft[c]||ft.dark,[b,v]=useState(false),[C,N]=useState(false),[T,k]=useState(false),[w,F]=useState(false),[I,S]=useState({top:0,left:0}),[X$1,O]=useState(null),[$,A]=useState(new Date),[q,Z]=useState({top:0,left:0}),[Ee,B]=useState(false),[_,he]=useState([]),[Ye,z]=useState(false),[re,J]=useState(""),Le=useRef(null),we=useRef(null),Oe=useRef(null),Be=useRef(null),lt=useRef(null),[ee,ct]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[pe,et]=useState({});useEffect(()=>{a?(ct({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||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(ct({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),he([]));},[a,e,x]),useEffect(()=>{let D=K=>{Le.current&&!Le.current.contains(K.target)&&v(false),we.current&&!we.current.contains(K.target)&&N(false),Oe.current&&!Oe.current.contains(K.target)&&k(false),Be.current&&!Be.current.contains(K.target)&&F(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let nt=()=>{let D={};return ee.name.trim()||(D.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),et(D),Object.keys(D).length===0},Ut=async D=>{if(D.preventDefault(),!!nt())try{let K=l==="create"&&_.length>0?{...ee,pendingFiles:_}:ee;await s(K),he([]),t();}catch(K){console.error("Error submitting task:",K);}},Ce=(D,K)=>{ct(ce=>{let Te={...ce,[D]:K};if(D==="status"){let V=K;V==="todo"?Te.progress=0:V==="in-progress"?(ce.progress===0||ce.progress===100)&&(Te.progress=50):V==="completed"||V==="closed"?Te.progress=100:(V==="in-review"||V==="review")&&(Te.progress=75);}if(D==="progress"){let V=typeof K=="number"?K:parseInt(K,10);V===100&&ce.status!=="completed"?Te.status="completed":V>0&&V<100&&ce.status==="todo"?Te.status="in-progress":V===0&&ce.status!=="todo"&&(Te.status="todo");}return Te}),pe[D]&&et(ce=>{let Te={...ce};return delete Te[D],Te});},mt=h.find(D=>D.id===ee.status)??Bd[0],Dt=Rd.find(D=>D.id===ee.priority)??Rd[1],Xe=Jo.find(D=>D.value===ee.color)??Jo[0],H=c==="dark",ne={backgroundColor:H?"#1d1f27":f.bgSecondary,border:`1px solid ${H?"rgba(65,71,84,0.1)":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-[9999]",style:{backgroundColor:H?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"rgba(65,71,84,0.1)":f.border}`,boxShadow:H?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:D=>D.stopPropagation(),children:jsxs("form",{onSubmit:Ut,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ee.name,onChange:D=>Ce("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),pe.name]}),jsx("textarea",{value:ee.description||"",onChange:D=>Ce("description",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Le,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:{...ne,borderColor:mt.color,backgroundColor:`${mt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:mt.color}}),jsx("span",{style:{color:mt.color},children:mt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:mt.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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("status",D.id),v(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ee.status===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxs("div",{ref:we,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:ne,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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Rd.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("priority",D.id),N(false);},children:[jsx("span",{children:D.icon}),D.label,ee.priority===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxs("div",{ref:Oe,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:ne,disabled:n,children:[ee.assignees&&ee.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((D,K)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},K))}),ee.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",ee.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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let K=ee.assignees?.some(ce=>ce.name===D.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=K?(ee.assignees||[]).filter(Te=>Te.name!==D.name):[...ee.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Ce("assignees",ce);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:D.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:D.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:K&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(w)F(false);else {if(Be.current){let D=Be.current.getBoundingClientRect(),K=window.innerHeight,ce=120,V=K-D.bottom<ce?D.top-ce-8:D.bottom+8;S({top:V,left:D.left});}F(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsx("span",{children:Xe.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsxs(Jt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>F(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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Jo.slice(0,18).map(D=>{let K=ee.color===D.value;return jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),Ce("color",D.value),F(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:K?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),p.length>0||d?jsx(So,{selectedTags:ee.tags||[],availableTags:p,onChange:D=>Ce("tags",D),onCreateTag:d,theme:f,disabled:n}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:H?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${H?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxs("div",{ref:lt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X$1==="start")O(null);else {if(lt.current){let D=lt.current.getBoundingClientRect();Z({top:D.bottom+8,left:Math.max(16,D.left-40)});}O("start"),A(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X$1==="end")O(null);else {if(lt.current){let D=lt.current.getBoundingClientRect();Z({top:D.bottom+8,left:Math.max(16,D.left-40)});}O("end"),A(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:X$1&&jsxs(Jt,{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:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let D=new Date,K=new Date(D);K.setDate(D.getDate()+1);let ce=new Date(D);ce.setDate(D.getDate()+7);let Te=new Date(D);return Te.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:K},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:Te}].map((te,$e)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{X$1==="start"?(Ce("startDate",te.date),(!ee.endDate||te.date>ee.endDate)&&Ce("endDate",te.date),O("end")):(Ce("endDate",te.date),(!ee.startDate||te.date<ee.startDate)&&Ce("startDate",te.date),O(null));},children:te.label},$e))})(),jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ce("startDate",void 0),Ce("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:()=>A(new Date($.getFullYear(),$.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>A(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,K)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},K))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=$.getFullYear(),K=$.getMonth(),ce=new Date(D,K,1).getDay(),Te=new Date(D,K+1,0).getDate(),V=new Date,te=[];for(let Ne=ce-1;Ne>=0;Ne--)te.push({day:new Date(D,K,-Ne).getDate(),date:new Date(D,K-1,new Date(D,K,-Ne).getDate()),isCurrentMonth:false});for(let Ne=1;Ne<=Te;Ne++)te.push({day:Ne,date:new Date(D,K,Ne),isCurrentMonth:true});let $e=42-te.length;for(let Ne=1;Ne<=$e;Ne++)te.push({day:Ne,date:new Date(D,K+1,Ne),isCurrentMonth:false});return te.map((Ne,He)=>{let Fe=Ne.date.toDateString()===V.toDateString(),Ge=ee.startDate?.toDateString()===Ne.date.toDateString(),ht=ee.endDate?.toDateString()===Ne.date.toDateString(),dt=ee.startDate&&ee.endDate&&Ne.date>=ee.startDate&&Ne.date<=ee.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ne.isCurrentMonth?Ge||ht?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ge?f.accent:ht?"#7C3AED":dt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!Ge&&!ht?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{X$1==="start"?(Ce("startDate",Ne.date),ee.endDate&&Ne.date>ee.endDate&&Ce("endDate",Ne.date),O("end")):(Ce("endDate",Ne.date),ee.startDate&&Ne.date<ee.startDate&&Ce("startDate",Ne.date),O(null));},children:Ne.day},He)})})()})]})]})]})})]}),pe.endDate&&jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ee.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:H?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let K=D.currentTarget.getBoundingClientRect(),ce=Math.round((D.clientX-K.left)/K.width*100/5)*5;Ce("progress",Math.max(0,Math.min(100,ce)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ee.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${H?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>B(!Ee),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Ee?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:Ee&&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:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ee.effortMinutes?o2(ee.effortMinutes):"",onChange:D=>{let K=n2(D.target.value);Ce("effortMinutes",K);},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}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ee.parentId||"",onChange:D=>Ce("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(D=>D.id!==a?.id).map(D=>jsx("option",{value:D.id,children:D.name},D.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ee.location||"",onChange:D=>Ce("location",D.target.value),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}`},disabled:n})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ee.equipment||"",onChange:D=>Ce("equipment",D.target.value),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}`},disabled:n})]})]}),(g||m.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",l==="create"?_.length>0&&`(${_.length})`:m.length>0&&`(${m.length})`]})]}),l==="create"?jsx(so,{cardId:"pending",attachments:_.map((D,K)=>({id:`pending-${K}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>he(K=>[...K,...D]),onDelete:D=>{let K=parseInt(D.replace("pending-",""),10);he(ce=>ce.filter((Te,V)=>V!==K));},maxSizeMB:10,maxFiles:20}):jsx(so,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&_.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[_.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:D=>Ce("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(D=>{let K=r.find(ce=>ce.id===D);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[K?.name||D.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ce=(ee.dependencies||[]).filter(Te=>Te!==D);Ce("dependencies",ce);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{type:"button",onClick:()=>{z(!Ye),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:Ye&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsx("input",{type:"text",value:re,onChange:D=>J(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>re===""||D.name.toLowerCase().includes(re.toLowerCase())).map(D=>{let K=ee.dependencies?.includes(D.id);return jsxs("button",{type:"button",onClick:()=>{let ce=ee.dependencies||[],Te;K?Te=ce.filter(V=>V!==D.id):Te=[...ce,D.id],Ce("dependencies",Te);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:K?`${f.accent}10`:"transparent"},onMouseEnter:ce=>{K||(ce.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=K?`${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:K?f.accent:"transparent",borderColor:K?f.accent:f.borderLight},children:K&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:D.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${H?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:H?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=f.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:D=>!n&&(D.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:D=>!n&&(D.currentTarget.style.filter="brightness(1)"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Am=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
369
369
 
370
370
  AVAILABLE COMMANDS:
371
371
  1. move_task - Move a task to a different date
@@ -406,39 +406,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
406
406
 
407
407
  Always try to match task names case-insensitively and handle partial matches.
408
408
  If you can't find a task by name, search through the provided task list.
409
- If ambiguous, ask for clarification in the message field.`;function Am(e){return `CURRENT TASKS:
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(`
409
+ If ambiguous, ask for clarification in the message field.`;function Lm(e){return `CURRENT TASKS:
410
+ ${Im(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 wo(e,t){let a=Lm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function Rd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let 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 l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),g=parseInt(l[2],10)-1,y=parseInt(l[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},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),g=c[i[2].toLowerCase()],y=i[3]?parseInt(i[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 i=r[1].trim(),m=r[2].trim(),d=wo(t,i),p=Rd(m);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${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 i=o[1].trim(),m=o[2].trim(),d=wo(t,i),p=Od(m);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${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 i=s[1].trim(),m=s[2].trim(),d=wo(t,i),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:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),m=n[2].trim(),d=wo(t,i);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:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),m=l[2].trim(),d=wo(t,i),p=wo(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:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),m=wo(t,i);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function 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 n2(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 s2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function $i(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=>$i(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},l=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:n2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function 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:s2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function $m(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>$i(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"}},Hi={en:Hd,es:zd};function Ud(e){return Hi[e]||Hi.en}function zi(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),l=useRef(null);useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=Hm(e),i=Wd[0],m=Wd.find(g=>g.value===c)??i,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:l,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 Vd=[{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),l=useRef(null);useEffect(()=>{let m=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Vd.find(m=>m.value===e)??Vd[4],i=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[i]})]}):jsxs("div",{ref:l,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[i]}),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:Vd.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[i]})]},m.value))})]})}function ws(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 jd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=useState(false),[c,i]=useState(""),m=useRef(null),d=useRef(null);useEffect(()=>{let x=h=>{m.current&&!m.current.contains(h.target)&&(l(false),i(""));};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:ws(x.name),color:x.color||Gd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}l(false),i("");}};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||ws(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(),l(!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||ws(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=>i(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||ws(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"}):ws(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 qm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,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 i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),useEffect(()=>{i&&p(r?o:"start");},[i,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),S=new Date(k,w+1,0).getDate(),X=E.getDay(),O=[],F=new Date(k,w,0).getDate();for(let Z=X-1;Z>=0;Z--)O.push({date:new Date(k,w-1,F-Z),isCurrentMonth:false});for(let Z=1;Z<=S;Z++)O.push({date:new Date(k,w,Z),isCurrentMonth:true});let Y=42-O.length;for(let Z=1;Z<=Y;Z++)O.push({date:new Date(k,w+1,Z),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 S=new Date(k);S.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:S,display:S.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(l){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(!i);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)})]}),i&&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(),S=f?.toDateString()===k.date.toDateString(),X=I||S,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",S&&!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 Vi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(qm,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Hn(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 Gi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[l,c]=useState(false),i=useRef(e),m=useRef([]);return useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.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 i.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Ym(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,l]=useState(0),c=useRef(null),i=useRef(null),m=useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),l(0);let y=Date.now();i.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue: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,l]=useState(false),[c,i]=useState(""),m=useRef(null),{isFlashing:d,triggerFlash:p}=Hn(),{displayValue:g,isAnimating:y}=Gi(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(),i(String(e)),l(true));},[r,t,e]);useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=useCallback(()=>{l(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"&&l(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:[v>0?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}%`}})}):jsx("div",{className:"flex-1"}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsx("input",{ref:m,value:c,onChange:C=>i(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",v===0?a?"text-[#6B7280]":"text-gray-400":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),[l,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let m=()=>{l!==e&&t?.(l),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:i,type:"text",value:l,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:l=true,enableSaveFlash:c=true}){let[i,m]=useState(false),[d,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:x}=Hn(),{displayValue:h,isAnimating:f}=Gi(e,{enabled:l&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),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}):i?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,l]=useState(false),c=useRef(null);return useEffect(()=>{let i=m=>{c.current&&!c.current.contains(m.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[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:i=>{i.stopPropagation(),l(!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(i=>jsxs("button",{onClick:m=>{m.stopPropagation(),a(i),l(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===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function sg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:m}=Ym(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?m():i(!e):t(!e));},p=l?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className: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",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:g=>{g.stopPropagation(),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 j2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+c}let 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:l=false,lens:c="hours",hourlyRate:i=0}){let[m,d]=useState(false),[p,g]=useState(""),y=useRef(null),{isFlashing:x,triggerFlash:h}=Hn(),f=c==="financial"&&i>0,b=f&&e?`$${Math.round(e/60*i).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=j2(p);T!==e&&(t?.(T),n&&h()),d(false);},C=T=>{T.key==="Enter"?v():T.key==="Escape"&&d(false);};if(l)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className: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 justify-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 justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",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"}),l=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className: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"]}),l()]})}function fg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:c=0}){let i=a==="es",m=l==="financial"&&c>0,d=Z=>m?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}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 Z=Se=>{b.current&&!b.current.contains(Se.target)&&(x(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[y,h]);let S=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Se=>!Se),f(null);return}n&&n(e);},X=Z=>{x(false),f(Z);},O=async(Z,Se)=>{h==="log"&&r&&Z?r(e,Z,Se):h==="estimate"&&o?o(e,Z):h==="quoted"&&s&&s(e,Z),f(null);},$=r||o||s||n,F=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.show),Y=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:Z=>Z.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&&$&&jsx("button",{onClick:S,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ 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(Z=>jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(Z.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(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(oo,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:Z=>Z.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:[(()=>{let Z=v===0,B=(C>0?v/C:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:Z?t?"#4B5563":"#9CA3AF":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:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",d(E)," ",i?"Excedido":"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"}})})]}),$&&jsx("button",{onClick:S,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ 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(Z=>jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(Z.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(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(oo,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function Q2(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 Z2(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=Q2(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 l=n?.percentage??0,c=!!n&&l>0,i=c?Z2(l):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&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var e1={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",e1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function f1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function b1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Ng({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,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}),l&&(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:()=>{l({...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:()=>{l({...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:()=>{l({...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:()=>{l({...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:()=>{l({...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:()=>{l({...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:()=>{l({...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||[],S=E.some(X=>X.name===w.name)?E.filter(X=>X.name!==w.name):[...E,{name:w.name,initials:f1(w.name),color:w.color||b1(w.name),avatar:w.avatarUrl}];l({...e.task,assignees:S}),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 i&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(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(h1,{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 h1({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(l=>jsxs("button",{onClick:l.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:l.icon}),l.label]},l.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"})},I1=["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:l}){let[c,i]=useState(""),[m,d]=useState(null),[p,g]=useState(null),y=useRef(null),x=l==="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(),S=window.innerHeight-E.top-20;d(Math.max(300,S));};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([...I1]);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(S=>S.type===k&&(!w||S.customFieldId===w));if(E){b(E.id);return}let I={id:w||k,type:k,label:w?r.find(S=>S.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=>i(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(S=>S.type===k&&!S.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:S=>{I||(S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background: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 V1=[{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(""),[l,c]=useState("text"),[i,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:l};l==="dropdown"&&(h.options=i.filter(f=>f.trim())),a(h),t();},g=()=>{m([...i,""]);},y=(h,f)=>{let b=[...i];b[h]=f,m(b);},x=h=>{i.length>1&&m(i.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:V1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===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:l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:u("text-xs",l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),l==="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:[i.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")}),i.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,l]=useState(false),c=useRef(null),i=useRef(0),m=s==="es"?Ug.es:Ug.en;useEffect(()=>{if(!n)return;let g=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},y=x=>{x.key==="Escape"&&l(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||(i.current=Date.now()),l(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),l(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"),l(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 Vg(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 Ds(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function Gg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours",onUnassignedTaskClick:s}){let n=a==="es",l=o==="financial";return jsxs("div",{className:u("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?n?"SALUD FINANCIERA":"FINANCIAL HEALTH":n?"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:n?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,m=e.totalExecuted??0,d=c-i,p=c>0?Math.round(d/c*100):0,g=c>0?Math.min(Math.round(i/c*100),120):0,y=i>c&&c>0,x=y?"#F87171":"#00E5CC";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:n?"V. Oferta":"Offered Value"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Ds(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Estimado":"Estimated"}),jsx("span",{className:u("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Ds(i)})]}),m>0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Ejecutado":"Executed"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Ds(m)})]}),c>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(g,100)}%`,backgroundColor:x}})}),jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",d>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[d>=0?`+${Ds(d)} ${n?"Disp.":"Avail."}`:`${Ds(Math.abs(d))} ${n?"P\xE9rdida":"Loss"}`,c>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",p,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,m=i>0?Math.min(Math.round(c/i*100),100):0,g=(i>0?c/i:0)>1.1?"#F87171":m>=90?"#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-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:n?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Vg(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Vg(i)})]}),i>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:`${m}%`,backgroundColor:g}})})]})]})})(),(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-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:n?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"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.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:u("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:u("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?n?"tarea pendiente":"pending task":n?"tareas pendientes":"pending tasks"}),jsx("p",{className:u("text-[10px]",t?"text-white/40":"text-gray-400"),children:n?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:u("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxs("button",{onClick:()=>s?.(c.id),className:u("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:u("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className: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:n?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,m=c<0,d=e.scheduleVarianceLabel||(i?`+${c} ${n?"D\xEDas ADELANTE":"Days AHEAD"}`:m?`${c} ${n?"D\xEDas ATR\xC1S":"Days BEHIND"}`:n?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",m&&"bg-[#F87171]/15 text-[#F87171]",!i&&!m&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:d})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let m=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.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(c.utilizationPercent,100)}%`,backgroundColor:m}})})]},`${c.name}-${i}`)})})]})]})}var nw=[{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 Jg(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(...Jg(r.subtasks,t+1));return a}function sw(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 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>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Vn(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:l=>l.stopPropagation(),onChange:l=>n(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),o(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.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:l=>{l.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 Yg(e){if(e.length===0)return 0;let t=0,a=0,r=0,o=0;for(let c of e){let i=c.weight||0;i>0&&(t+=(c.progress||0)*i,a+=i,r+=1),o+=c.progress||0;}let s=r/e.length,l=a>=99&&s>=.95?t/a:o/e.length;return Math.round(l*10)/10}function lc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?lc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0});return t}function Qg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[],toolbarRightContent:i}){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:S=false,showProjectTotals:X=false}=t,O=zi(d,p),$=m==="dark",F=M=>{if(!I||!M.assignees||M.assignees.length===0)return E;let se=0,Ce=0;for(let Be of M.assignees){let Ze=Be.id?I[Be.id]:void 0;if(Ze==null||Ze<=0)continue;let fe=typeof Be.estimatedMinutes=="number"?Be.estimatedMinutes:0;fe>0&&(se+=Ze*fe,Ce+=fe);}if(Ce>0)return se/Ce;let ve=M.assignees.map(Be=>Be.id?I[Be.id]:void 0).filter(Be=>Be!=null&&Be>0);return ve.length===0?E:ve.reduce((Be,Ze)=>Be+Ze,0)/ve.length},Y=M=>{let se=0,Ce=0,ve=0,Be=Ze=>{for(let fe of Ze)if(fe.subtasks&&fe.subtasks.length>0){let Ge={s:se,a:Ce,q:ve};if(Be(fe.subtasks),se-Ge.s+(Ce-Ge.a)+(ve-Ge.q)===0){let Ct=F(fe);se+=(fe.timeLoggedMinutes??0)/60*Ct,Ce+=(fe.effortMinutes??0)/60*Ct,ve+=(fe.soldEffortMinutes??0)/60*Ct;}}else {let Ge=F(fe);se+=(fe.timeLoggedMinutes??0)/60*Ge,Ce+=(fe.effortMinutes??0)/60*Ge,ve+=(fe.soldEffortMinutes??0)/60*Ge;}};return M.subtasks&&Be(M.subtasks),{dollarSpent:se,dollarAllocated:Ce,dollarQuoted:ve}},Z=useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(N);if(M){let se=JSON.parse(M);return {statusFilter:se.statusFilter||"all",hideCompleted:se.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[N]),Se=useMemo(()=>{function M(se){let Ce=0,ve=0,Be=0,Ze=0,fe=0,Ge=0;for(let st of se)if(st.subtasks&&st.subtasks.length>0){let Ct=M(st.subtasks);if(Ct.spent+Ct.allocated+Ct.quoted>0)Ce+=Ct.spent,ve+=Ct.allocated,Be+=Ct.quoted,Ze+=Ct.dollarSpent,fe+=Ct.dollarAllocated,Ge+=Ct.dollarQuoted;else {let St=st.timeLoggedMinutes??0,Et=st.effortMinutes??0,ga=st.soldEffortMinutes??0;Ce+=St,ve+=Et,Be+=ga;let la=F(st);Ze+=St/60*la,fe+=Et/60*la,Ge+=ga/60*la;}}else {let Ct=st.timeLoggedMinutes??0,Lt=st.effortMinutes??0,St=st.soldEffortMinutes??0;Ce+=Ct,ve+=Lt,Be+=St;let Et=F(st);Ze+=Ct/60*Et,fe+=Lt/60*Et,Ge+=St/60*Et;}return {spent:Ce,allocated:ve,quoted:Be,dollarSpent:Ze,dollarAllocated:fe,dollarQuoted:Ge}}return M(e)},[e]),B=useMemo(()=>{let M=new Map;function se(Ce){let ve=0;for(let Be of Ce)if(Be.subtasks&&Be.subtasks.length>0){let Ze=se(Be.subtasks);M.set(Be.id,Ze),ve+=Ze;}else ve+=Be.weight||0;return ve}return se(e),M},[e]),_=useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:Se.spent,totalHoursAllocatedMinutes:Se.allocated}},[k,Se]),[ye,Je]=useState(true),[z,re]=useState(null),[J,Ae]=useState("position"),[xe,Ue]=useState("asc"),[Re,it]=useState(""),[ee,lt]=useState(()=>Z().statusFilter),[de,dt]=useState(()=>Z().hideCompleted),[ot,At]=useState(x||nw),[we,vt]=useState(false),[gt,at]=useState(false),[H,le]=useState({isOpen:false,x:0,y:0,type:"task"}),[D,K]=useState(null),[pe,Te]=useState(false),[V,te]=useState(null),[Oe,De]=useState(null),[We,Fe]=useState(null),Ke=useRef(0),ft=useRef(false),ct=!!(a.onTaskMove||a.onTaskReparent),pt=useCallback((M,se)=>{ct&&(se.preventDefault(),Ke.current=se.clientY,K(M),ft.current=false,Te(false),Fe({x:se.clientX,y:se.clientY}));},[ct]),rt=useCallback(M=>{if(!D||(Math.abs(M.clientY-Ke.current)>5&&!ft.current&&(ft.current=true,Te(true)),Fe({x:M.clientX,y:M.clientY}),!ft.current))return;let Ce=document.querySelectorAll("[data-listview-row]"),ve=null,Be=null;Ce.forEach(Ze=>{let fe=Ze.getBoundingClientRect(),Ge=Ze.getAttribute("data-listview-row");if(Ge&&Ge!==D&&M.clientY>=fe.top&&M.clientY<=fe.bottom){ve=Ge;let st=M.clientY-fe.top,Ct=fe.height;Be=st<Ct*.25?"above":st>Ct*.75?"below":"child";}}),te(ve),De(Be);},[D]),Gt=useCallback(()=>{if(ft.current&&D&&V&&Oe){if(Oe==="child"&&a.onTaskReparent)a.onTaskReparent(D,V);else if(Oe==="above"||Oe==="below"){let M=(ve,Be,Ze=null)=>{for(let fe of ve){if(fe.id===Be)return Ze;if(fe.subtasks){let Ge=M(fe.subtasks,Be,fe.id);if(Ge!==void 0)return Ge}}},se=M(e,D,null),Ce=M(e,V,null);if(a.onTaskReparent){let ve=(Ct,Lt)=>{if(Lt===null)return Ct;for(let St of Ct){if(St.id===Lt)return St.subtasks||[];if(St.subtasks){let Et=ve(St.subtasks,Lt);if(Et.length>0||St.subtasks.some(ga=>ga.id===Lt))return Et}}return []},Be=ve(e,Ce??null),Ze=Be.findIndex(Ct=>Ct.id===V),fe=se===Ce,Ge=fe?Be.findIndex(Ct=>Ct.id===D):-1,st=Oe==="below"?Ze+1:Ze;fe&&Ge!==-1&&Ge<Ze&&(st-=1),a.onTaskReparent(D,Ce??null,Math.max(0,st));}}}K(null),te(null),De(null),Fe(null),ft.current=false,Te(false);},[D,V,Oe,e,a]);useEffect(()=>{if(D)return document.addEventListener("mousemove",rt),document.addEventListener("mouseup",Gt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",Gt),document.body.style.cursor="",document.body.style.userSelect="";}},[D,rt,Gt]);let[Mt,Dt]=useState("all"),[wt,bt]=useState(false),Ut=useRef(null),Ve=useRef(null),Le=useMemo(()=>{let M=0;function se(Ce,ve){for(let Be of Ce)ve>M&&(M=ve),Be.subtasks?.length&&se(Be.subtasks,ve+1);}return se(e,1),M},[e]);useEffect(()=>{if(!wt)return;let M=se=>{Ut.current?.contains(se.target)||Ve.current?.contains(se.target)||bt(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[wt]),useEffect(()=>{if(Mt==="all"){let Ce=function(ve){for(let Be of ve)Be.subtasks?.length&&(Be.isExpanded===false&&a.onTaskToggleExpand?.(Be.id),Ce(Be.subtasks));};Ce(e);}else {let Ce=function(ve,Be){for(let Ze of ve)if(Ze.subtasks?.length){let fe=Be<Mt,Ge=Ze.isExpanded!==false;fe!==Ge&&a.onTaskToggleExpand?.(Ze.id),Ce(Ze.subtasks,Be+1);}};Ce(e,1);}},[Mt]);let[nt,oe]=useState(null),[be,L]=useState(0),[j,q]=useState(0),me=useRef(null),[Ne,Xe]=useState(null),[_e,$e]=useState(null);useEffect(()=>{x&&At(M=>{if(M.length===x.length){let se=true;for(let Ce=0;Ce<M.length;Ce++){let ve=M[Ce],Be=x[Ce];if(!ve||!Be||ve.id!==Be.id||ve.visible!==Be.visible||ve.width!==Be.width||ve.label!==Be.label){se=false;break}}if(se)return M}return x});},[x]),useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:ee,hideCompleted:de}));}catch(M){console.error("Error persisting filter state:",M);}},[N,ee,de]);let kt=useMemo(()=>{let M=new Set;function se(Ce){for(let ve of Ce)ve.subtasks?.length&&(ve.isExpanded!==false&&M.add(ve.id),se(ve.subtasks));}return se(e),M},[e]),mt=useMemo(()=>ot.filter(M=>M.visible),[ot]),Wt=useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),Ta=useCallback(M=>{J===M?Ue(se=>se==="asc"?"desc":"asc"):(Ae(M),Ue("asc")),a.onSortChange?.({column:M,direction:xe==="asc"?"desc":"asc"});},[J,xe,a]),Xt=useCallback(M=>{At(M),a.onColumnsChange?.(M);},[a]),U=useCallback(M=>{let se=ot.map(Ce=>Ce.id===M?{...Ce,visible:false}:Ce);Xt(se);},[ot,Xt]),ne=useCallback((M,se)=>{Ae(M),Ue(se);},[]),He=useCallback((M,se,Ce)=>{b&&(M.preventDefault(),le({isOpen:true,x:M.clientX,y:M.clientY,type:se?"task":"header",task:se,columnId:Ce}));},[b]),A=useCallback(()=>{le(M=>({...M,isOpen:false}));},[]),ge=useCallback((M,se)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let Ce=ot.find(ve=>ve.id===se);Ce&&(oe(se),L(M.clientX),q(Ce.width));},[ot,f]);useEffect(()=>{if(!nt)return;let M=ot,se=ve=>{let Be=ve.clientX-be,Ze=Math.max(50,j+Be);M=M.map(fe=>fe.id===nt?{...fe,width:Ze}:fe),At(M);},Ce=()=>{a.onColumnsChange?.(M),oe(null);};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",Ce),()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",Ce);}},[nt,be,j,a]);let je=useCallback((M,se)=>{if(se==="name"){M.preventDefault();return}Xe(se),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",se),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),et=useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),Xe(null),$e(null);},[]),oa=useCallback((M,se)=>{M.preventDefault(),se!=="name"&&(M.dataTransfer.dropEffect="move",$e(se));},[]),jt=useCallback(()=>{$e(null);},[]),La=useCallback((M,se)=>{if(M.preventDefault(),!Ne||Ne===se||se==="name")return;let Ce=[...ot],ve=Ce.findIndex(fe=>fe.id===Ne),Be=Ce.findIndex(fe=>fe.id===se);if(ve===-1||Be===-1)return;let Ze=Ce.splice(ve,1);Ze[0]&&(Ce.splice(Be,0,Ze[0]),Xt(Ce),Xe(null),$e(null));},[Ne,ot,Xt]),_a=useCallback(async M=>{if(a.onCreateCustomField){let se={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(se);}at(false);},[a]),Ia=useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),ma=useMemo(()=>{let M=Jg(e);if(Re.trim()){let se=Re.toLowerCase();M=M.filter(Ce=>Ce.name.toLowerCase().includes(se));}return ee!=="all"&&(M=M.filter(se=>Ia(se)===ee)),de&&(M=M.filter(se=>Ia(se)!=="completed")),M.sort((se,Ce)=>{let ve,Be;switch(J){case "name":ve=se.name.toLowerCase(),Be=Ce.name.toLowerCase();break;case "startDate":ve=se.startDate?.getTime()||0,Be=Ce.startDate?.getTime()||0;break;case "endDate":ve=se.endDate?.getTime()||0,Be=Ce.endDate?.getTime()||0;break;case "progress":ve=se.progress||0,Be=Ce.progress||0;break;case "status":ve=se.status||"todo",Be=Ce.status||"todo";break;case "priority":let Ze={urgent:0,high:1,medium:2,low:3,none:4};ve=Ze[se.priority]??4,Be=Ze[Ce.priority]??4;break;case "position":return 0;default:return 0}return ve<Be?xe==="asc"?-1:1:ve>Be?xe==="asc"?1:-1:0}),M},[e,Re,ee,de,J,xe,Ia]),dr=useCallback((M,se)=>{let Ce=Ze=>{a.onTaskUpdate?.({...M,...Ze});},ve=Ze=>Ze?M.customFields?.find(Ge=>Ge.fieldId===Ze)?.value:void 0,Be=(Ze,fe)=>{if(!Ze)return;let st=[...M.customFields||[]],Ct=st.findIndex(Lt=>Lt.fieldId===Ze);Ct>=0?st[Ct]={fieldId:Ze,value:fe}:st.push({fieldId:Ze,value:fe}),Ce({customFields:st});};switch(se.type){case "name":return null;case "status":return jsx(zm,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:fe=>{Ce({status:fe,progress:fe==="completed"?100:fe==="in-progress"?50:0});},isDark:$,locale:d,translations:O.status});case "priority":return jsx(Wm,{value:M.priority,onChange:fe=>Ce({priority:fe}),isDark:$,locale:d});case "assignees":{let fe=M.hasChildren,Ge=M.assignees||[];if(fe&&M.subtasks?.length){let st=new Map;(M.assignees||[]).forEach(Lt=>st.set(Lt.name,Lt));let Ct=Lt=>{(Lt||[]).forEach(St=>{(St.assignees||[]).forEach(Et=>{st.has(Et.name)||st.set(Et.name,Et);}),St.subtasks?.length&&Ct(St.subtasks);});};Ct(M.subtasks),Ge=Array.from(st.values());}return jsx(jd,{value:Ge,availableUsers:l,onChange:st=>Ce({assignees:st}),isDark:$,locale:d,disabled:fe})}case "startDate":return jsx(Vi,{value:M.startDate,onChange:fe=>Ce({startDate:fe}),isDark:$,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsx(Vi,{value:M.endDate,onChange:fe=>Ce({endDate:fe}),isDark:$,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":{let fe=!!(M.subtasks&&M.subtasks.length>0),Ge=fe?Yg(lc(M.subtasks||[])):M.progress||0;return jsx(Jm,{value:Ge,onChange:fe?void 0:st=>{let Ct=st===100?"completed":st>0?"in-progress":"todo";Ce({progress:st,status:Ct});},isDark:$,disabled:fe})}case "tags":return jsx(dg,{value:M.tags||[],isDark:$});case "text":return jsx(eg,{value:ve(se.customFieldId)||"",onChange:fe=>Be(se.customFieldId,fe),isDark:$});case "number":return jsx(rg,{value:ve(se.customFieldId)||0,onChange:fe=>Be(se.customFieldId,fe),isDark:$});case "date":let Ze=ve(se.customFieldId);return jsx(Vi,{value:Ze?new Date(Ze):void 0,onChange:fe=>Be(se.customFieldId,fe),isDark:$,locale:d});case "dropdown":return jsx(og,{value:ve(se.customFieldId)||"",options:se.options||[],onChange:fe=>Be(se.customFieldId,fe),isDark:$});case "checkbox":return jsx(sg,{value:ve(se.customFieldId)||false,onChange:fe=>Be(se.customFieldId,fe),isDark:$});case "estimatedTime":{let fe=M.status==="completed"||M.progress===100;return jsx(Nr,{value:M.estimatedTime,onChange:Ge=>Ce({estimatedTime:Ge}),isDark:$,locale:d,disabled:fe,lens:w,hourlyRate:F(M)})}case "quotedTime":{let fe=M.status==="completed"||M.progress===100,Ge=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(Nr,{value:M.quotedTime,onChange:st=>Ce({quotedTime:st}),isDark:$,locale:d,disabled:fe,isBlurred:Ge,lens:w,hourlyRate:F(M)})}case "elapsedTime":{let fe=M.status==="completed"||M.progress===100;return jsx(Nr,{value:M.elapsedTime,onChange:Ge=>Ce({elapsedTime:Ge}),isDark:$,locale:d,disabled:fe,lens:w,hourlyRate:F(M)})}case "effortMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{allocated:Lt}=Gn(M);if(w==="financial"){let St=Y(M),Et=Math.round(St.dollarAllocated),ga=Math.round(St.dollarQuoted),la=ga-Et;return jsxs("div",{className:"flex flex-col",children:[Et>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Et.toLocaleString("es-CO")]}):null,la!==0&&Et>0&&ga>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",la>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[la>0?"+":"",Math.abs(la)>=1e3?`$${(la/1e3).toFixed(1)}K`:`$${la}`]})]})}return jsx(Nr,{value:Lt>0?Lt:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:E})}let fe=M.status==="completed"||M.progress===100,Ge=M.effortMinutes||0,st=M.soldEffortMinutes||0,Ct=F(M);if(w==="financial"&&Ct&&Ge>0&&st>0){let Lt=Math.round(Ge/60*Ct),Et=Math.round(st/60*Ct)-Lt;return jsxs("div",{className:"flex flex-col",children:[jsx(Nr,{value:Ge,onChange:ga=>Ce({effortMinutes:ga}),isDark:$,locale:d,disabled:fe,lens:w,hourlyRate:F(M)}),Et!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Et>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Et>0?"+":"",Math.abs(Et)>=1e3?`$${(Et/1e3).toFixed(1)}K`:`$${Et}`]})]})}return jsx(Nr,{value:Ge,onChange:Lt=>Ce({effortMinutes:Lt}),isDark:$,locale:d,disabled:fe,lens:w,hourlyRate:F(M)})}case "timeLoggedMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{spent:Ge}=Gn(M);return jsx(Nr,{value:Ge>0?Ge:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:F(M)})}let fe=M.status==="completed"||M.progress===100;return jsx(Nr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?Ge=>{a.onLogTime?.(M,Ge);}:void 0,isDark:$,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:fe,lens:w,hourlyRate:F(M)})}case "soldEffortMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{quoted:st}=Gn(M),Ct=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Nr,{value:st>0?st:void 0,isDark:$,locale:d,disabled:true,isBlurred:Ct,lens:w,hourlyRate:F(M)})}let fe=M.status==="completed"||M.progress===100,Ge=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Nr,{value:M.soldEffortMinutes,onChange:st=>Ce({soldEffortMinutes:st}),isDark:$,locale:d,disabled:fe,isBlurred:Ge,lens:w,hourlyRate:F(M)})}case "scheduleVariance":{let fe=M.effortMinutes||0,Ge=M.soldEffortMinutes||0,st=M.timeLoggedMinutes||0,Ct=fe>0||Ge>0||st>0;return jsx(mg,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:$,locale:d,hasTimeAllocated:Ct})}case "hoursBar":{if(S&&M.hasChildren){let{spent:fe,allocated:Ge,quoted:st}=Gn(M),Ct=fe>Ge&&Ge>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",$?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",Ct?"text-[#FF453A]":$?"text-white/80":"text-gray-800"),children:Vn(fe)}),Ge>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:$?"text-white/60":"text-gray-600",children:Vn(Ge)})]}),st>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:$?"text-amber-400/70":"text-amber-600",children:Vn(st)})]})]})}return jsx(fg,{task:M,isDark:$,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:w,hourlyRate:F(M)})}case "teamLoad":return M.hasChildren||M.subtasks&&M.subtasks.length>0?jsx(hg,{task:M,isDark:$,locale:d}):jsx(jd,{value:M.assignees||[],availableUsers:l,onChange:Ge=>{a.onTaskUpdate?.({...M,assignees:Ge});},isDark:$,locale:d});case "blockers":return jsx(xg,{blockers:M.blockers,isDark:$,locale:d});case "weight":{let fe=B.get(M.id);if(fe!==void 0)return jsx("span",{className:u("text-xs font-mono",fe>0?$?"text-white/50":"text-gray-400":$?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:fe>0?`${Number(fe.toFixed(2))}%`:"\u2014"});let Ge=M.weight||0;return jsx(iw,{value:Ge,onChange:st=>Ce({weight:st}),isDark:$})}default:return jsx("span",{className:u("text-sm",$?"text-white/60":"text-gray-500"),children:"-"})}},[a,$,d,l,O,S,B]),Kn=useCallback(M=>{let Ce={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")}[M.type]||M.label;return typeof Ce=="string"?Ce:String(Ce||M.type)},[O,d]),Hr=useMemo(()=>{let Ce=mt.reduce((Be,Ze)=>Be+Ze.width,0)+(h?48:0),ve={};for(let Be of mt)ve[Be.id]=`${Be.width/Ce*100}%`;return ve},[mt,h]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",$?"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",$?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",$?"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",$?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",$?"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",$?"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",$?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsx("p",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxs("div",{ref:me,className:u($?"bg-[#0D0D0D]":"bg-white",nt&&"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",$?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:[ma.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",$?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Re,onChange:M=>it(M.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",$?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),y&&Le>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:Ut,onClick:()=>bt(!wt),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",$?wt?"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]":wt?"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"}),Mt==="all"?d==="es"?"Todos":"All":`L${Mt}`]}),wt&&jsx("div",{ref:Ve,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",$?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Le,5)},(M,se)=>({value:se+1,label:`L${se+1}`}))].map(M=>jsxs("button",{onClick:()=>{Dt(M.value),bt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",$?Mt===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Mt===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:M.label}),Mt===M.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsx(Wg,{value:ee,hideCompleted:de,onChange:lt,onHideCompletedChange:dt,isDark:$,locale:d}),_?.enabled&&_.data&&!ye&&jsx("button",{onClick:()=>Je(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",$?"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-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",$?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[ct&&jsx("div",{className:"w-5 flex-shrink-0"}),mt.map(M=>{let se=M.id!=="name",Ce=_e===M.id&&Ne!==M.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",$?"text-white/60":"text-gray-500",se&&"cursor-grab",M.type!=="name"&&"justify-center",Ne===M.id&&"opacity-50",Ce&&($?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Hr[M.id],minWidth:M.minWidth},draggable:se,onDragStart:se?ve=>je(ve,M.id):void 0,onDragEnd:se?et:void 0,onDragOver:se?ve=>oa(ve,M.id):void 0,onDragLeave:se?jt:void 0,onDrop:se?ve=>La(ve,M.id):void 0,onContextMenu:ve=>He(ve,void 0,M.id),children:[se&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",$?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxs("button",{draggable:false,onClick:()=>Ta(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Kn(M),jsx(ArrowUpDown,{className:u("w-3 h-3",J===M.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:Kn(M)}),f&&M.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",nt===M.id&&"bg-[#007BFF]"),onMouseDown:ve=>ge(ve,M.id)})]},M.id)}),h&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:M=>{M.stopPropagation(),vt(se=>!se);},className:u("p-0.5 rounded transition-colors",$?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",we&&($?"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:we,onClose:()=>vt(false),columns:ot,customFields:c,onColumnsChange:Xt,onCreateCustomField:()=>{vt(false),at(true);},isDark:$,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:ma.map((M,se)=>{let Ce=kt.has(M.id),ve=Math.min(se*.01,.2),Be=M.hasChildren&&M.level===0,Ze=M.subtasks?.length||0;if(Be){let{spent:St,allocated:Et,quoted:ga}=Gn(M),la=sw(M);return jsxs(motion.div,{"data-task-id":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:u("flex items-center border-y cursor-pointer transition-colors duration-500",$?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",z===M.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(M),children:[ct&&jsx("div",{className:"w-5 flex-shrink-0"}),mt.map(rr=>jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",rr.type!=="name"&&"justify-center"),style:{width:Hr[rr.id],minWidth:rr.minWidth},children:rr.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:zt=>{zt.stopPropagation(),Wt(M.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsx(ChevronDown,{className:u("w-4 h-4",$?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",$?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:zt=>{zt.stopPropagation(),Wt(M.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:Ce?jsx(FolderOpen,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:$?"#FFD60A":"#B45309"},children:M.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",$?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:M.name}),jsxs("span",{className:u("text-[10px] font-mono",$?"text-white/30":"text-gray-500"),children:["(",Ze," ",d==="es"?Ze===1?"Tarea":"Tareas":Ze===1?"Item":"Items",")"]}),la!==null&&jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",la>=1?"text-[#32D74B] bg-[#32D74B]/10":la>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",la.toFixed(2)]})]})]}):rr.type==="timeLoggedMinutes"?w==="financial"?(()=>{let zt=Y(M),Xa=Math.round(zt.dollarSpent);return Xa>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Xa.toLocaleString("en-US")]}):null})():jsx(Nr,{value:St>0?St:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:F(M)}):rr.type==="soldEffortMinutes"?w==="financial"?(()=>{let zt=Y(M),Xa=Math.round(zt.dollarQuoted);return Xa>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Xa.toLocaleString("en-US")]}):null})():jsx(Nr,{value:ga>0?ga:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:F(M)}):rr.type==="effortMinutes"?w==="financial"?(()=>{let zt=Y(M),Xa=Math.round(zt.dollarAllocated),zr=Math.round(zt.dollarQuoted),to=zr-Xa;return jsxs("div",{className:"flex flex-col",children:[Xa>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Xa.toLocaleString("es-CO")]}):null,to!==0&&Xa>0&&zr>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",to>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[to>0?"+":"",Math.abs(to)>=1e3?`$${(to/1e3).toFixed(1)}K`:`$${to}`]})]})})():jsx(Nr,{value:Et>0?Et:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:F(M)}):dr(M,rr)},rr.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)}let fe=D===M.id,Ge=V===M.id,st=Ge&&Oe==="above",Ct=Ge&&Oe==="below",Lt=Ge&&Oe==="child";return jsxs(motion.div,{"data-task-id":M.id,"data-listview-row":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:u("flex items-center border-b transition-colors relative group",$?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",z===M.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:fe?.4:1,backgroundColor:Lt?$?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:Lt?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:St=>He(St,M),children:[st&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),Ct&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),ct&&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:St=>pt(M.id,St),style:{color:$?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),mt.map(St=>jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",St.type!=="name"&&"justify-center"),style:{width:Hr[St.id],minWidth:St.minWidth},children:St.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&M.level>0&&jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),y&&M.hasChildren&&jsx("button",{onClick:Et=>{Et.stopPropagation(),Wt(M.id);},className:u("p-0.5 rounded flex-shrink-0",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsx(ChevronDown,{className:u("w-4 h-4",$?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",$?"text-white/60":"text-gray-400")})}),y&&!M.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",$?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsx("span",{className:u("text-[10px] font-mono",$?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsx("span",{className:u("truncate",M.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",M.progress===100?$?"line-through text-white/50":"line-through text-gray-400":M.hasChildren?$?"text-white":"text-gray-900":$?"text-[#D1D5DB]":"text-gray-600"),children:M.name}),M.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):dr(M,St)},St.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),X&&ma.length>0&&(()=>{let{spent:M,allocated:se,quoted:Ce}=Se,ve=se-M,Be=ve<0,Ze=Be?`+${Vn(Math.abs(ve))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Vn(ve)} ${d==="es"?"AHORRADO":"SAVED"}`,fe=w==="financial"&&E>0,Ge=(Lt,St)=>{if(fe){let Et=St??Lt/60*E;return `$${Math.round(Et).toLocaleString("es-CO")}`}return Vn(Lt)},st=fe?Math.abs(Se.dollarAllocated-Se.dollarSpent):0,Ct=fe?`${Be?"+":"-"}$${st.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Be?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:Ze;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",$?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:$?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[ct&&jsx("div",{className:"w-5 flex-shrink-0"}),mt.map(Lt=>jsx("div",{className:u("flex items-center px-4 py-3",Lt.type!=="name"&&"justify-center"),style:{width:Hr[Lt.id],minWidth:Lt.minWidth},children:Lt.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Lt.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ge(M,fe?Se.dollarSpent:void 0)}),jsx("span",{className:u("text-[11px]",$?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",$?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ge(se,fe?Se.dollarAllocated:void 0)})]}),se>0&&jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Be?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:fe?Ct:Ze})]}):Lt.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ce>0?Ge(Ce,fe?Se.dollarQuoted:void 0):"\u2013"}):Lt.type==="effortMinutes"?(()=>{if(fe&&Ce>0&&se>0){let St=Math.round(Se.dollarQuoted),Et=Math.round(Se.dollarAllocated),ga=St-Et,la=St>0?Math.round(ga/St*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ge(se,Se.dollarAllocated)}),jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",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}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",la,"%)"]})]})]})}return jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?Ge(se,fe?Se.dollarAllocated:void 0):"\u2013"})})():Lt.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?Ge(M,fe?Se.dollarSpent:void 0):"\u2013"}):Lt.type==="progress"?(()=>{let St=Yg(lc(e||[]));return jsxs("span",{className:u("text-[12px] font-bold font-mono",$?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[St,"%"]})})():Lt.type==="weight"?(()=>{let St=e||[],Et=[],ga=Xa=>{for(let zr of Xa)Et.push(zr),zr.subtasks?.length&&ga(zr.subtasks);};ga(St);let rr=Et.filter(Xa=>!Xa.subtasks?.length||Xa.subtasks.length===0).reduce((Xa,zr)=>Xa+(zr.weight||0),0),zt=Math.abs(rr-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",zt?$?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(rr.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",$?"text-white/30":"text-gray-300"),children:"\u2013"})},Lt.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),ma.length===0&&Re&&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",$?"text-white/30":"text-gray-400")}),jsx("p",{className:u($?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),_?.enabled&&_.data&&ye&&jsx(Gg,{data:_.data,isDark:$,locale:d,onClose:()=>Je(false),lens:t?.lens,onUnassignedTaskClick:M=>{let se=document.querySelector(`[data-task-id="${M}"]`);se&&(se.scrollIntoView({behavior:"smooth",block:"center"}),re(M),setTimeout(()=>re(null),2e3));}})]}),jsx(Ng,{state:H,onClose:A,isDark:$,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:U,onColumnSort:ne,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),pe&&We&&D&&createPortal(jsx("div",{style:{position:"fixed",left:We.x+12,top:We.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Ee.flattenTasks(e).find(Ce=>Ce.id===D);return se?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:$?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${$?"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:$?"#e6edf3":"#111827"},children:se.name})]}):null})()}),document.body),jsx($g,{isOpen:gt,onClose:()=>at(false),onSave:_a,isDark:$,locale:d})]})}var Zg=[{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}],e0=[{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"}],t0=[{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 dc={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"},cc={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"},uc={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"},Xi={dark:dc,light:cc,neutral:uc};function a0(e){return Xi[e]||Xi.dark}var pc={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"}},mc={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"}},Ji={en:pc,es:mc};function Es(e){return Ji[e]||Ji.en}function Qi(e,t){let a=Es(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 r0(e){let t=Es(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 o0(e,t=0,a=true){let r=Es(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 Fs(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 fc(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 i0({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 c0=26,fw=22,bw=10;function l0(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 bc(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 u0(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 d0(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:l=0}){let{task:c,spanCols:i,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?bc(c.effortMinutes,n,l):null,f=p?u0(c,n,l):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*c0}px`,left:"1px",width:`calc(${i*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 p0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,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:S=false,suppressDetailModal:X$1=false,lens:O="hours",hourlyRate:$=0}){let{theme:F="dark",locale:Y="en",customTranslations:Z,showBacklog:Se=true}=t,B=Qi(Y,Z),_=F==="dark"||F==="neutral",[ye,Je]=useState(r||new Date),[z,re]=useState(null),[J,Ae]=useState(null),[xe,Ue]=useState(null),[Re,it]=useState({}),ee=3,lt=3,de=useCallback(V=>{Ae(V.id),X$1||re(V),h?.(V.id);},[X$1,h]),[dt,ot]=useState(null),At=useCallback(()=>{Je(new Date(ye.getFullYear(),ye.getMonth()-1,1));},[ye]),we=useCallback(()=>{Je(new Date(ye.getFullYear(),ye.getMonth()+1,1));},[ye]),vt=useCallback(()=>{Je(new Date);},[]),gt=useMemo(()=>{let V=ye.getFullYear(),te=ye.getMonth(),Oe=new Date(V,te,1),De=new Date(V,te+1,0),We=Oe.getDay(),Fe=De.getDate(),Ke=Fs(e),ft=new Date;ft.setHours(0,0,0,0);let ct=[],pt=We,rt=new Date(V,te,0).getDate();for(let Mt=pt-1;Mt>=0;Mt--){let Dt=new Date(V,te-1,rt-Mt);ct.push({date:Dt,isCurrentMonth:false,isToday:false,isWeekend:Dt.getDay()===0||Dt.getDay()===6,events:Ke.filter(wt=>fc(Dt,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Mt=1;Mt<=Fe;Mt++){let Dt=new Date(V,te,Mt),wt=Dt.getTime()===ft.getTime();ct.push({date:Dt,isCurrentMonth:true,isToday:wt,isWeekend:Dt.getDay()===0||Dt.getDay()===6,events:Ke.filter(bt=>fc(Dt,bt)).map(bt=>({id:bt.id,title:bt.name,start:bt.startDate,end:bt.endDate,task:bt}))});}let Gt=42-ct.length;for(let Mt=1;Mt<=Gt;Mt++){let Dt=new Date(V,te+1,Mt);ct.push({date:Dt,isCurrentMonth:false,isToday:false,isWeekend:Dt.getDay()===0||Dt.getDay()===6,events:Ke.filter(wt=>fc(Dt,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return ct},[ye,e]),at=useMemo(()=>Fs(e).filter(V=>!V.startDate||!V.endDate),[e]),H=useMemo(()=>{let V=Fs(e),te=0,Oe=0,De=0,We=0,Fe=0;V.forEach(rt=>{rt.effortMinutes&&(te+=rt.effortMinutes),rt.soldEffortMinutes&&(Oe+=rt.soldEffortMinutes),rt.scheduleVariance!=null&&(De+=rt.scheduleVariance,We++),rt.soldEffortMinutes&&rt.effortMinutes&&(Fe+=rt.soldEffortMinutes-rt.effortMinutes);});let Ke=Oe>0?Math.min(100,Math.round(te/Oe*100)):0,ft=We>0?Math.round(De/We):0,pt=`${Fe<0?"-":"+"}${d0(Fe,O,$)}`;return {budgetUtil:Ke,avgVariance:ft,costDisplay:pt,hasCostData:Oe>0}},[e,O,$]),le=useMemo(()=>{let V=[0,0,0,0,0,0];return gt.forEach((te,Oe)=>{let De=Math.floor(Oe/7);te.events.forEach(We=>{if(We.task.startDate&&We.task.soldEffortMinutes){let Fe=new Date(We.task.startDate),Ke=te.date;Fe.getFullYear()===Ke.getFullYear()&&Fe.getMonth()===Ke.getMonth()&&Fe.getDate()===Ke.getDate()&&De<V.length&&(V[De]-=We.task.soldEffortMinutes);}});}),V},[gt]),D=useMemo(()=>{let V=Fs(e),te=new Map,Oe=new Set,De=[0,0,0,0,0,0];if(gt.length===0)return {segmentsByCell:te,multiDayTaskIds:Oe,maxLanesPerRow:De};let We=pt=>new Date(pt.getFullYear(),pt.getMonth(),pt.getDate()),Fe=We(gt[0].date),Ke=We(gt[gt.length-1].date),ft=[];for(let pt of V){if(!pt.startDate||!pt.endDate)continue;let rt=We(pt.startDate),Gt=We(pt.endDate);if(rt.getTime()===Gt.getTime()||Gt<Fe||rt>Ke)continue;let Mt=rt<Fe?Fe:rt,Dt=Gt>Ke?Ke:Gt,wt=l0(Mt,Fe),bt=l0(Dt,Fe);wt<0||wt>41||bt<0||bt>41||wt!==bt&&(Oe.add(pt.id),ft.push({task:pt,startIdx:wt,endIdx:bt}));}ft.sort((pt,rt)=>pt.startIdx!==rt.startIdx?pt.startIdx-rt.startIdx:rt.endIdx-rt.startIdx-(pt.endIdx-pt.startIdx));let ct=[[],[],[],[],[],[]];for(let{task:pt,startIdx:rt,endIdx:Gt}of ft){let Mt=Math.floor(rt/7),Dt=Math.floor(Gt/7),wt=We(pt.startDate),bt=We(pt.endDate),Ut=false;for(let Ve=Mt;Ve<=Dt;Ve++){let Le=Ve===Mt?rt%7:0,nt=Ve===Dt?Gt%7:6,oe=nt-Le+1,be=0,L=ct[Ve]??[];for(ct[Ve]||(ct[Ve]=L);be<L.length&&(L[be]??-1)>=Le;)be++;if(be>=bw){Ut=true;break}be>=L.length?L.push(nt):L[be]=nt,De[Ve]=Math.max(De[Ve]??0,be+1);let j=Ve===Mt&&wt>=Fe,q=Ve===Dt&&bt<=Ke,me=Ve*7+Le,Ne={taskId:pt.id,task:pt,rowIndex:Ve,startCol:Le,endCol:nt,spanCols:oe,lane:be,isStart:j,isEnd:q};te.has(me)||te.set(me,[]),te.get(me).push(Ne);}Ut&&(Oe.delete(pt.id),te.forEach((Ve,Le)=>{let nt=Ve.filter(oe=>oe.taskId!==pt.id);nt.length===0?te.delete(Le):te.set(Le,nt);}));}return {segmentsByCell:te,multiDayTaskIds:Oe,maxLanesPerRow:De}},[gt,e]),K=Y==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],pe=ye.toLocaleDateString(Y==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Te=pe.charAt(0).toUpperCase()+pe.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",_?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",_?"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",_?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",_?"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",_?"bg-[#050505]":"bg-white",n),style:l,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",_?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",_?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsx("p",{className:u("text-sm",_?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",_?"bg-[#050505]":"bg-white",n),style:l,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",_?"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",_?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",_?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",_?"text-white":"text-gray-900"),children:Y==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:At,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"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",_?"text-white":"text-gray-900"),children:Te}),jsx("button",{onClick:we,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"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",_?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:vt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",_?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:K.map(V=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",_?"text-white/60 font-mono":"text-gray-500"),children:V},V))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",_?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ae(null),children:gt.map((V,te)=>{let Oe=te%7===6,De=te>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Oe&&(_?"border-r border-[#222]":"border-r border-gray-200"),!De&&(_?"border-b border-[#222]":"border-b border-gray-200"),_?V.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":V.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",V.isToday&&_&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",V.isToday&&!_&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",V.isToday?_?"text-[#007FFF] font-bold":"text-blue-600 font-bold":V.isCurrentMonth?_?"text-white/60":"text-gray-900":_?"text-white/20":"text-gray-400"),children:String(V.date.getDate()).padStart(2,"0")}),(()=>{let We=Math.floor(te/7),Fe=(D.maxLanesPerRow[We]??0)*c0,Ke=D.segmentsByCell.get(te);return Fe===0&&!Ke?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Fe}px`,zIndex:5},children:Ke?.map(ft=>jsx(hw,{segment:ft,isDark:_,blurFinancials:S,isSelected:J===ft.taskId,t:B,lens:O,hourlyRate:$,onClick:()=>{de(ft.task),a.onEventClick?.({id:ft.task.id,title:ft.task.name,start:ft.task.startDate,end:ft.task.endDate,task:ft.task});}},ft.taskId))})})(),(()=>{let We=V.events.filter(Fe=>Fe.task.isMilestone&&!D.multiDayTaskIds.has(Fe.id));return We.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[We.slice(0,4).map(Fe=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Fe.title,onClick:Ke=>{Ke.stopPropagation(),de(Fe.task);}},Fe.id)),We.length>4&&jsxs("span",{className:u("text-[8px] font-mono",_?"text-white/30":"text-gray-400"),children:["+",We.length-4]})]})})(),(()=>{let We=[];V.events.forEach(Ke=>{Ke.task.blockers?.forEach(ft=>{(ft.severity==="warning"||ft.severity==="critical")&&We.push({taskId:Ke.id,type:ft.type,severity:ft.severity,variance:Ke.task.scheduleVariance});});});let Fe=We[0];return Fe?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",Fe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Fe.type,Fe.variance?` (+${Math.abs(Fe.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let We=V.events.filter(ct=>!D.multiDayTaskIds.has(ct.id)),Fe=Re[te]||ee,Ke=We.slice(0,Fe),ft=We.length-Fe;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ke.map(ct=>jsxs(motion.button,{onClick:()=>{de(ct.task),a.onEventClick?.(ct);},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",ct.task.progress===100||ct.task.status==="completed"?_?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":_?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:_?ct.task.progress===100||ct.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)"}:ct.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]",ct.task.isMilestone?_?"text-amber-400":"text-amber-600":ct.task.isCriticalPath?"text-red-400":_?"text-[#1264FF]":"text-gray-400"),children:ct.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:ct.title})]},ct.id)),ft>0&&jsxs("button",{onClick:ct=>{ct.stopPropagation(),it(pt=>({...pt,[te]:Fe+lt}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ft," ",Y==="es"?"m\xE1s":"more"]}),Fe>ee&&We.length>ee&&jsx("button",{onClick:ct=>{ct.stopPropagation(),it(pt=>({...pt,[te]:ee}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:Y==="es"?"menos":"less"})]})})(),V.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let We=te>=28,Fe=te%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Ke=>{Ke.stopPropagation(),ot(dt===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",dt===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",_?"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",dt===te&&"rotate-45")})}),jsx(AnimatePresence,{children:dt===te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ot(null)}),jsx(motion.div,{initial:{opacity:0,y:We?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:We?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",We?"bottom-full mb-1":"top-full mt-1",Fe?"right-0":"left-0",_?"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:Ke=>{a.onTaskCreate?.({name:Ke.name,startDate:Ke.startDate||V.date,endDate:Ke.endDate||V.date,priority:Ke.priority,assignees:Ke.assignee?[Ke.assignee]:void 0}),ot(null);},onCancel:()=>ot(null),availableUsers:t.availableUsers,isDark:_,locale:Y==="es"?"es":"en",defaultDate:V.date,dropdownDirection:We?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let We=Math.floor(te/7),Fe=le[We];if(!Fe||Fe===0)return null;let Ke=d0(Fe,O,$);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Fe<0?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Fe<0?"-":"+",Ke]})})()]},te)})})})]}),Se&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",_?"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",_?"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]",_?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",_?"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",_?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",_?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",_?"text-white/20":"text-gray-400"),children:Y==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):at.map(V=>jsxs("button",{onClick:()=>{de(V);},className:u("w-full text-left rounded-md p-3 transition-all group/card",_?"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",_?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",_?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:V.name})]}),V.tags&&V.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[V.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)),V.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",_?"text-white/20":"text-gray-400"),children:["+",V.tags.length-3]})]}),(V.effortMinutes||V.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",_?"text-white/25":"text-gray-400",S&&"blur-sm select-none"),children:[bc(V.effortMinutes,O,$)&&jsxs("span",{children:[B.labels.estimate,": ",bc(V.effortMinutes,O,$)]}),(()=>{let te=u0(V,O,$);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:[V.priority&&jsx(Flag,{className:u("w-3 h-3",V.priority==="urgent"||V.priority==="high"?"text-red-400":V.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(i0,{task:V,isDark:_})]}),V.assignees&&V.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:V.assignees.slice(0,2).map((te,Oe)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},Oe))})]})]},V.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",_?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:V=>{V.key==="Enter"&&V.target.value.trim()&&(a.onTaskCreate?.({name:V.target.value.trim()}),V.target.value="");}})}),H.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",_?"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]",_?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",_?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",_?"text-white/60":"text-gray-700",S&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",_?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"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",_?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":_?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",B.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"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",_?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!X$1&&jsx(bo,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:V=>{a.onTaskUpdate?.(V),re(V);},theme:F==="dark"?"dark":"light",locale:Y,availableUsers:t.availableUsers?.map(V=>({id:V.id,name:V.name,avatar:V.avatar,initials:V.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:z?m?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Fs(e).filter(V=>V.id!==z?.id),comments:d?.filter(V=>V.taskId===z?.id).map(V=>({...V,createdAt:V.createdAt instanceof Date?V.createdAt:new Date(V.createdAt),updatedAt:V.updatedAt instanceof Date?V.updatedAt:V.updatedAt?new Date(V.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:S}),jsx(AnimatePresence,{children:xe&&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",_?"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",_?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",_?"text-white/90":"text-gray-900"),children:xe.date.toLocaleDateString(Y==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ue(null),className:u("p-1 rounded",_?"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:xe.events.map(V=>jsxs("button",{onClick:()=>{Ue(null),de(V.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(i0,{task:V.task,isDark:_}),jsx("span",{className:u("text-sm truncate flex-1",_?"text-white/80":"text-gray-900"),children:V.title}),(V.task.priority==="high"||V.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},V.id))})]})]})})]})}var hc={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)"},yc={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)"},xc={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)"},tl={dark:hc,light:yc,neutral:xc};function m0(e){return tl[e]||tl.dark}function xw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=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",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className: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 f0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function As(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function Ls(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function b0(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 h0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=useMemo(()=>({...f0,...n}),[n]),[i,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",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",c.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange: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:[Ls(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=i.has(v.id),T=s===v.id,k=b0(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:Ls(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:As(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 x0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){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",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&Ls(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&As(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:As(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",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function vc(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 wc(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 v0(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 w0(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})),l=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(m=>{let d=a/2,p=r/2;m.vx+=(d-m.x)*o.centerForce*i,m.vy+=(p-m.y)*o.centerForce*i,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*i/(h*h);m.vx+=y/h*f,m.vy+=x/h*f;});}),t.forEach(m=>{let d=l.get(typeof m.source=="string"?m.source:m.source.id),p=l.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*i;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 k0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=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,$)=>{a.enableDragging&&($.stopPropagation(),g(O));},[a.enableDragging]),k=useCallback(O=>{if(!p||!i.current)return;let F=i.current.getBoundingClientRect(),Y=(O.clientX-F.left-C.x)/b,Z=(O.clientY-F.top-C.y)/b;d(Se=>Se.map(B=>B.id===p?{...B,x:Y,y:Z,fx:Y,fy:Z}:B));},[p,b,C]),w=useCallback(()=>{g(null);},[]),E=useCallback((O,$)=>{$.stopPropagation(),l?.({type:"node-click",node:O,position:{x:$.clientX,y:$.clientY}});},[l]),I=useCallback((O,$)=>{$.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:$.clientX,y:$.clientY}});},[l]),S=useCallback(O=>{let $=m.find(F=>F.id===O);return $?{x:$.x,y:$.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 $=O.card.priority;return $==="URGENT"?"#ef4444":$==="HIGH"?"#f59e0b":$==="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:vc(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[v0(O)," ",wc(O)]})]},O))}),jsxs("svg",{ref:i,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 $=S(typeof O.source=="string"?O.source:O.source.id),F=S(typeof O.target=="string"?O.target:O.target.id),Y=w0(O.type),Z=h===O.id,Se=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",Se&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:B=>I(O,B),children:[jsx("line",{x1:$.x,y1:$.y,x2:F.x,y2:F.y,stroke:vc(O.type),strokeWidth:Se?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:Y?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsx("text",{x:($.x+F.x)/2,y:($.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:wc(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let $=y===O.id,F=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",$&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Y=>T(O.id,Y),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:Y=>E(O,Y),children:[jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:X(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:$?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 N0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[l,c]=useState(false),[i,m]=useState(null),[d,p]=useState(null),g=useRef(null),y=l||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(Qt,{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."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((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 kc={"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=kc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Is(e){return `$${e.toFixed(4)}`}var Cc=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),l=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),i={},m={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:m,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(m=>m.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},ln=new Cc;function E0({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=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=ln.getRecentOperations(5);return jsxs(Qt,{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:Is(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,i])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Is(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"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Is(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 P0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[c,i]=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=S=>{S.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let T=()=>{N||(l(""),i(""),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(Qt,{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,S)=>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:["#",S+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=>l(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=>i(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,S)=>jsx("button",{onClick:()=>l(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},S))})]})]})}),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 ol({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&js(()=>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(S=>S!==h)};if(I.id===f){let S=k.filter(X=>X.columnId===f).sort((X,O)=>X.position-O.position);return {...I,cardIds:S.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]),l=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]),i=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 l(h),f},[l]),g=useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),y=useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function L0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=ol({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,i,m={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...m});},addColumn:(c,i)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:i??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 Bs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},B0={by:"none",order:"asc"};function R0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...Bs,...e}),[s,n]=useState({...B0,...t}),l=useCallback(x=>{o(h=>({...h,...x}));},[]),c=useCallback(x=>{n(h=>({...h,...x}));},[]),i=useCallback(()=>{o(Bs),n(B0);},[]),m=useCallback(()=>{a&&o({...Bs,assignees:[a]});},[a]),d=useCallback(()=>{o({...Bs,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...Bs,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"),S=String(k.getUTCDate()).padStart(2,"0");w=`${E}-${I}-${S}`;}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"),S=new Date(E);return S.setDate(S.getDate()+7),I>=E&&I<=S;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 S=typeof E=="string"?new Date(E).getTime():E.getTime(),X=typeof I=="string"?new Date(I).getTime():I.getTime();v=S-X;break;case "title":v=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,$=b.estimatedTime||0;v=O-$;break;default:v=0;}return s.order==="asc"?v:-v}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:y,hasActiveFilters:g}}var $0,H0;if(typeof window<"u")try{let e=Ws("ai");$0=e.generateObject,H0=e.generateText;}catch{}function z0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!($0&&H0&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),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]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),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:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function Nc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function U0(e){let{cards:t}=e,[a,r]=Nc(),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]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),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:l,selectAll:c,toggleCard:i,getSelectedCards:m}}var W0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function V0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...W0,...a}),[a]),[s,n]=useState([]),l=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));},[]),i=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,S)=>I+S.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=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);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:l,deleteStack:c,toggleStack:i,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:y,config:o}}var G0=createContext(null);function j0({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:i}=Ws("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Ws("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Ws("@libxai/core");l=new c(t.board);}r.current=new BoardStore({board:l,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(G0.Provider,{value:{store:o},children:e})}function nl(){let e=useContext(G0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Os(){let e=nl(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=useCallback(b=>{e.updateBoard(b);},[e]),c=useCallback(b=>{e.addColumn(b);},[e]),i=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:l,addColumn:c,updateColumn:i,deleteColumn:m,getColumn:d,addCard:p,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function K0(e){let{cards:t}=Os();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 q0(e="position",t="asc"){let{cards:a}=Os();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=c-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var sl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=su.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},_w=new sl;function X0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=useRef(null),m=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),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:i,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 J0(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 Z0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let m=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},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 ef(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 tf(e,t=10){return e>t}var Mc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Fc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Pc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ac={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Lc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ic={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Bc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Rc={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)"},Oc={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)"},$c={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Hc={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}},zc={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}},il={spacing:Mc,borderRadius:Fc,fontSize:Pc,fontWeight:Ac,lineHeight:Lc,zIndex:Ic,duration:Bc,easing:Rc,shadows:Oc,opacity:$c,kanban:Hc,gantt:zc};function af(e,t,a){return e[t]??a}function Uc(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)?Uc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Yw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Wc(e="asakaa"){let t=Uc(il),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Yw(o);a.push(` ${s}: ${n};`);}return `:root {
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function Im(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function wo(e,t){let a=Im(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function Od(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let 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 m=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+m):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+m),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let m=parseInt(l[1],10),g=parseInt(l[2],10)-1,y=parseInt(l[3],10);return new Date(y,g,m)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let m=parseInt(i[1],10),g=c[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,m)}let p={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 m=p[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(m!==void 0)return new Date(y,m,g)}return null}function $d(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 Hd(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 Bm(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 Rm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),p=r[2].trim(),d=wo(t,i),m=Od(p);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${p}". 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(m);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:m,endDate:y},message:`Moved "${d.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),p=o[2].trim(),d=wo(t,i),m=$d(p);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),p=s[2].trim(),d=wo(t,i),m=Hd(p);return d?m===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:m},message:`Set "${d.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),p=n[2].trim(),d=wo(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:p},message:`Renamed "${d.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),p=l[2].trim(),d=wo(t,i),m=wo(t,p);return d?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:d.id,dependencyTo:m.id,message:`Linked "${d.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),p=wo(t,i);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Om(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 s2(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 i2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function $i(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let d=a.find(m=>m.id===p);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>$i(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let n=p=>{if(p)return typeof p=="string"?new Date(p):p},l=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:s2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function $m(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:i2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Hm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>$i(r,e,t))}var zd={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"}},Ud={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"}},Hi={en:zd,es:Ud};function Wd(e){return Hi[e]||Hi.en}function zi(e,t){let a=Wd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Vd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function zm(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 Um({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=zm(e),i=Vd[0],p=Vd.find(g=>g.value===c)??i,d=p.icon,m=g=>{switch(zm(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",p.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxs("div",{ref:l,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",p.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Vd.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:m(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 Vm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=Gd.find(p=>p.value===e)??Gd[4],i=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[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:p=>{p.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[i]}),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(p=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.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===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[i]})]},p.value))})]})}function ws(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function jd(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,l]=useState(false),[c,i]=useState(""),p=useRef(null),d=useRef(null);useEffect(()=>{let x=h=>{p.current&&!p.current.contains(h.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let m=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:ws(x.name),color:x.color||jd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}l(false),i("");}};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&&jd(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||ws(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:p,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),l(!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&&jd(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||ws(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=>i(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||ws(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:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(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"}):ws(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:l=false,placeholder:c}){let[i,p]=useState(false),[d,m]=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)&&p(false);};return i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),useEffect(()=>{i&&m(r?o:"start");},[i,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(),F=new Date(k,w,1),S=new Date(k,w+1,0).getDate(),X=F.getDay(),O=[],A=new Date(k,w,0).getDate();for(let Z=X-1;Z>=0;Z--)O.push({date:new Date(k,w-1,A-Z),isCurrentMonth:false});for(let Z=1;Z<=S;Z++)O.push({date:new Date(k,w,Z),isCurrentMonth:true});let q=42-O.length;for(let Z=1;Z<=q;Z++)O.push({date:new Date(k,w+1,Z),isCurrentMonth:false});return O},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),p(false);else if(d==="start"){let w=f&&k>f?k:f;a(k,w||void 0),m("end");}else {let w=h&&k<h?k:h;a(w||void 0,k),p(false);}},N=()=>{let k=new Date,w=new Date(k);w.setDate(k.getDate()+1);let F=new Date(k);F.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 S=new Date(k);S.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:F,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:S,display:S.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(l){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(),p(!i);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)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>p(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),p(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 F=k.date.toDateString()===new Date().toDateString(),I=h?.toDateString()===k.date.toDateString(),S=f?.toDateString()===k.date.toDateString(),X=I||S,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"),F&&"ring-2 ring-[#007BFF]",I&&"bg-[#007BFF] text-white",S&&!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 Vi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Ym,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function zn(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 Gi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[l,c]=useState(false),i=useRef(e),p=useRef([]);return useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,m=e,g=m-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(m));},y*x);p.current.push(h);}return i.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function Xm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,l]=useState(0),c=useRef(null),i=useRef(null),p=useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),l(0);let y=Date.now();i.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:p,cancelChange:d}}function Qm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=useState(false),[c,i]=useState(""),p=useRef(null),{isFlashing:d,triggerFlash:m}=zn(),{displayValue:g,isAnimating:y}=Gi(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&&m());},h=useCallback(C=>{r||!t||(C.stopPropagation(),i(String(e)),l(true));},[r,t,e]);useEffect(()=>{n&&p.current&&(p.current.focus(),p.current.select());},[n]);let f=useCallback(()=>{l(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&m());}},[c,t,e,s,m]),b=useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&l(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:[v>0?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}%`}})}):jsx("div",{className:"flex-1"}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsx("input",{ref:p,value:c,onChange:C=>i(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",v===0?a?"text-[#6B7280]":"text-gray-400":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 tg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[l,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let p=()=>{l!==e&&t?.(l),n(false);},d=m=>{m.key==="Enter"?p():m.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:i,type:"text",value:l,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:d,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function og({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,p]=useState(false),[d,m]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:x}=zn(),{displayValue:h,isAnimating:f}=Gi(e,{enabled:l&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{m(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());}p(false);},v=C=>{C.key==="Enter"?b():C.key==="Escape"&&(m(e?.toString()||""),p(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}):i?jsx("input",{ref:g,type:"number",value:d,onChange:C=>m(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(),p(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 ng({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),c=useRef(null);return useEffect(()=>{let i=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[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:i=>{i.stopPropagation(),l(!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(i=>jsxs("button",{onClick:p=>{p.stopPropagation(),a(i),l(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===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function ig({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:p}=Xm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?p():i(!e):t(!e));},m=l?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]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&m&&"ring-green-500/50",l&&!m&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:g=>{g.stopPropagation(),p();},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 cg({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 j2(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 _2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+c}let 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 Tr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0}){let[p,d]=useState(false),[m,g]=useState(""),y=useRef(null),{isFlashing:x,triggerFlash:h}=zn(),f=c==="financial"&&i>0,b=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:j2(e,r);useEffect(()=>{p&&y.current&&(y.current.focus(),y.current.select());},[p]),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,p]);let v=()=>{let T=_2(m);T!==e&&(t?.(T),n&&h()),d(false);},C=T=>{T.key==="Enter"?v():T.key==="Escape"&&d(false);};if(l)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className: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 justify-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})]}):p?jsx("input",{ref:y,type:"text",value:m,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 justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",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 gg({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"}),l=()=>{if(a==null)return null;let c=o==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className: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"]}),l()]})}function bg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:c=0}){let i=a==="es",p=l==="financial"&&c>0,d=Z=>p?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}h`,[m,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,F=w>100?Math.round((v-C)/60*10)/10:0,I=w>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!y&&!h)return;let Z=Ee=>{b.current&&!b.current.contains(Ee.target)&&(x(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[y,h]);let S=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Ee=>!Ee),f(null);return}n&&n(e);},X=Z=>{x(false),f(Z);},O=async(Z,Ee)=>{h==="log"&&r&&Z?r(e,Z,Ee):h==="estimate"&&o?o(e,Z):h==="quoted"&&s&&s(e,Z),f(null);},$=r||o||s||n,A=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.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:Z=>Z.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"}),m&&$&&jsx("button",{onClick:S,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ 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:A.map(Z=>jsxs("button",{onClick:Ee=>{Ee.stopPropagation(),X(Z.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:Ee=>{Ee.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ee=>{Ee.target.style.background="transparent";},children:[jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(ro,{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:Z=>Z.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:[(()=>{let Z=v===0,B=(C>0?v/C:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:Z?t?"#4B5563":"#9CA3AF":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)]}),F>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",d(F)," ",i?"Excedido":"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"}})})]}),$&&jsx("button",{onClick:S,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ 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:A.map(Z=>jsxs("button",{onClick:Ee=>{Ee.stopPropagation(),X(Z.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:Ee=>{Ee.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ee=>{Ee.target.style.background="transparent";},children:[jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(ro,{mode:h,locale:a,isDark:t,currentValue:q||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function Z2(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 e1(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 hg({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 yg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let p=Z2(e);if(p.length===0)return null;let d=p.slice(0,3),m=p.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsx(hg,{assignee:g,size:24,isDark:t},g.name+y))}),m>0&&jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(g=>g.name).join(", "),children:["+",m]})]})}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 l=n?.percentage??0,c=!!n&&l>0,i=c?e1(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(hg,{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&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var t1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function vg({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",t1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function b1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function h1(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 Dg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:p=[],onOpenTimeLog:d,onReportBlocker:m,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=useRef(null),b=r==="es"?Cg.es:Cg.en;if(useEffect(()=>{let k=F=>{f.current&&!f.current.contains(F.target)&&t();},w=F=>{F.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}),l&&(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:()=>{l({...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:()=>{l({...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:()=>{l({...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:()=>{l({...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:()=>{l({...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:()=>{l({...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:()=>{l({...e.task,priority:"low"}),t();}}]}),p.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:p.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 F=e.task.assignees||[],S=F.some(X=>X.name===w.name)?F.filter(X=>X.name!==w.name):[...F,{name:w.name,initials:b1(w.name),color:w.color||h1(w.name),avatar:w.avatarUrl}];l({...e.task,assignees:S}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(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 i&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(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(y1,{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 y1({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(l=>jsxs("button",{onClick:l.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:l.icon}),l.label]},l.id))})]})}var Cg={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 Ig={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"})},B1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Rg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=useState(""),[p,d]=useState(null),[m,g]=useState(null),y=useRef(null),x=l==="es"?Bg.es:Bg.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 F=y.current.getBoundingClientRect(),S=window.innerHeight-F.top-20;d(Math.max(300,S));};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();},F=I=>{I.key==="Escape"&&t();};document.addEventListener("mousedown",w),document.addEventListener("keydown",F),y._cleanup=()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",F);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=useMemo(()=>{let k=new Set([...B1]);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 F=a.find(I=>I.type===k);return F?.label?F.label:k},b=k=>{if(k==="name")return;let w=a.map(F=>F.id===k?{...F,visible:!F.visible}:F);o(w);},v=(k,w)=>{let F=a.find(S=>S.type===k&&(!w||S.customFieldId===w));if(F){b(F.id);return}let I={id:w||k,type:k,label:w?r.find(S=>S.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:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.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=>i(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(S=>S.type===k&&!S.customFieldId),F=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:S=>{I||(S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:F?T:"transparent",border:F?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:F?`0 0 6px ${T}40`:"none"},children:F&&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:F?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ig[k]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:F?500:400,color:F?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 F=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:F?T:"transparent",border:F?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:F?`0 0 6px ${T}40`:"none"},children:F&&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:F?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ig[k.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:F?500:400,color:F?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 Bg={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 G1=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function Hg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[l,c]=useState("text"),[i,p]=useState([""]),d=o==="es"?$g.es:$g.en;useEffect(()=>{e&&(n(""),c("text"),p([""]));},[e]),useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let m=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(f=>f.trim())),a(h),t();},g=()=>{p([...i,""]);},y=(h,f)=>{let b=[...i];b[h]=f,p(b);},x=h=>{i.length>1&&p(i.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:G1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===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:l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:u("text-xs",l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),l==="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:[i.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")}),i.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:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var $g={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Wg={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Vg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=useState(false),c=useRef(null),i=useRef(0),p=s==="es"?Wg.es:Wg.en;useEffect(()=>{if(!n)return;let g=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},y=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:p.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:p.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(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",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),p.filters,m&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:p.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),l(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"),l(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:p.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 Ds(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function jg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours",onUnassignedTaskClick:s}){let n=a==="es",l=o==="financial";return jsxs("div",{className:u("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?n?"SALUD FINANCIERA":"FINANCIAL HEALTH":n?"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:n?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,p=e.totalExecuted??0,d=c-i,m=c>0?Math.round(d/c*100):0,g=c>0?Math.min(Math.round(i/c*100),120):0,y=i>c&&c>0,x=y?"#F87171":"#00E5CC";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:n?"V. Oferta":"Offered Value"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Ds(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Estimado":"Estimated"}),jsx("span",{className:u("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Ds(i)})]}),p>0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Ejecutado":"Executed"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Ds(p)})]}),c>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(g,100)}%`,backgroundColor:x}})}),jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",d>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[d>=0?`+${Ds(d)} ${n?"Disp.":"Avail."}`:`${Ds(Math.abs(d))} ${n?"P\xE9rdida":"Loss"}`,c>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",m,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,p=i>0?Math.min(Math.round(c/i*100),100):0,g=(i>0?c/i:0)>1.1?"#F87171":p>=90?"#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-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:n?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Gg(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Gg(i)})]}),i>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:`${p}%`,backgroundColor:g}})})]})]})})(),(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-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:n?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"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.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:u("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:u("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?n?"tarea pendiente":"pending task":n?"tareas pendientes":"pending tasks"}),jsx("p",{className:u("text-[10px]",t?"text-white/40":"text-gray-400"),children:n?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:u("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxs("button",{onClick:()=>s?.(c.id),className:u("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:u("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className: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:n?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,p=c<0,d=e.scheduleVarianceLabel||(i?`+${c} ${n?"D\xEDas ADELANTE":"Days AHEAD"}`:p?`${c} ${n?"D\xEDas ATR\xC1S":"Days BEHIND"}`:n?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",p&&"bg-[#F87171]/15 text-[#F87171]",!i&&!p&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:d})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let p=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.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(c.utilizationPercent,100)}%`,backgroundColor:p}})})]},`${c.name}-${i}`)})})]})]})}var sw=[{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 Qg(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(...Qg(r.subtasks,t+1));return a}function iw(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 p=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(p<=0)continue;let d=(s.progress||0)/p;r+=d,o++;}return o>0?r/o:null}function jn(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=jn(o);t+=s.spent>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Gn(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 lw({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:l=>l.stopPropagation(),onChange:l=>n(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),o(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.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:l=>{l.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 Xg(e){if(e.length===0)return 0;let t=0,a=0,r=0,o=0;for(let c of e){let i=c.weight||0;i>0&&(t+=(c.progress||0)*i,a+=i,r+=1),o+=c.progress||0;}let s=r/e.length,l=a>=99&&s>=.95?t/a:o/e.length;return Math.round(l*10)/10}function dc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?dc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0});return t}function Zg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[],toolbarRightContent:i}){let{theme:p="dark",locale:d="en",customTranslations:m,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:F=0,rateMap:I,aggregateParentHours:S=false,showProjectTotals:X=false}=t,O=zi(d,m),$=p==="dark",A=M=>{if(!I||!M.assignees||M.assignees.length===0)return F;let se=0,xe=0;for(let ke of M.assignees){let st=ke.id?I[ke.id]:void 0;if(st==null||st<=0)continue;let ue=typeof ke.estimatedMinutes=="number"?ke.estimatedMinutes:0;ue>0&&(se+=st*ue,xe+=ue);}if(xe>0)return se/xe;let Pe=M.assignees.map(ke=>ke.id?I[ke.id]:void 0).filter(ke=>ke!=null&&ke>0);return Pe.length===0?F:Pe.reduce((ke,st)=>ke+st,0)/Pe.length},q=M=>{let se=0,xe=0,Pe=0,ke=st=>{for(let ue of st)if(ue.subtasks&&ue.subtasks.length>0){let Ve={s:se,a:xe,q:Pe};if(ke(ue.subtasks),se-Ve.s+(xe-Ve.a)+(Pe-Ve.q)===0){let wt=A(ue);se+=(ue.timeLoggedMinutes??0)/60*wt,xe+=(ue.effortMinutes??0)/60*wt,Pe+=(ue.soldEffortMinutes??0)/60*wt;}}else {let Ve=A(ue);se+=(ue.timeLoggedMinutes??0)/60*Ve,xe+=(ue.effortMinutes??0)/60*Ve,Pe+=(ue.soldEffortMinutes??0)/60*Ve;}};return M.subtasks&&ke(M.subtasks),{dollarSpent:se,dollarAllocated:xe,dollarQuoted:Pe}},Z=useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(N);if(M){let se=JSON.parse(M);return {statusFilter:se.statusFilter||"all",hideCompleted:se.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[N]),Ee=useMemo(()=>{function M(se){let xe=0,Pe=0,ke=0,st=0,ue=0,Ve=0;for(let it of se)if(it.subtasks&&it.subtasks.length>0){let wt=M(it.subtasks);if(wt.spent+wt.allocated+wt.quoted>0)xe+=wt.spent,Pe+=wt.allocated,ke+=wt.quoted,st+=wt.dollarSpent,ue+=wt.dollarAllocated,Ve+=wt.dollarQuoted;else {let St=it.timeLoggedMinutes??0,zt=it.effortMinutes??0,oa=it.soldEffortMinutes??0;xe+=St,Pe+=zt,ke+=oa;let Sa=A(it);st+=St/60*Sa,ue+=zt/60*Sa,Ve+=oa/60*Sa;}}else {let wt=it.timeLoggedMinutes??0,At=it.effortMinutes??0,St=it.soldEffortMinutes??0;xe+=wt,Pe+=At,ke+=St;let zt=A(it);st+=wt/60*zt,ue+=At/60*zt,Ve+=St/60*zt;}return {spent:xe,allocated:Pe,quoted:ke,dollarSpent:st,dollarAllocated:ue,dollarQuoted:Ve}}return M(e)},[e]),B=useMemo(()=>{let M=new Map;function se(xe){let Pe=0;for(let ke of xe)if(ke.subtasks&&ke.subtasks.length>0){let st=se(ke.subtasks);M.set(ke.id,st),Pe+=st;}else Pe+=ke.weight||0;return Pe}return se(e),M},[e]),_=useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:Ee.spent,totalHoursAllocatedMinutes:Ee.allocated}},[k,Ee]),[he,Ye]=useState(true),[z,re]=useState(null),[J,Le]=useState("position"),[we,Oe]=useState("asc"),[Be,lt]=useState(""),[ee,ct]=useState(()=>Z().statusFilter),[pe,et]=useState(()=>Z().hideCompleted),[nt,Ut]=useState(x||sw),[Ce,mt]=useState(false),[Dt,Xe]=useState(false),[H,ne]=useState({isOpen:false,x:0,y:0,type:"task"}),[D,K]=useState(null),[ce,Te]=useState(false),[V,te]=useState(null),[$e,Ne]=useState(null),[He,Fe]=useState(null),Ge=useRef(0),ht=useRef(false),dt=!!(a.onTaskMove||a.onTaskReparent),gt=useCallback((M,se)=>{dt&&(se.preventDefault(),Ge.current=se.clientY,K(M),ht.current=false,Te(false),Fe({x:se.clientX,y:se.clientY}));},[dt]),ot=useCallback(M=>{if(!D||(Math.abs(M.clientY-Ge.current)>5&&!ht.current&&(ht.current=true,Te(true)),Fe({x:M.clientX,y:M.clientY}),!ht.current))return;let xe=document.querySelectorAll("[data-listview-row]"),Pe=null,ke=null;xe.forEach(st=>{let ue=st.getBoundingClientRect(),Ve=st.getAttribute("data-listview-row");if(Ve&&Ve!==D&&M.clientY>=ue.top&&M.clientY<=ue.bottom){Pe=Ve;let it=M.clientY-ue.top,wt=ue.height;ke=it<wt*.25?"above":it>wt*.75?"below":"child";}}),te(Pe),Ne(ke);},[D]),jt=useCallback(()=>{if(ht.current&&D&&V&&$e){if($e==="child"&&a.onTaskReparent)a.onTaskReparent(D,V);else if($e==="above"||$e==="below"){let M=(Pe,ke,st=null)=>{for(let ue of Pe){if(ue.id===ke)return st;if(ue.subtasks){let Ve=M(ue.subtasks,ke,ue.id);if(Ve!==void 0)return Ve}}},se=M(e,D,null),xe=M(e,V,null);if(a.onTaskReparent){let Pe=(wt,At)=>{if(At===null)return wt;for(let St of wt){if(St.id===At)return St.subtasks||[];if(St.subtasks){let zt=Pe(St.subtasks,At);if(zt.length>0||St.subtasks.some(oa=>oa.id===At))return zt}}return []},ke=Pe(e,xe??null),st=ke.findIndex(wt=>wt.id===V),ue=se===xe,Ve=ue?ke.findIndex(wt=>wt.id===D):-1,it=$e==="below"?st+1:st;ue&&Ve!==-1&&Ve<st&&(it-=1),a.onTaskReparent(D,xe??null,Math.max(0,it));}}}K(null),te(null),Ne(null),Fe(null),ht.current=false,Te(false);},[D,V,$e,e,a]);useEffect(()=>{if(D)return document.addEventListener("mousemove",ot),document.addEventListener("mouseup",jt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ot),document.removeEventListener("mouseup",jt),document.body.style.cursor="",document.body.style.userSelect="";}},[D,ot,jt]);let[Et,Nt]=useState("all"),[Tt,yt]=useState(false),$t=useRef(null),We=useRef(null),Re=useMemo(()=>{let M=0;function se(xe,Pe){for(let ke of xe)Pe>M&&(M=Pe),ke.subtasks?.length&&se(ke.subtasks,Pe+1);}return se(e,1),M},[e]);useEffect(()=>{if(!Tt)return;let M=se=>{$t.current?.contains(se.target)||We.current?.contains(se.target)||yt(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[Tt]),useEffect(()=>{if(Et==="all"){let xe=function(Pe){for(let ke of Pe)ke.subtasks?.length&&(ke.isExpanded===false&&a.onTaskToggleExpand?.(ke.id),xe(ke.subtasks));};xe(e);}else {let xe=function(Pe,ke){for(let st of Pe)if(st.subtasks?.length){let ue=ke<Et,Ve=st.isExpanded!==false;ue!==Ve&&a.onTaskToggleExpand?.(st.id),xe(st.subtasks,ke+1);}};xe(e,1);}},[Et]);let[at,ie]=useState(null),[me,L]=useState(0),[j,Y]=useState(0),ge=useRef(null),[De,Je]=useState(null),[_e,ze]=useState(null);useEffect(()=>{x&&Ut(M=>{if(M.length===x.length){let se=true;for(let xe=0;xe<M.length;xe++){let Pe=M[xe],ke=x[xe];if(!Pe||!ke||Pe.id!==ke.id||Pe.visible!==ke.visible||Pe.width!==ke.width||Pe.label!==ke.label){se=false;break}}if(se)return M}return x});},[x]),useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:ee,hideCompleted:pe}));}catch(M){console.error("Error persisting filter state:",M);}},[N,ee,pe]);let vt=useMemo(()=>{let M=new Set;function se(xe){for(let Pe of xe)Pe.subtasks?.length&&(Pe.isExpanded!==false&&M.add(Pe.id),se(Pe.subtasks));}return se(e),M},[e]),ut=useMemo(()=>nt.filter(M=>M.visible),[nt]),Wt=useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),ha=useCallback(M=>{J===M?Oe(se=>se==="asc"?"desc":"asc"):(Le(M),Oe("asc")),a.onSortChange?.({column:M,direction:we==="asc"?"desc":"asc"});},[J,we,a]),ta=useCallback(M=>{Ut(M),a.onColumnsChange?.(M);},[a]),U=useCallback(M=>{let se=nt.map(xe=>xe.id===M?{...xe,visible:false}:xe);ta(se);},[nt,ta]),Ze=useCallback((M,se)=>{Le(M),Oe(se);},[]),ye=useCallback((M,se,xe)=>{b&&(M.preventDefault(),ne({isOpen:true,x:M.clientX,y:M.clientY,type:se?"task":"header",task:se,columnId:xe}));},[b]),E=useCallback(()=>{ne(M=>({...M,isOpen:false}));},[]),fe=useCallback((M,se)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let xe=nt.find(Pe=>Pe.id===se);xe&&(ie(se),L(M.clientX),Y(xe.width));},[nt,f]);useEffect(()=>{if(!at)return;let M=nt,se=Pe=>{let ke=Pe.clientX-me,st=Math.max(50,j+ke);M=M.map(ue=>ue.id===at?{...ue,width:st}:ue),Ut(M);},xe=()=>{a.onColumnsChange?.(M),ie(null);};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",xe),()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",xe);}},[at,me,j,a]);let je=useCallback((M,se)=>{if(se==="name"){M.preventDefault();return}Je(se),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",se),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),tt=useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),Je(null),ze(null);},[]),ra=useCallback((M,se)=>{M.preventDefault(),se!=="name"&&(M.dataTransfer.dropEffect="move",ze(se));},[]),Vt=useCallback(()=>{ze(null);},[]),Ua=useCallback((M,se)=>{if(M.preventDefault(),!De||De===se||se==="name")return;let xe=[...nt],Pe=xe.findIndex(ue=>ue.id===De),ke=xe.findIndex(ue=>ue.id===se);if(Pe===-1||ke===-1)return;let st=xe.splice(Pe,1);st[0]&&(xe.splice(ke,0,st[0]),ta(xe),Je(null),ze(null));},[De,nt,ta]),lr=useCallback(async M=>{if(a.onCreateCustomField){let se={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(se);}Xe(false);},[a]),fa=useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),ya=useMemo(()=>{let M=Qg(e);if(Be.trim()){let se=Be.toLowerCase();M=M.filter(xe=>xe.name.toLowerCase().includes(se));}return ee!=="all"&&(M=M.filter(se=>fa(se)===ee)),pe&&(M=M.filter(se=>fa(se)!=="completed")),M.sort((se,xe)=>{let Pe,ke;switch(J){case "name":Pe=se.name.toLowerCase(),ke=xe.name.toLowerCase();break;case "startDate":Pe=se.startDate?.getTime()||0,ke=xe.startDate?.getTime()||0;break;case "endDate":Pe=se.endDate?.getTime()||0,ke=xe.endDate?.getTime()||0;break;case "progress":Pe=se.progress||0,ke=xe.progress||0;break;case "status":Pe=se.status||"todo",ke=xe.status||"todo";break;case "priority":let st={urgent:0,high:1,medium:2,low:3,none:4};Pe=st[se.priority]??4,ke=st[xe.priority]??4;break;case "position":return 0;default:return 0}return Pe<ke?we==="asc"?-1:1:Pe>ke?we==="asc"?1:-1:0}),M},[e,Be,ee,pe,J,we,fa]),Hr=useCallback((M,se)=>{let xe=st=>{a.onTaskUpdate?.({...M,...st});},Pe=st=>st?M.customFields?.find(Ve=>Ve.fieldId===st)?.value:void 0,ke=(st,ue)=>{if(!st)return;let it=[...M.customFields||[]],wt=it.findIndex(At=>At.fieldId===st);wt>=0?it[wt]={fieldId:st,value:ue}:it.push({fieldId:st,value:ue}),xe({customFields:it});};switch(se.type){case "name":return null;case "status":return jsx(Um,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:ue=>{xe({status:ue,progress:ue==="completed"?100:ue==="in-progress"?50:0});},isDark:$,locale:d,translations:O.status});case "priority":return jsx(Vm,{value:M.priority,onChange:ue=>xe({priority:ue}),isDark:$,locale:d});case "assignees":{let ue=M.hasChildren,Ve=M.assignees||[];if(ue&&M.subtasks?.length){let it=new Map;(M.assignees||[]).forEach(At=>it.set(At.name,At));let wt=At=>{(At||[]).forEach(St=>{(St.assignees||[]).forEach(zt=>{it.has(zt.name)||it.set(zt.name,zt);}),St.subtasks?.length&&wt(St.subtasks);});};wt(M.subtasks),Ve=Array.from(it.values());}return jsx(_d,{value:Ve,availableUsers:l,onChange:it=>xe({assignees:it}),isDark:$,locale:d,disabled:ue})}case "startDate":return jsx(Vi,{value:M.startDate,onChange:ue=>xe({startDate:ue}),isDark:$,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsx(Vi,{value:M.endDate,onChange:ue=>xe({endDate:ue}),isDark:$,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":{let ue=!!(M.subtasks&&M.subtasks.length>0),Ve=ue?Xg(dc(M.subtasks||[])):M.progress||0;return jsx(Qm,{value:Ve,onChange:ue?void 0:it=>{let wt=it===100?"completed":it>0?"in-progress":"todo";xe({progress:it,status:wt});},isDark:$,disabled:ue})}case "tags":return jsx(cg,{value:M.tags||[],isDark:$});case "text":return jsx(tg,{value:Pe(se.customFieldId)||"",onChange:ue=>ke(se.customFieldId,ue),isDark:$});case "number":return jsx(og,{value:Pe(se.customFieldId)||0,onChange:ue=>ke(se.customFieldId,ue),isDark:$});case "date":let st=Pe(se.customFieldId);return jsx(Vi,{value:st?new Date(st):void 0,onChange:ue=>ke(se.customFieldId,ue),isDark:$,locale:d});case "dropdown":return jsx(ng,{value:Pe(se.customFieldId)||"",options:se.options||[],onChange:ue=>ke(se.customFieldId,ue),isDark:$});case "checkbox":return jsx(ig,{value:Pe(se.customFieldId)||false,onChange:ue=>ke(se.customFieldId,ue),isDark:$});case "estimatedTime":{let ue=M.status==="completed"||M.progress===100;return jsx(Tr,{value:M.estimatedTime,onChange:Ve=>xe({estimatedTime:Ve}),isDark:$,locale:d,disabled:ue,lens:w,hourlyRate:A(M)})}case "quotedTime":{let ue=M.status==="completed"||M.progress===100,Ve=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(Tr,{value:M.quotedTime,onChange:it=>xe({quotedTime:it}),isDark:$,locale:d,disabled:ue,isBlurred:Ve,lens:w,hourlyRate:A(M)})}case "elapsedTime":{let ue=M.status==="completed"||M.progress===100;return jsx(Tr,{value:M.elapsedTime,onChange:Ve=>xe({elapsedTime:Ve}),isDark:$,locale:d,disabled:ue,lens:w,hourlyRate:A(M)})}case "effortMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{allocated:At}=jn(M);if(w==="financial"){let St=q(M),zt=Math.round(St.dollarAllocated),oa=Math.round(St.dollarQuoted),Sa=oa-zt;return jsxs("div",{className:"flex flex-col",children:[zt>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",zt.toLocaleString("es-CO")]}):null,Sa!==0&&zt>0&&oa>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Sa>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Sa>0?"+":"",Math.abs(Sa)>=1e3?`$${(Sa/1e3).toFixed(1)}K`:`$${Sa}`]})]})}return jsx(Tr,{value:At>0?At:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:F})}let ue=M.status==="completed"||M.progress===100,Ve=M.effortMinutes||0,it=M.soldEffortMinutes||0,wt=A(M);if(w==="financial"&&wt&&Ve>0&&it>0){let At=Math.round(Ve/60*wt),zt=Math.round(it/60*wt)-At;return jsxs("div",{className:"flex flex-col",children:[jsx(Tr,{value:Ve,onChange:oa=>xe({effortMinutes:oa}),isDark:$,locale:d,disabled:ue,lens:w,hourlyRate:A(M)}),zt!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",zt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[zt>0?"+":"",Math.abs(zt)>=1e3?`$${(zt/1e3).toFixed(1)}K`:`$${zt}`]})]})}return jsx(Tr,{value:Ve,onChange:At=>xe({effortMinutes:At}),isDark:$,locale:d,disabled:ue,lens:w,hourlyRate:A(M)})}case "timeLoggedMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{spent:Ve}=jn(M);return jsx(Tr,{value:Ve>0?Ve:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:A(M)})}let ue=M.status==="completed"||M.progress===100;return jsx(Tr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?Ve=>{a.onLogTime?.(M,Ve);}:void 0,isDark:$,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:ue,lens:w,hourlyRate:A(M)})}case "soldEffortMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{quoted:it}=jn(M),wt=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Tr,{value:it>0?it:void 0,isDark:$,locale:d,disabled:true,isBlurred:wt,lens:w,hourlyRate:A(M)})}let ue=M.status==="completed"||M.progress===100,Ve=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Tr,{value:M.soldEffortMinutes,onChange:it=>xe({soldEffortMinutes:it}),isDark:$,locale:d,disabled:ue,isBlurred:Ve,lens:w,hourlyRate:A(M)})}case "scheduleVariance":{let ue=M.effortMinutes||0,Ve=M.soldEffortMinutes||0,it=M.timeLoggedMinutes||0,wt=ue>0||Ve>0||it>0;return jsx(gg,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:$,locale:d,hasTimeAllocated:wt})}case "hoursBar":{if(S&&M.hasChildren){let{spent:ue,allocated:Ve,quoted:it}=jn(M),wt=ue>Ve&&Ve>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",$?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",wt?"text-[#FF453A]":$?"text-white/80":"text-gray-800"),children:Gn(ue)}),Ve>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:$?"text-white/60":"text-gray-600",children:Gn(Ve)})]}),it>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:$?"text-amber-400/70":"text-amber-600",children:Gn(it)})]})]})}return jsx(bg,{task:M,isDark:$,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:w,hourlyRate:A(M)})}case "teamLoad":return M.hasChildren||M.subtasks&&M.subtasks.length>0?jsx(yg,{task:M,isDark:$,locale:d}):jsx(_d,{value:M.assignees||[],availableUsers:l,onChange:Ve=>{a.onTaskUpdate?.({...M,assignees:Ve});},isDark:$,locale:d});case "blockers":return jsx(vg,{blockers:M.blockers,isDark:$,locale:d});case "weight":{let ue=B.get(M.id);if(ue!==void 0)return jsx("span",{className:u("text-xs font-mono",ue>0?$?"text-white/50":"text-gray-400":$?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ue>0?`${Number(ue.toFixed(2))}%`:"\u2014"});let Ve=M.weight||0;return jsx(lw,{value:Ve,onChange:it=>xe({weight:it}),isDark:$})}default:return jsx("span",{className:u("text-sm",$?"text-white/60":"text-gray-500"),children:"-"})}},[a,$,d,l,O,S,B]),Fr=useCallback(M=>{let xe={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")}[M.type]||M.label;return typeof xe=="string"?xe:String(xe||M.type)},[O,d]),Go=useMemo(()=>{let xe=ut.reduce((ke,st)=>ke+st.width,0)+(h?48:0),Pe={};for(let ke of ut)Pe[ke.id]=`${ke.width/xe*100}%`;return Pe},[ut,h]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",$?"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",$?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",$?"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",$?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",$?"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",$?"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",$?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsx("p",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxs("div",{ref:ge,className:u($?"bg-[#0D0D0D]":"bg-white",at&&"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",$?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:[ya.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",$?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Be,onChange:M=>lt(M.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",$?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),y&&Re>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:$t,onClick:()=>yt(!Tt),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",$?Tt?"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]":Tt?"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}`]}),Tt&&jsx("div",{ref:We,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",$?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Re,5)},(M,se)=>({value:se+1,label:`L${se+1}`}))].map(M=>jsxs("button",{onClick:()=>{Nt(M.value),yt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",$?Et===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Et===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:M.label}),Et===M.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsx(Vg,{value:ee,hideCompleted:pe,onChange:ct,onHideCompletedChange:et,isDark:$,locale:d}),_?.enabled&&_.data&&!he&&jsx("button",{onClick:()=>Ye(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",$?"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-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",$?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[dt&&jsx("div",{className:"w-5 flex-shrink-0"}),ut.map(M=>{let se=M.id!=="name",xe=_e===M.id&&De!==M.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",$?"text-white/60":"text-gray-500",se&&"cursor-grab",M.type!=="name"&&"justify-center",De===M.id&&"opacity-50",xe&&($?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:Go[M.id],minWidth:M.minWidth},draggable:se,onDragStart:se?Pe=>je(Pe,M.id):void 0,onDragEnd:se?tt:void 0,onDragOver:se?Pe=>ra(Pe,M.id):void 0,onDragLeave:se?Vt:void 0,onDrop:se?Pe=>Ua(Pe,M.id):void 0,onContextMenu:Pe=>ye(Pe,void 0,M.id),children:[se&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",$?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxs("button",{draggable:false,onClick:()=>ha(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Fr(M),jsx(ArrowUpDown,{className:u("w-3 h-3",J===M.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:Fr(M)}),f&&M.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",at===M.id&&"bg-[#007BFF]"),onMouseDown:Pe=>fe(Pe,M.id)})]},M.id)}),h&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:M=>{M.stopPropagation(),mt(se=>!se);},className:u("p-0.5 rounded transition-colors",$?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Ce&&($?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(Rg,{isOpen:Ce,onClose:()=>mt(false),columns:nt,customFields:c,onColumnsChange:ta,onCreateCustomField:()=>{mt(false),Xe(true);},isDark:$,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:ya.map((M,se)=>{let xe=vt.has(M.id),Pe=Math.min(se*.01,.2),ke=M.hasChildren&&M.level===0,st=M.subtasks?.length||0;if(ke){let{spent:St,allocated:zt,quoted:oa}=jn(M),Sa=iw(M);return jsxs(motion.div,{"data-task-id":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Pe},className:u("flex items-center border-y cursor-pointer transition-colors duration-500",$?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",z===M.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(M),children:[dt&&jsx("div",{className:"w-5 flex-shrink-0"}),ut.map(Ea=>jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",Ea.type!=="name"&&"justify-center"),style:{width:Go[Ea.id],minWidth:Ea.minWidth},children:Ea.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:ar=>{ar.stopPropagation(),Wt(M.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsx(ChevronDown,{className:u("w-4 h-4",$?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",$?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:ar=>{ar.stopPropagation(),Wt(M.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:xe?jsx(FolderOpen,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:$?"#FFD60A":"#B45309"},children:M.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",$?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:M.name}),jsxs("span",{className:u("text-[10px] font-mono",$?"text-white/30":"text-gray-500"),children:["(",st," ",d==="es"?st===1?"Tarea":"Tareas":st===1?"Item":"Items",")"]}),Sa!==null&&jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",Sa>=1?"text-[#32D74B] bg-[#32D74B]/10":Sa>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",Sa.toFixed(2)]})]})]}):Ea.type==="timeLoggedMinutes"?w==="financial"?(()=>{let ar=q(M),Ft=Math.round(ar.dollarSpent);return Ft>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Ft.toLocaleString("en-US")]}):null})():jsx(Tr,{value:St>0?St:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:A(M)}):Ea.type==="soldEffortMinutes"?w==="financial"?(()=>{let ar=q(M),Ft=Math.round(ar.dollarQuoted);return Ft>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Ft.toLocaleString("en-US")]}):null})():jsx(Tr,{value:oa>0?oa:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:A(M)}):Ea.type==="effortMinutes"?w==="financial"?(()=>{let ar=q(M),Ft=Math.round(ar.dollarAllocated),eo=Math.round(ar.dollarQuoted),mo=eo-Ft;return jsxs("div",{className:"flex flex-col",children:[Ft>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Ft.toLocaleString("es-CO")]}):null,mo!==0&&Ft>0&&eo>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",mo>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[mo>0?"+":"",Math.abs(mo)>=1e3?`$${(mo/1e3).toFixed(1)}K`:`$${mo}`]})]})})():jsx(Tr,{value:zt>0?zt:void 0,isDark:$,locale:d,disabled:true,lens:w,hourlyRate:A(M)}):Hr(M,Ea)},Ea.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)}let ue=D===M.id,Ve=V===M.id,it=Ve&&$e==="above",wt=Ve&&$e==="below",At=Ve&&$e==="child";return jsxs(motion.div,{"data-task-id":M.id,"data-listview-row":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Pe},className:u("flex items-center border-b transition-colors relative group",$?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",z===M.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:ue?.4:1,backgroundColor:At?$?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:At?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:St=>ye(St,M),children:[it&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),wt&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),dt&&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:St=>gt(M.id,St),style:{color:$?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),ut.map(St=>jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",St.type!=="name"&&"justify-center"),style:{width:Go[St.id],minWidth:St.minWidth},children:St.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&M.level>0&&jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),y&&M.hasChildren&&jsx("button",{onClick:zt=>{zt.stopPropagation(),Wt(M.id);},className:u("p-0.5 rounded flex-shrink-0",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsx(ChevronDown,{className:u("w-4 h-4",$?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",$?"text-white/60":"text-gray-400")})}),y&&!M.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",$?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsx("span",{className:u("text-[10px] font-mono",$?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsx("span",{className:u("truncate",M.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",M.progress===100?$?"line-through text-white/50":"line-through text-gray-400":M.hasChildren?$?"text-white":"text-gray-900":$?"text-[#D1D5DB]":"text-gray-600"),children:M.name}),M.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):Hr(M,St)},St.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),X&&ya.length>0&&(()=>{let{spent:M,allocated:se,quoted:xe}=Ee,Pe=se-M,ke=Pe<0,st=ke?`+${Gn(Math.abs(Pe))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Gn(Pe)} ${d==="es"?"AHORRADO":"SAVED"}`,ue=w==="financial"&&F>0,Ve=(At,St)=>{if(ue){let zt=St??At/60*F;return `$${Math.round(zt).toLocaleString("es-CO")}`}return Gn(At)},it=ue?Math.abs(Ee.dollarAllocated-Ee.dollarSpent):0,wt=ue?`${ke?"+":"-"}$${it.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ke?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:st;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",$?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:$?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[dt&&jsx("div",{className:"w-5 flex-shrink-0"}),ut.map(At=>jsx("div",{className:u("flex items-center px-4 py-3",At.type!=="name"&&"justify-center"),style:{width:Go[At.id],minWidth:At.minWidth},children:At.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):At.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ve(M,ue?Ee.dollarSpent:void 0)}),jsx("span",{className:u("text-[11px]",$?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",$?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ve(se,ue?Ee.dollarAllocated:void 0)})]}),se>0&&jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ue?wt:st})]}):At.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:xe>0?Ve(xe,ue?Ee.dollarQuoted:void 0):"\u2013"}):At.type==="effortMinutes"?(()=>{if(ue&&xe>0&&se>0){let St=Math.round(Ee.dollarQuoted),zt=Math.round(Ee.dollarAllocated),oa=St-zt,Sa=St>0?Math.round(oa/St*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ve(se,Ee.dollarAllocated)}),jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",oa>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[oa>=0?"+":"",Math.abs(oa)>=1e3?`$${(oa/1e3).toFixed(1)}K`:`$${oa}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Sa,"%)"]})]})]})}return jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?Ve(se,ue?Ee.dollarAllocated:void 0):"\u2013"})})():At.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?Ve(M,ue?Ee.dollarSpent:void 0):"\u2013"}):At.type==="progress"?(()=>{let St=Xg(dc(e||[]));return jsxs("span",{className:u("text-[12px] font-bold font-mono",$?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[St,"%"]})})():At.type==="weight"?(()=>{let St=e||[],zt=[],oa=Ft=>{for(let eo of Ft)zt.push(eo),eo.subtasks?.length&&oa(eo.subtasks);};oa(St);let Ea=zt.filter(Ft=>!Ft.subtasks?.length||Ft.subtasks.length===0).reduce((Ft,eo)=>Ft+(eo.weight||0),0),ar=Math.abs(Ea-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",ar?$?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ea.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",$?"text-white/30":"text-gray-300"),children:"\u2013"})},At.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),ya.length===0&&Be&&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",$?"text-white/30":"text-gray-400")}),jsx("p",{className:u($?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),_?.enabled&&_.data&&he&&jsx(jg,{data:_.data,isDark:$,locale:d,onClose:()=>Ye(false),lens:t?.lens,onUnassignedTaskClick:M=>{let se=document.querySelector(`[data-task-id="${M}"]`);se&&(se.scrollIntoView({behavior:"smooth",block:"center"}),re(M),setTimeout(()=>re(null),2e3));}})]}),jsx(Dg,{state:H,onClose:E,isDark:$,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:U,onColumnSort:Ze,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),ce&&He&&D&&createPortal(jsx("div",{style:{position:"fixed",left:He.x+12,top:He.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Se.flattenTasks(e).find(xe=>xe.id===D);return se?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:$?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${$?"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:$?"#e6edf3":"#111827"},children:se.name})]}):null})()}),document.body),jsx(Hg,{isOpen:Dt,onClose:()=>Xe(false),onSave:lr,isDark:$,locale:d})]})}var e0=[{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}],t0=[{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"}],a0=[{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 cc={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"},uc={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"},pc={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"},Xi={dark:cc,light:uc,neutral:pc};function r0(e){return Xi[e]||Xi.dark}var mc={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"}},gc={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"}},Ji={en:mc,es:gc};function Es(e){return Ji[e]||Ji.en}function Qi(e,t){let a=Es(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 o0(e){let t=Es(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 n0(e,t=0,a=true){let r=Es(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 Fs(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 bc(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 l0({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 u0=26,bw=22,hw=10;function d0(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 hc(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 p0(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 c0(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 yw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:c,spanCols:i,lane:p,isStart:d,isEnd:m}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&m?"rounded":d?"rounded-l":m?"rounded-r":"",h=m?hc(c.effortMinutes,n,l):null,f=m?p0(c,n,l):null,b=m?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:`${p*u0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${bw}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}),m&&(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 m0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:p,comments:d,onAddComment:m,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:F,onDiscardTimer:I,blurFinancials:S=false,suppressDetailModal:X$1=false,lens:O="hours",hourlyRate:$=0}){let{theme:A="dark",locale:q="en",customTranslations:Z,showBacklog:Ee=true}=t,B=Qi(q,Z),_=A==="dark"||A==="neutral",[he,Ye]=useState(r||new Date),[z,re]=useState(null),[J,Le]=useState(null),[we,Oe]=useState(null),[Be,lt]=useState({}),ee=3,ct=3,pe=useCallback(V=>{Le(V.id),X$1||re(V),h?.(V.id);},[X$1,h]),[et,nt]=useState(null),Ut=useCallback(()=>{Ye(new Date(he.getFullYear(),he.getMonth()-1,1));},[he]),Ce=useCallback(()=>{Ye(new Date(he.getFullYear(),he.getMonth()+1,1));},[he]),mt=useCallback(()=>{Ye(new Date);},[]),Dt=useMemo(()=>{let V=he.getFullYear(),te=he.getMonth(),$e=new Date(V,te,1),Ne=new Date(V,te+1,0),He=$e.getDay(),Fe=Ne.getDate(),Ge=Fs(e),ht=new Date;ht.setHours(0,0,0,0);let dt=[],gt=He,ot=new Date(V,te,0).getDate();for(let Et=gt-1;Et>=0;Et--){let Nt=new Date(V,te-1,ot-Et);dt.push({date:Nt,isCurrentMonth:false,isToday:false,isWeekend:Nt.getDay()===0||Nt.getDay()===6,events:Ge.filter(Tt=>bc(Nt,Tt)).map(Tt=>({id:Tt.id,title:Tt.name,start:Tt.startDate,end:Tt.endDate,task:Tt}))});}for(let Et=1;Et<=Fe;Et++){let Nt=new Date(V,te,Et),Tt=Nt.getTime()===ht.getTime();dt.push({date:Nt,isCurrentMonth:true,isToday:Tt,isWeekend:Nt.getDay()===0||Nt.getDay()===6,events:Ge.filter(yt=>bc(Nt,yt)).map(yt=>({id:yt.id,title:yt.name,start:yt.startDate,end:yt.endDate,task:yt}))});}let jt=42-dt.length;for(let Et=1;Et<=jt;Et++){let Nt=new Date(V,te+1,Et);dt.push({date:Nt,isCurrentMonth:false,isToday:false,isWeekend:Nt.getDay()===0||Nt.getDay()===6,events:Ge.filter(Tt=>bc(Nt,Tt)).map(Tt=>({id:Tt.id,title:Tt.name,start:Tt.startDate,end:Tt.endDate,task:Tt}))});}return dt},[he,e]),Xe=useMemo(()=>Fs(e).filter(V=>!V.startDate||!V.endDate),[e]),H=useMemo(()=>{let V=Fs(e),te=0,$e=0,Ne=0,He=0,Fe=0;V.forEach(ot=>{ot.effortMinutes&&(te+=ot.effortMinutes),ot.soldEffortMinutes&&($e+=ot.soldEffortMinutes),ot.scheduleVariance!=null&&(Ne+=ot.scheduleVariance,He++),ot.soldEffortMinutes&&ot.effortMinutes&&(Fe+=ot.soldEffortMinutes-ot.effortMinutes);});let Ge=$e>0?Math.min(100,Math.round(te/$e*100)):0,ht=He>0?Math.round(Ne/He):0,gt=`${Fe<0?"-":"+"}${c0(Fe,O,$)}`;return {budgetUtil:Ge,avgVariance:ht,costDisplay:gt,hasCostData:$e>0}},[e,O,$]),ne=useMemo(()=>{let V=[0,0,0,0,0,0];return Dt.forEach((te,$e)=>{let Ne=Math.floor($e/7);te.events.forEach(He=>{if(He.task.startDate&&He.task.soldEffortMinutes){let Fe=new Date(He.task.startDate),Ge=te.date;Fe.getFullYear()===Ge.getFullYear()&&Fe.getMonth()===Ge.getMonth()&&Fe.getDate()===Ge.getDate()&&Ne<V.length&&(V[Ne]-=He.task.soldEffortMinutes);}});}),V},[Dt]),D=useMemo(()=>{let V=Fs(e),te=new Map,$e=new Set,Ne=[0,0,0,0,0,0];if(Dt.length===0)return {segmentsByCell:te,multiDayTaskIds:$e,maxLanesPerRow:Ne};let He=gt=>new Date(gt.getFullYear(),gt.getMonth(),gt.getDate()),Fe=He(Dt[0].date),Ge=He(Dt[Dt.length-1].date),ht=[];for(let gt of V){if(!gt.startDate||!gt.endDate)continue;let ot=He(gt.startDate),jt=He(gt.endDate);if(ot.getTime()===jt.getTime()||jt<Fe||ot>Ge)continue;let Et=ot<Fe?Fe:ot,Nt=jt>Ge?Ge:jt,Tt=d0(Et,Fe),yt=d0(Nt,Fe);Tt<0||Tt>41||yt<0||yt>41||Tt!==yt&&($e.add(gt.id),ht.push({task:gt,startIdx:Tt,endIdx:yt}));}ht.sort((gt,ot)=>gt.startIdx!==ot.startIdx?gt.startIdx-ot.startIdx:ot.endIdx-ot.startIdx-(gt.endIdx-gt.startIdx));let dt=[[],[],[],[],[],[]];for(let{task:gt,startIdx:ot,endIdx:jt}of ht){let Et=Math.floor(ot/7),Nt=Math.floor(jt/7),Tt=He(gt.startDate),yt=He(gt.endDate),$t=false;for(let We=Et;We<=Nt;We++){let Re=We===Et?ot%7:0,at=We===Nt?jt%7:6,ie=at-Re+1,me=0,L=dt[We]??[];for(dt[We]||(dt[We]=L);me<L.length&&(L[me]??-1)>=Re;)me++;if(me>=hw){$t=true;break}me>=L.length?L.push(at):L[me]=at,Ne[We]=Math.max(Ne[We]??0,me+1);let j=We===Et&&Tt>=Fe,Y=We===Nt&&yt<=Ge,ge=We*7+Re,De={taskId:gt.id,task:gt,rowIndex:We,startCol:Re,endCol:at,spanCols:ie,lane:me,isStart:j,isEnd:Y};te.has(ge)||te.set(ge,[]),te.get(ge).push(De);}$t&&($e.delete(gt.id),te.forEach((We,Re)=>{let at=We.filter(ie=>ie.taskId!==gt.id);at.length===0?te.delete(Re):te.set(Re,at);}));}return {segmentsByCell:te,multiDayTaskIds:$e,maxLanesPerRow:Ne}},[Dt,e]),K=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ce=he.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Te=ce.charAt(0).toUpperCase()+ce.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",_?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",_?"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",_?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",_?"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",_?"bg-[#050505]":"bg-white",n),style:l,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",_?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",_?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsx("p",{className:u("text-sm",_?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",_?"bg-[#050505]":"bg-white",n),style:l,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",_?"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",_?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",_?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",_?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Ut,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"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",_?"text-white":"text-gray-900"),children:Te}),jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"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",_?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:mt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",_?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:K.map(V=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",_?"text-white/60 font-mono":"text-gray-500"),children:V},V))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",_?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Le(null),children:Dt.map((V,te)=>{let $e=te%7===6,Ne=te>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!$e&&(_?"border-r border-[#222]":"border-r border-gray-200"),!Ne&&(_?"border-b border-[#222]":"border-b border-gray-200"),_?V.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":V.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",V.isToday&&_&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",V.isToday&&!_&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",V.isToday?_?"text-[#007FFF] font-bold":"text-blue-600 font-bold":V.isCurrentMonth?_?"text-white/60":"text-gray-900":_?"text-white/20":"text-gray-400"),children:String(V.date.getDate()).padStart(2,"0")}),(()=>{let He=Math.floor(te/7),Fe=(D.maxLanesPerRow[He]??0)*u0,Ge=D.segmentsByCell.get(te);return Fe===0&&!Ge?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Fe}px`,zIndex:5},children:Ge?.map(ht=>jsx(yw,{segment:ht,isDark:_,blurFinancials:S,isSelected:J===ht.taskId,t:B,lens:O,hourlyRate:$,onClick:()=>{pe(ht.task),a.onEventClick?.({id:ht.task.id,title:ht.task.name,start:ht.task.startDate,end:ht.task.endDate,task:ht.task});}},ht.taskId))})})(),(()=>{let He=V.events.filter(Fe=>Fe.task.isMilestone&&!D.multiDayTaskIds.has(Fe.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(Fe=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Fe.title,onClick:Ge=>{Ge.stopPropagation(),pe(Fe.task);}},Fe.id)),He.length>4&&jsxs("span",{className:u("text-[8px] font-mono",_?"text-white/30":"text-gray-400"),children:["+",He.length-4]})]})})(),(()=>{let He=[];V.events.forEach(Ge=>{Ge.task.blockers?.forEach(ht=>{(ht.severity==="warning"||ht.severity==="critical")&&He.push({taskId:Ge.id,type:ht.type,severity:ht.severity,variance:Ge.task.scheduleVariance});});});let Fe=He[0];return Fe?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",Fe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Fe.type,Fe.variance?` (+${Math.abs(Fe.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let He=V.events.filter(dt=>!D.multiDayTaskIds.has(dt.id)),Fe=Be[te]||ee,Ge=He.slice(0,Fe),ht=He.length-Fe;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ge.map(dt=>jsxs(motion.button,{onClick:()=>{pe(dt.task),a.onEventClick?.(dt);},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",dt.task.progress===100||dt.task.status==="completed"?_?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":_?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:_?dt.task.progress===100||dt.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)"}:dt.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]",dt.task.isMilestone?_?"text-amber-400":"text-amber-600":dt.task.isCriticalPath?"text-red-400":_?"text-[#1264FF]":"text-gray-400"),children:dt.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:dt.title})]},dt.id)),ht>0&&jsxs("button",{onClick:dt=>{dt.stopPropagation(),lt(gt=>({...gt,[te]:Fe+ct}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ht," ",q==="es"?"m\xE1s":"more"]}),Fe>ee&&He.length>ee&&jsx("button",{onClick:dt=>{dt.stopPropagation(),lt(gt=>({...gt,[te]:ee}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:q==="es"?"menos":"less"})]})})(),V.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let He=te>=28,Fe=te%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Ge=>{Ge.stopPropagation(),nt(et===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",et===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",_?"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",et===te&&"rotate-45")})}),jsx(AnimatePresence,{children:et===te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>nt(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",Fe?"right-0":"left-0",_?"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:Ge=>{a.onTaskCreate?.({name:Ge.name,startDate:Ge.startDate||V.date,endDate:Ge.endDate||V.date,priority:Ge.priority,assignees:Ge.assignee?[Ge.assignee]:void 0}),nt(null);},onCancel:()=>nt(null),availableUsers:t.availableUsers,isDark:_,locale:q==="es"?"es":"en",defaultDate:V.date,dropdownDirection:He?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let He=Math.floor(te/7),Fe=ne[He];if(!Fe||Fe===0)return null;let Ge=c0(Fe,O,$);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Fe<0?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Fe<0?"-":"+",Ge]})})()]},te)})})})]}),Ee&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",_?"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",_?"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]",_?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",_?"text-white/20":"text-gray-400"),children:Xe.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Xe.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",_?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",_?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",_?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Xe.map(V=>jsxs("button",{onClick:()=>{pe(V);},className:u("w-full text-left rounded-md p-3 transition-all group/card",_?"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",_?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",_?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:V.name})]}),V.tags&&V.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[V.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)),V.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",_?"text-white/20":"text-gray-400"),children:["+",V.tags.length-3]})]}),(V.effortMinutes||V.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",_?"text-white/25":"text-gray-400",S&&"blur-sm select-none"),children:[hc(V.effortMinutes,O,$)&&jsxs("span",{children:[B.labels.estimate,": ",hc(V.effortMinutes,O,$)]}),(()=>{let te=p0(V,O,$);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:[V.priority&&jsx(Flag,{className:u("w-3 h-3",V.priority==="urgent"||V.priority==="high"?"text-red-400":V.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(l0,{task:V,isDark:_})]}),V.assignees&&V.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:V.assignees.slice(0,2).map((te,$e)=>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()},$e))})]})]},V.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",_?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:V=>{V.key==="Enter"&&V.target.value.trim()&&(a.onTaskCreate?.({name:V.target.value.trim()}),V.target.value="");}})}),H.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",_?"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]",_?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",_?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",_?"text-white/60":"text-gray-700",S&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",_?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"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",_?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":_?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",B.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"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",_?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!X$1&&jsx(bo,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:V=>{a.onTaskUpdate?.(V),re(V);},theme:A==="dark"?"dark":"light",locale:q,availableUsers:t.availableUsers?.map(V=>({id:V.id,name:V.name,avatar:V.avatar,initials:V.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:z?p?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Fs(e).filter(V=>V.id!==z?.id),comments:d?.filter(V=>V.taskId===z?.id).map(V=>({...V,createdAt:V.createdAt instanceof Date?V.createdAt:new Date(V.createdAt),updatedAt:V.updatedAt instanceof Date?V.updatedAt:V.updatedAt?new Date(V.updatedAt):void 0})),onAddComment:m,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:F,onTimerDiscard:I,blurFinancials:S}),jsx(AnimatePresence,{children:we&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Oe(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",_?"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",_?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",_?"text-white/90":"text-gray-900"),children:we.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Oe(null),className:u("p-1 rounded",_?"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:we.events.map(V=>jsxs("button",{onClick:()=>{Oe(null),pe(V.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(l0,{task:V.task,isDark:_}),jsx("span",{className:u("text-sm truncate flex-1",_?"text-white/80":"text-gray-900"),children:V.title}),(V.task.priority==="high"||V.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},V.id))})]})]})})]})}var yc={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)"},xc={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)"},vc={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)"},tl={dark:yc,light:xc,neutral:vc};function g0(e){return tl[e]||tl.dark}function vw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=useState(false),p=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=p.length,y=new Set(p.flatMap(f=>f.assignedUserIds||[])).size,x=p.map(f=>f.priority).filter(Boolean),h=new Set(p.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[p]),m=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children: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:p.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:p.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 b0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function As(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function Ls(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function h0(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 y0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=useMemo(()=>({...b0,...n}),[n]),[i,p]=useState(new Set),d=useRef(null),m=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=>{p(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",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",c.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange: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:[Ls(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:m.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=i.has(v.id),T=s===v.id,k=h0(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:Ls(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:As(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,F])=>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(F.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(F.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,F])=>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(F)})]},w))]})]})]})]},v.id)})})]},b.date?.toISOString()||"all"))})]})}function v0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let p=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&Ls(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&As(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),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:()=>l(y),title:As(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:p.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",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function wc(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 kc(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 w0(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 k0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Dw(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})),l=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(p=>{let d=a/2,m=r/2;p.vx+=(d-p.x)*o.centerForce*i,p.vy+=(m-p.y)*o.centerForce*i,n.forEach(g=>{if(p.id===g.id)return;let y=p.x-g.x,x=p.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*i/(h*h);p.vx+=y/h*f,p.vy+=x/h*f;});}),t.forEach(p=>{let d=l.get(typeof p.source=="string"?p.source:p.source.id),m=l.get(typeof p.target=="string"?p.target:p.target.id);if(!d||!m)return;let g=m.x-d.x,y=m.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*i;d.vx+=g*h,d.vy+=y*h,m.vx-=g*h,m.vy-=y*h;}),n.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return n}function C0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=useRef(null),[p,d]=useState([]),[m,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=Dw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=useCallback((O,$)=>{a.enableDragging&&($.stopPropagation(),g(O));},[a.enableDragging]),k=useCallback(O=>{if(!m||!i.current)return;let A=i.current.getBoundingClientRect(),q=(O.clientX-A.left-C.x)/b,Z=(O.clientY-A.top-C.y)/b;d(Ee=>Ee.map(B=>B.id===m?{...B,x:q,y:Z,fx:q,fy:Z}:B));},[m,b,C]),w=useCallback(()=>{g(null);},[]),F=useCallback((O,$)=>{$.stopPropagation(),l?.({type:"node-click",node:O,position:{x:$.clientX,y:$.clientY}});},[l]),I=useCallback((O,$)=>{$.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:$.clientX,y:$.clientY}});},[l]),S=useCallback(O=>{let $=p.find(A=>A.id===O);return $?{x:$.x,y:$.y}:{x:0,y:0}},[p]),X=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let $=O.card.priority;return $==="URGENT"?"#ef4444":$==="HIGH"?"#f59e0b":$==="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:wc(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[w0(O)," ",kc(O)]})]},O))}),jsxs("svg",{ref:i,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 $=S(typeof O.source=="string"?O.source:O.source.id),A=S(typeof O.target=="string"?O.target:O.target.id),q=k0(O.type),Z=h===O.id,Ee=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",Ee&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:B=>I(O,B),children:[jsx("line",{x1:$.x,y1:$.y,x2:A.x,y2:A.y,stroke:wc(O.type),strokeWidth:Ee?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsx("text",{x:($.x+A.x)/2,y:($.y+A.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:kc(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:p.map(O=>{let $=y===O.id,A=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",$&&"hovered",A&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:q=>T(O.id,q),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:q=>F(O,q),children:[jsx("circle",{r:A?a.nodeSize*1.2:a.nodeSize,fill:X(O),stroke:A?"#fbbf24":"#ffffff",strokeWidth:A?3:2,opacity:$?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 D0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[l,c]=useState(false),[i,p]=useState(null),[d,m]=useState(null),g=useRef(null),y=l||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(""),p(null),m(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),p(null),m(null);try{let b=await r(s.trim());m(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxs(Jt,{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."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((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 Cc={"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 Ew={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Mw={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 Fw(e,t,a){let r=Cc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Is(e){return `$${e.toFixed(4)}`}var Tc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Fw(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,m)=>d+m.cost,0),s=a.reduce((d,m)=>d+m.inputTokens,0),n=a.reduce((d,m)=>d+m.outputTokens,0),l=a.filter(d=>d.success),c=a.reduce((d,m)=>d+m.duration,0),i={},p={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,p[d.feature]=(p[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(p=>p.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},dn=new Tc;function M0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(dn.getStats()),[s,n]=useState(dn.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(dn.getStats()),n(dn.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=dn.getRecentOperations(5);return jsxs(Jt,{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:Is(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,i])=>{let p=r.costsByFeature[c]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Is(p)})]})]}),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"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Is(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 A0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[c,i]=useState(""),[p,d]=useState(""),[m,g]=useState(false),[y,x]=useState(null),[h,f]=useState(null),[b,v]=useState(null),C=useRef(null),N=m||o;useEffect(()=>{e&&C.current&&C.current.focus();},[e]),useEffect(()=>{let I=S=>{S.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let T=()=>{N||(l(""),i(""),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:p||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 F=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(Jt,{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 (",F,"% 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,S)=>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:["#",S+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=>l(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=>i(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:p,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,S)=>jsx("button",{onClick:()=>l(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},S))})]})]})}),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 ol({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&js(()=>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(S=>S!==h)};if(I.id===f){let S=k.filter(X=>X.columnId===f).sort((X,O)=>X.position-O.position);return {...I,cardIds:S.map(X=>X.id)}}return I}),F={...v,cards:k,columns:w};return o(F),F});},[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]),l=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]),i=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]),p=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]),m=useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),g=useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),y=useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:p,onColumnDelete:d},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function I0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=ol({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,i,p={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...p});},addColumn:(c,i)=>{let p=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:i??p+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 Bs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},R0={by:"none",order:"asc"};function O0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...Bs,...e}),[s,n]=useState({...R0,...t}),l=useCallback(x=>{o(h=>({...h,...x}));},[]),c=useCallback(x=>{n(h=>({...h,...x}));},[]),i=useCallback(()=>{o(Bs),n(R0);},[]),p=useCallback(()=>{a&&o({...Bs,assignees:[a]});},[a]),d=useCallback(()=>{o({...Bs,dateFilter:"overdue"});},[]),m=useCallback(()=>{o({...Bs,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 F=k.getUTCFullYear(),I=String(k.getUTCMonth()+1).padStart(2,"0"),S=String(k.getUTCDate()).padStart(2,"0");w=`${F}-${I}-${S}`;}switch(r.dateFilter){case "overdue":return w<N;case "today":return w===N;case "this-week":let F=new Date(N+"T00:00:00"),I=new Date(w+"T00:00:00"),S=new Date(F);return S.setDate(S.getDate()+7),I>=F&&I<=S;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 F=f.endDate||f.dueDate,I=b.endDate||b.dueDate;if(!F)return 1;if(!I)return -1;let S=typeof F=="string"?new Date(F).getTime():F.getTime(),X=typeof I=="string"?new Date(I).getTime():I.getTime();v=S-X;break;case "title":v=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,$=b.estimatedTime||0;v=O-$;break;default:v=0;}return s.order==="asc"?v:-v}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:p,filterOverdue:d,filterHighPriority:m,applyFilters:y,hasActiveFilters:g}}var H0,z0;if(typeof window<"u")try{let e=Ws("ai");H0=e.generateObject,z0=e.generateText;}catch{}function U0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(H0&&z0&&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(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m: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(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),p=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(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Dc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function W0(e){let{cards:t}=e,[a,r]=Dc(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,m)=>{if(!m){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=m.ctrlKey||m.metaKey,y=m.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,F)=>w.position-F.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(m=>m!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),p=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:p}}var V0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function G0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...V0,...a}),[a]),[s,n]=useState([]),l=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));},[]),i=useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),p=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]),m=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)],F=k.reduce((I,S)=>I+S.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:F});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,T)=>T.confidence-N.confidence).slice(0,5)},[t,o,r]),y=useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);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:l,deleteStack:c,toggleStack:i,addToStack:p,removeFromStack:d,getStacksForColumn:m,getSuggestions:g,applySuggestion:y,config:o}}var j0=createContext(null);function _0({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:i}=Ws("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Ws("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Ws("@libxai/core");l=new c(t.board);}r.current=new BoardStore({board:l,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(j0.Provider,{value:{store:o},children:e})}function nl(){let e=useContext(j0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Os(){let e=nl(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=useCallback(b=>{e.updateBoard(b);},[e]),c=useCallback(b=>{e.addColumn(b);},[e]),i=useCallback((b,v)=>{e.updateColumn(b,v);},[e]),p=useCallback(b=>{e.deleteColumn(b);},[e]),d=useCallback(b=>e.getColumn(b),[e]),m=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:l,addColumn:c,updateColumn:i,deleteColumn:p,getColumn:d,addCard:m,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function q0(e){let{cards:t}=Os();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 Y0(e="position",t="asc"){let{cards:a}=Os();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=c-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var sl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=iu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Kw=new sl;function J0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=useRef(null),p=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:m,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 Q0(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 ef({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let p=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:n,gap:l}),m=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:p,style:g,className:s,children:jsx("div",{style:y,children:m.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 tf(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 af(e,t=10){return e>t}var Fc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Pc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ac={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Lc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ic={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Bc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Rc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Oc={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)"},$c={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)"},Hc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},zc={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}},Uc={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}},il={spacing:Fc,borderRadius:Pc,fontSize:Ac,fontWeight:Lc,lineHeight:Ic,zIndex:Bc,duration:Rc,easing:Oc,shadows:$c,opacity:Hc,kanban:zc,gantt:Uc};function rf(e,t,a){return e[t]??a}function Wc(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)?Wc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Xw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vc(e="asakaa"){let t=Wc(il),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Xw(o);a.push(` ${s}: ${n};`);}return `:root {
414
414
  ${a.join(`
415
415
  `)}
416
- }`}function $s(e,t="asakaa"){let a=[],r=Uc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
416
+ }`}function $s(e,t="asakaa"){let a=[],r=Wc(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 ll={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Vc={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},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 jc(e=ll,t="asakaa"){let a=Wc(t),r=$s(e,t);return `${a}
419
+ }`}var ll={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"}},Gc={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"}},jc={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 _c(e=ll,t="asakaa"){let a=Vc(t),r=$s(e,t);return `${a}
420
420
 
421
- ${r}`}function rf(){return `/**
421
+ ${r}`}function of(){return `/**
422
422
  * ASAKAA Design Tokens
423
423
  * Auto-generated from design-tokens.ts
424
424
  * Do not edit this file directly
425
425
  */
426
426
 
427
- ${jc(ll)}
427
+ ${_c(ll)}
428
428
 
429
429
  /* Light theme */
430
430
  [data-theme="light"] {
431
- ${$s(Vc,"asakaa").split(`
431
+ ${$s(Gc,"asakaa").split(`
432
432
  `).slice(1,-1).join(`
433
433
  `)}
434
434
  }
435
435
 
436
436
  /* Neutral theme */
437
437
  [data-theme="neutral"] {
438
- ${$s(Gc,"asakaa").split(`
438
+ ${$s(jc,"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 of({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,l])=>{let c=n,i=c===r;return jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(Xw,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
443
- export{E0 as AIUsageDashboard,Ew as AI_FEATURES,kc as AI_MODELS,Gl as AddCardButton,Hl as AddColumnButton,io as AttachmentUploader,j0 as BoardProvider,gi as BulkOperationsToolbar,ad as BurnDownChart,t0 as CUSTOM_FIELD_TYPES,p0 as CalendarBoard,go as Card,Xl as CardDetailModal,Zl as CardDetailModalV2,x0 as CardHistoryReplay,h0 as CardHistoryTimeline,k0 as CardRelationshipsGraph,xw as CardStack,dd as CardTemplateSelector,yl as CircuitBreaker,vn as Column,vi as ColumnManager,Kl as CommandPalette,md as ConfigMenu,Pn as ContextMenu,cs as DEFAULT_SHORTCUTS,Zg as DEFAULT_TABLE_COLUMNS,ld as DEFAULT_TEMPLATES,Xn as DateRangePicker,Qn as DependenciesSelector,hs as DependencyLine,rd as DistributionCharts,Dl as EditableColumnTitle,Cn as ErrorBoundary,Qp as ExportDropdown,ud as ExportImportModal,pd as FilterBar,Pm as GANTT_AI_SYSTEM_PROMPT,Bi as GanttAIAssistant,Sm as GanttBoard,Mn as GanttI18nContext,Fi as GanttMilestone,xi as GanttToolbar,P0 as GenerateGanttTasksDialog,N0 as GeneratePlanModal,sd as GroupBySelector,Al as HealthBar,Fo as KanbanBoard,Ol as KanbanToolbar,is as KanbanViewAdapter,id as KeyboardShortcutsHelp,Qg as ListView,ca as MenuIcons,sl as PluginManager,_o as PrioritySelector,Ll as ProfitabilityReport,Jo as QuickTaskCreate,Sw as RATE_LIMITS,e0 as STANDARD_FIELDS,od as SwimlaneBoardView,El as TagBadge,Vu as TagList,So as TagPicker,Ni as TaskBar,bo as TaskDetailModal,Fm as TaskFormModal,ki as TaskGrid,hd as ThemeModal,zp as ThemeProvider,of as ThemeSwitcher,oo as TimeInputPopover,Ml as TimePill,Fl as TimePopover,Ai as Timeline,qo as UserAssignmentSelector,td as VelocityChart,Z0 as VirtualGrid,X0 as VirtualList,ln as aiUsageTracker,Fc as borderRadius,Gs as calculatePosition,hc as calendarDarkTheme,pc as calendarEnTranslations,mc as calendarEsTranslations,yc as calendarLightTheme,xc as calendarNeutralTheme,tl as calendarThemes,Ji as calendarTranslations,$i as cardToGanttTask,$m as cardsToGanttTasks,u as cn,xp as createKanbanView,Rf as createRetryWrapper,gd as darkTheme,ll as darkTokenTheme,bi as defaultTheme,il as designTokens,Bc as duration,Rc as easing,rf as exportTokensToCSS,wo as findTaskByName,Pc as fontSize,Ac as fontWeight,Is as formatCost,yi as ganttEnTranslations,Wp as ganttEsTranslations,Om as ganttTaskToCardUpdate,ht as ganttThemes,zc as ganttTokens,yd as ganttTranslations,Ee as ganttUtils,Wc as generateCSSVariables,jc as generateCompleteCSS,Af as generateInitialPositions,Am as generateTasksContext,$s as generateThemeVariables,m0 as getCalendarTheme,Es as getCalendarTranslations,a0 as getListViewTheme,Ud as getListViewTranslations,r0 as getMonthNames,af as getToken,Vp as getTranslations,o0 as getWeekdayNames,Hc as kanbanTokens,fd as lightTheme,Vc as lightTokenTheme,Lc as lineHeight,dc as listViewDarkTheme,Hd as listViewEnTranslations,zd as listViewEsTranslations,cc as listViewLightTheme,uc as listViewNeutralTheme,Xi as listViewThemes,Hi as listViewTranslations,Qi as mergeCalendarTranslations,zi as mergeListViewTranslations,xd as mergeTranslations,bd as neutralTheme,Gc as neutralTokenTheme,$c as opacity,Bm as parseLocalCommand,Rd as parseNaturalDate,Od as parseNaturalDuration,$d as parseProgress,Im as parseStatus,_w as pluginManager,Bf as retrySyncOperation,js as retryWithBackoff,Oc as shadows,tf as shouldVirtualizeGrid,Mc as spacing,en as themes,z0 as useAI,L0 as useBoard,Os as useBoardCore,nl as useBoardStore,V0 as useCardStacking,Bl as useDragState,K0 as useFilteredCards,R0 as useFilters,Br as useGanttI18n,ol as useKanbanState,Op as useKeyboardShortcuts,U0 as useMultiSelect,Nc as useSelectionState,q0 as useSortedCards,Sn as useTheme,ef as useVirtualGrid,J0 as useVirtualList,Rm as validateAIResponse,jl as withErrorBoundary,Ks as wouldCreateCircularDependency,Ic as zIndex};//# sourceMappingURL=index.js.map
442
+ `}var Jw=({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 nf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=En();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let c=n,i=c===r;return jsxs("button",{onClick:()=>o(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(Jw,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
443
+ export{M0 as AIUsageDashboard,Mw as AI_FEATURES,Cc as AI_MODELS,jl as AddCardButton,zl as AddColumnButton,so as AttachmentUploader,_0 as BoardProvider,gi as BulkOperationsToolbar,rd as BurnDownChart,a0 as CUSTOM_FIELD_TYPES,m0 as CalendarBoard,go as Card,Jl as CardDetailModal,ed as CardDetailModalV2,v0 as CardHistoryReplay,y0 as CardHistoryTimeline,C0 as CardRelationshipsGraph,vw as CardStack,cd as CardTemplateSelector,xl as CircuitBreaker,wn as Column,vi as ColumnManager,ql as CommandPalette,gd as ConfigMenu,An as ContextMenu,cs as DEFAULT_SHORTCUTS,e0 as DEFAULT_TABLE_COLUMNS,dd as DEFAULT_TEMPLATES,Xn as DateRangePicker,Qn as DependenciesSelector,hs as DependencyLine,od as DistributionCharts,Sl as EditableColumnTitle,Tn as ErrorBoundary,Zp as ExportDropdown,pd as ExportImportModal,md as FilterBar,Am as GANTT_AI_SYSTEM_PROMPT,Bi as GanttAIAssistant,Em as GanttBoard,Fn as GanttI18nContext,Fi as GanttMilestone,xi as GanttToolbar,A0 as GenerateGanttTasksDialog,D0 as GeneratePlanModal,id as GroupBySelector,Ll as HealthBar,Fo as KanbanBoard,$l as KanbanToolbar,is as KanbanViewAdapter,ld as KeyboardShortcutsHelp,Zg as ListView,ca as MenuIcons,sl as PluginManager,Ko as PrioritySelector,Il as ProfitabilityReport,Qo as QuickTaskCreate,Ew as RATE_LIMITS,t0 as STANDARD_FIELDS,nd as SwimlaneBoardView,Ml as TagBadge,Gu as TagList,So as TagPicker,Ni as TaskBar,bo as TaskDetailModal,Pm as TaskFormModal,ki as TaskGrid,yd as ThemeModal,Up as ThemeProvider,nf as ThemeSwitcher,ro as TimeInputPopover,Fl as TimePill,Pl as TimePopover,Ai as Timeline,Yo as UserAssignmentSelector,ad as VelocityChart,ef as VirtualGrid,J0 as VirtualList,dn as aiUsageTracker,Pc as borderRadius,Gs as calculatePosition,yc as calendarDarkTheme,mc as calendarEnTranslations,gc as calendarEsTranslations,xc as calendarLightTheme,vc as calendarNeutralTheme,tl as calendarThemes,Ji as calendarTranslations,$i as cardToGanttTask,Hm as cardsToGanttTasks,u as cn,vp as createKanbanView,Of as createRetryWrapper,fd as darkTheme,ll as darkTokenTheme,bi as defaultTheme,il as designTokens,Rc as duration,Oc as easing,of as exportTokensToCSS,wo as findTaskByName,Ac as fontSize,Lc as fontWeight,Is as formatCost,yi as ganttEnTranslations,Vp as ganttEsTranslations,$m as ganttTaskToCardUpdate,ft as ganttThemes,Uc as ganttTokens,xd as ganttTranslations,Se as ganttUtils,Vc as generateCSSVariables,_c as generateCompleteCSS,Lf as generateInitialPositions,Lm as generateTasksContext,$s as generateThemeVariables,g0 as getCalendarTheme,Es as getCalendarTranslations,r0 as getListViewTheme,Wd as getListViewTranslations,o0 as getMonthNames,rf as getToken,Gp as getTranslations,n0 as getWeekdayNames,zc as kanbanTokens,bd as lightTheme,Gc as lightTokenTheme,Ic as lineHeight,cc as listViewDarkTheme,zd as listViewEnTranslations,Ud as listViewEsTranslations,uc as listViewLightTheme,pc as listViewNeutralTheme,Xi as listViewThemes,Hi as listViewTranslations,Qi as mergeCalendarTranslations,zi as mergeListViewTranslations,vd as mergeTranslations,hd as neutralTheme,jc as neutralTokenTheme,Hc as opacity,Rm as parseLocalCommand,Od as parseNaturalDate,$d as parseNaturalDuration,Hd as parseProgress,Bm as parseStatus,Kw as pluginManager,Rf as retrySyncOperation,js as retryWithBackoff,$c as shadows,af as shouldVirtualizeGrid,Fc as spacing,tn as themes,U0 as useAI,I0 as useBoard,Os as useBoardCore,nl as useBoardStore,G0 as useCardStacking,Rl as useDragState,q0 as useFilteredCards,O0 as useFilters,Br as useGanttI18n,ol as useKanbanState,$p as useKeyboardShortcuts,W0 as useMultiSelect,Dc as useSelectionState,Y0 as useSortedCards,En as useTheme,tf as useVirtualGrid,Q0 as useVirtualList,Om as validateAIResponse,_l as withErrorBoundary,Ks as wouldCreateCircularDependency,Bc as zIndex};//# sourceMappingURL=index.js.map
444
444
  //# sourceMappingURL=index.js.map