@libxai/board 1.5.5 → 1.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import gf from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,Users,CalendarClock,FileText,Timer,Clock,Tag,BarChart,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Search,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,FileJson,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import Lh from'react-markdown';import Ih from'remark-gfm';import Bh 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 ys=(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 xs=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 [xs.Translate.toString(e),xs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function p(...e){return twMerge(clsx(e))}function vs(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 df(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Qi(e,t){return e.length===0?1e3:t===0?vs(null,e[0].position):t>=e.length?vs(e[e.length-1].position,null):vs(e[t-1].position,e[t].position)}function zc(e,t=100){return e>t}var cf=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 uf(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function ws(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=cf,onRetry:d}=t,c,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(c=l,u===a||!n(c,u))return {error:c,attempts:i,success:false};let g=uf(u,r,o,s);if(d)try{d(c,u,g);}catch(x){console.error("Error in retry callback:",x);}await new Promise(x=>setTimeout(x,g));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function pf(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 mf(e,t={}){return async(...a)=>ws(()=>e(...a),t)}var Zi=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 Uc=(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))(Uc||{}),ko=class ko{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,d=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(d,o,c?n:"");break;case "INFO":console.info(d,o,c?n:"");break;case "WARN":console.warn(d,o,c?n:"");break;case "ERROR":console.error(d,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",...ko.globalOptions};}static configure(t){ko.globalOptions={...ko.globalOptions,...t};}child(t){return new ko({...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 ks((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new ks(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Uc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};ko.globalOptions={};var el=ko,ks=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}},Wc=new el;function ff(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 bf(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(d=>d.id===s.columnId);return [s.id,tl(s.title),tl(s.description||""),tl(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
2
  `)}async function hf(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await gf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),d=n.toDataURL("image/png"),c=297,i=210,u=n.width/n.height,l=c-20,m=l/u;m>i-20&&(m=i-20,l=m*u);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 x=(c-l)/2;return g.addImage(d,"PNG",x,20,l,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let d=e.cards.filter(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,d.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):d.forEach(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 u=o.splitTextToSize(c.description,160);o.text(u,25,s),s+=u.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(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 tl(e){return e.includes(",")||e.includes('"')||e.includes(`
3
3
  `)?`"${e.replace(/"/g,'""')}"`:e}async function Vc(e,t,a,r){switch(t){case "json":return ff(e,r);case "csv":return bf(e);case "pdf":return await hf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function _c(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},d=new Blob([e],{type:n[t]}),c=URL.createObjectURL(d),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function yf(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 xf(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=jc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=jc(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((g,x)=>{i[g]=d[x]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let l=o.get(u),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.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),l.cardIds.push(m.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function jc(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 Kc(e,t){switch(t){case "json":return yf(e);case "csv":return xf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Yc(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 al=createContext(null);function qc(){return useContext(al)}var Xc=createContext(null);function Jc({children:e,themeName:t}){return jsx(Xc.Provider,{value:{themeName:t},children:e})}function qo(){return useContext(Xc)}function At({children:e,container:t}){let[a,r]=useState(false),o=qc(),s=qo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:d,themeName:c}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return createPortal(jsx("div",{"data-theme":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 au={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Sf="#BDC3C7",Ef=({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 Co({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),d=useRef(null),c=useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,v=160,f=220,h=4,w=g.right-v;w<10&&(w=g.left),w+v>b-10&&(w=b-v-10);let y=x-g.bottom,k=g.top,C;y>=f+h?C=g.bottom+h:k>=f+h?C=g.top-f-h:C=y>=k?g.bottom+h:Math.max(10,g.top-f-h),n({top:C,left:w}),o(true);};useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&!c.current?.contains(x.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=x=>{x.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),o(false);},l=e?au[e]:null,m=l?.color||Sf;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:l?.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(At,{children:jsxs("div",{ref:d,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(au).map(([g,x])=>jsxs("button",{onClick:()=>u(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:x.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(Ef,{color:x.color}),jsx("span",{className:"font-semibold text-sm",children:x.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:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 Ff=[{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 Sn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),m=(qo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let w=i.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,C=320,D=380,T=4,L=w.left;L+C>k-10&&(L=k-C-10),L<10&&(L=10);let B=y-w.bottom,S=w.top,R;B>=D+T?R=w.bottom+T:S>=D+T?R=w.top-D-T:R=B>=S?w.bottom+T:Math.max(10,w.top-D-T),d({top:R,left:L}),s(true);};useEffect(()=>{let w=y=>{c.current&&!c.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),useEffect(()=>{let w=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let x=w=>{let y=new Date,k=L=>{let B=L.getFullYear(),S=String(L.getMonth()+1).padStart(2,"0"),R=String(L.getDate()).padStart(2,"0");return `${B}-${S}-${R}`},C=k(y),D=new Date(y);D.setDate(D.getDate()+w);let T=k(D);a(C,T),s(false);},b=()=>{if(!e||!t)return "Set date";let w=D=>{if(D instanceof Date)return D;if(typeof D!="string"||!D.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=D.split("-").map(Number);if(T.length!==3||T.some(R=>isNaN(R)))return null;let L=T[0],B=T[1],S=T[2];return L===void 0||B===void 0||S===void 0?null:new Date(L,B-1,S)},y=w(e),k=w(t);if(!y||!k||isNaN(y.getTime())||isNaN(k.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[y.getMonth()]} ${y.getDate()} \u2013 ${C[k.getMonth()]} ${k.getDate()}`},v=e&&t,h=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),w<y})();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 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${b()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:b()})]}),o&&jsx(At,{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:Ff.map(w=>jsx("button",{onClick:()=>x(w.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:y=>{y.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",y.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:y=>{y.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",y.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color: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:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function No({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[d,c]=useState(""),[i,u]=useState({top:0,left:0}),l=useRef(null),m=useRef(null),g=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),w=window.innerHeight,y=window.innerWidth,k=300,C=380,D=4,T=h.right-k;T<10&&(T=h.left),T+k>y-10&&(T=y-k-10);let L=w-h.bottom,B=h.top,S;L>=C+D?S=h.bottom+D:B>=C+D?S=h.top-C-D:S=L>=B?h.bottom+D:Math.max(10,h.top-C-D),u({top:S,left:T}),n(true);};useEffect(()=>{let h=w=>{l.current&&!l.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let x=h=>{let w=e.some(y=>y.id===h.id);a(w?e.filter(y=>y.id!==h.id):[...e,h]);},b=t.filter(h=>h.name.toLowerCase().includes(d.toLowerCase())),v=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:[v.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.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(At,{children:jsxs("div",{ref:l,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:d,onChange:h=>c(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:b.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):b.map(h=>{let w=e.some(y=>y.id===h.id);return jsxs("button",{onClick:()=>x(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:y=>{y.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:h.color,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.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:h.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},h.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 Cs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let l=u;return l.taskId||l.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,d=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let u of i){if(!s.has(u)&&d(u))return true;if(n.has(u))return true}}return n.delete(c),false};return d(a)}function Fn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,c]=useState(false),[i,u]=useState(""),[l,m]=useState(t.length>0),[g,x]=useState({top:0,left:0}),[b,v]=useState(null),f=useRef(null),h=useRef(null),w=()=>{if(!h.current)return;let T=h.current.getBoundingClientRect(),L=window.innerHeight,B=window.innerWidth,S=300,R=l?380:120,$=4,de=T.right-S;de<10&&(de=T.left),de+S>B-10&&(de=B-S-10);let F=L-T.bottom,X=T.top,xe;F>=R+$?xe=T.bottom+$:X>=R+$?xe=T.top-R-$:xe=F>=X?T.bottom+$:Math.max(10,T.top-R-$),x({top:xe,left:de}),c(true);};useEffect(()=>{if(!d||!h.current)return;let T=h.current.getBoundingClientRect(),L=window.innerHeight,B=window.innerWidth,S=300,R=l?380:120,$=4,de=T.right-S;de<10&&(de=T.left),de+S>B-10&&(de=B-S-10);let F=L-T.bottom,X=T.top,xe;F>=R+$?xe=T.bottom+$:X>=R+$?xe=T.top-R-$:xe=F>=X?T.bottom+$:Math.max(10,T.top-R-$),x({top:xe,left:de});},[l,d]),useEffect(()=>{let T=L=>{f.current&&!f.current.contains(L.target)&&!h.current?.contains(L.target)&&(c(false),u(""));};if(d)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[d]),useEffect(()=>{let T=L=>{L.key==="Escape"&&(c(false),u(""));};if(d)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[d]);let y=T=>{let L=t.includes(T),B=a.find(S=>S.id===T);if(v(null),L){let S=t.filter(R=>R!==T);r(S),S.length===0&&m(false);}else {if(s&&Cs(a,T,e)){let R=`Cannot add "${B?.title||T}" as dependency - would create circular reference`;v(R),n?.(T,B?.title||T),setTimeout(()=>v(null),3e3);return}r([...t,T]),m(true);}},k=()=>{let T=!l;m(T),T||r([]);},C=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),D=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:h,onClick:()=>d?c(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:D,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:D},children:t.length})]}),d&&jsx(At,{children:jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[b&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:b})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&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"})]})}),l&&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:T=>u(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:C.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):C.map(T=>{let L=t.includes(T.id);return jsxs("button",{onClick:()=>y(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:B=>{B.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:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),m(false),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 Vr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:l,transform:m,transition:g,isDragging:x}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:xs.Transform.toString(m),transition:g};if(t)return jsx("div",{ref:l,style:b,...i,...u,onClick:()=>a?.(e),children:t(e)});let v=d.filter(y=>e.assignedUserIds?.includes(y.id)),f=e.progress===100,h=(e.attachments||[]).filter(y=>y.type.startsWith("image/")),w={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:l,style:w,className:p("asakaa-card",x&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:y=>{y.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:y=>{y.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[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:y=>{y.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((y,k)=>jsxs("div",{className:"relative",children:[jsx("img",{src:y.url,alt:y.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}),k===3&&h.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:["+",h.length-4]})})]},y.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:y=>y.stopPropagation(),className:"priority-selector",children:jsx(Co,{priority:e.priority,onChange:y=>n?.(e.id,{priority:y})})}),jsx("div",{onClick:y=>y.stopPropagation(),className:"date-picker",children:jsx(Sn,{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:(y,k)=>n?.(e.id,{startDate:y,endDate:k})})}),d.length>0&&jsx("div",{onClick:y=>y.stopPropagation(),className:"user-selector",children:jsx(No,{assignedUsers:v,availableUsers:d,onChange:y=>n?.(e.id,{assignedUserIds:y.map(k=>k.id)})})}),jsx("div",{onClick:y=>y.stopPropagation(),className:"dependencies-selector",children:jsx(Fn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(y=>typeof y=="string"?y:y.taskId):[],availableTasks:c,onChange:y=>n?.(e.id,{dependencies:y})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(y=>jsx("span",{className:"asakaa-label",children:y},y))}),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)));Vr.displayName="Card";var Ts={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 mu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),u=[...Object.entries(Ts).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ts).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let v=Ts[e];if(v)return {...v,id:e};let f=r.find(h=>h.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ts.todo,id:"todo"}},m=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),f=window.innerHeight,h=window.innerWidth,w=180,y=280,k=4,C=v.right-w;C<10&&(C=v.left),C+w>h-10&&(C=h-w-10);let D=f-v.bottom,T=v.top,L;D>=y+k?L=v.bottom+k:T>=y+k?L=v.top-y-k:L=D>=T?v.bottom+k:Math.max(10,v.top-y-k),d({top:L,left:C}),s(true);};useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},x=l(),b=x.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:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:x.label,children:jsx(pu,{icon:x.icon,color:b})}),o&&jsx(At,{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:u.map(v=>jsxs("button",{onClick:()=>g(v.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(pu,{icon:v.icon,color:v.color}),jsx("span",{className:"font-semibold",children:v.label}),e===v.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}var gu={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 fu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=gu[s]||gu.en,[d,c]=useState(false),[i,u]=useState(false),[l,m]=useState(e),[g,x]=useState({top:0,left:0}),b=useRef(null),v=useRef(null),f=useRef(null);useEffect(()=>{if(d&&v.current){let k=v.current.getBoundingClientRect();x({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[d]),useEffect(()=>{let k=C=>{b.current&&!b.current.contains(C.target)&&!v.current?.contains(C.target)&&(c(false),u(false));};if(d)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[d]),useEffect(()=>{let k=C=>{C.key==="Escape"&&(c(false),u(false),m(e));};if(d)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[d,e]),useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let h=()=>{u(true),m(e);},w=()=>{let k=l.trim();k&&k!==e&&t(k),u(false),c(false),m(e);},y=k=>{k.key==="Enter"?w():k.key==="Escape"&&(u(false),m(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>c(!d),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),d&&jsx(At,{children:jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children: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:l,onChange:k=>m(k.target.value),onKeyDown:y,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,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 Qo=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:l=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:x,onColumnDelete:b,isDeletable:v=false,className:f,renderMetrics:h,locale:w})=>{let{setNodeRef:y,isOver:k}=useDroppable({id:e.id,data:{type:"column",column:e}}),C=useRef(null),D=u??zc(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>l,enabled:D});if(a)return jsx("div",{ref:y,className:f,children:a(e,t)});let B=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let $=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:$}:$>=80?{state:"warning",percentage:$}:$>=60?{state:"approaching",percentage:$}:{state:"ok",percentage:$}})(),S=B.state==="exceeded",R=()=>"asakaa-column-count";return jsxs("div",{ref:y,className:p("asakaa-column",k&&"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:p(R()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&B.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${B.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[B.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"})]}),B.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"})]}),B.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"})}),B.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"})]})]}),(x||b)&&jsx(fu,{columnTitle:e.title,onRename:$=>x?.(e.id,$),onDelete:b?()=>b(e.id):void 0,isDeletable:v,locale:w}),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"})]})]}),h&&h(e,t),!m&&jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsx(SortableContext,{items:t.map($=>$.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"})}):D?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map($=>{let de=t[$.index];return de?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${$.start}px)`},children:jsx(Vr,{card:de,render:r,onClick:n,onUpdate:d,availableUsers:c,allCards:i})},de.id):null})}):t.map($=>jsx(Vr,{card:$,render:r,onClick:n,onUpdate:d,availableUsers:c,allCards:i},$.id))})})]})});Qo.displayName="Column";function il({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),d=useRef(null);useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:d,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:c,onKeyDown:i,className:p("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:p("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function qf(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function wu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let c=d.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Xf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Jf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Qf=["\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 ku({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:l=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:x,maxFileSizeMB:b=10}){let v=d==="dark",[f,h]=useState(false),[w,y]=useState([]),[k,C]=useState(0),[D,T]=useState(null),[L,B]=useState(false),S=useRef(null),R=useRef(null),$=useRef(null),de=useRef(null),F=useCallback((O,q)=>{let J=qf(O,q);if(T(J),J){let pe=r.filter(Be=>Be.name.toLowerCase().includes(J.query)||Be.email&&Be.email.toLowerCase().includes(J.query)).slice(0,5);y(pe),h(pe.length>0),C(0);}else h(false),y([]);},[r]),X$1=O=>{let q=O.target.value;if(t(q),F(q,O.target.selectionStart||0),S.current){S.current.style.height="24px";let J=S.current.scrollHeight,pe=280,Be=Math.min(J,pe);S.current.style.height=`${Be}px`,S.current.style.overflowY=J>pe?"auto":"hidden";}},xe=()=>{S.current&&F(e,S.current.selectionStart||0);},_e=useCallback(O=>{if(!D||!S.current)return;let q=e.slice(0,D.start),J=e.slice(D.end),pe=`@${O.name.replace(/\s+/g,"")} `,Be=q+pe+J;t(Be),h(false),T(null),setTimeout(()=>{if(S.current){let ze=D.start+pe.length;S.current.selectionStart=ze,S.current.selectionEnd=ze,S.current.focus();}},0);},[D,e,t]),M=O=>{if(f&&w.length>0)switch(O.key){case "ArrowDown":O.preventDefault(),C(q=>q<w.length-1?q+1:0);break;case "ArrowUp":O.preventDefault(),C(q=>q>0?q-1:w.length-1);break;case "Enter":{O.preventDefault();let q=w[k];q&&_e(q);break}case "Tab":{O.preventDefault();let q=w[k];q&&_e(q);break}case "Escape":O.preventDefault(),h(false);break}else O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),a());};useEffect(()=>{let O=q=>{R.current&&!R.current.contains(q.target)&&S.current&&!S.current.contains(q.target)&&h(false),de.current&&!de.current.contains(q.target)&&B(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let W=useCallback(O=>{if(!S.current)return;let q=S.current.selectionStart||e.length,J=e.slice(0,q)+O+e.slice(q);t(J),B(false),setTimeout(()=>{if(S.current){let pe=q+O.length;S.current.selectionStart=pe,S.current.selectionEnd=pe,S.current.focus();}},0);},[e,t]),re=useCallback(O=>{if(!g||!O.target.files)return;let q=Array.from(O.target.files),J=b*1024*1024,pe=q.filter(Be=>Be.size>J?(console.warn(`File ${Be.name} exceeds max size of ${b}MB`),false):true);pe.length>0&&g(pe),O.target.value="";},[g,b]),ke=useCallback(O=>O.type.startsWith("image/")?Image:O.type.includes("pdf")||O.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&R.current){let O=R.current.children[k];O&&O.scrollIntoView({block:"nearest"});}},[k,f]),jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:m.map(O=>{let q=ke(O.file),J=O.file.type.startsWith("image/");return jsxs("div",{className:p("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[J&&O.preview?jsx("img",{src:O.preview,alt:O.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(q,{className:p("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:p("text-xs truncate",v?"text-white":"text-gray-900"),children:O.file.name}),jsx("p",{className:p("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:Jf(O.file.size)})]}),x&&jsx("button",{onClick:()=>x(O.id),className:p("p-0.5 rounded-full transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},O.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:p("flex-1 relative min-w-0"),children:[jsxs("div",{className:p("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>B(!L),disabled:s||n,className:p("p-1 rounded transition-colors flex-shrink-0",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:L&&jsx(motion.div,{ref:de,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Qf.map(O=>jsx("button",{type:"button",onClick:()=>W(O),className:p("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:O},O))})})})]}),l&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||n,className:p("p-1.5 rounded transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:$,type:"file",multiple:true,onChange:re,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:S,value:e,onChange:X$1,onSelect:xe,onKeyDown:M,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:p("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:p("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:f&&w.length>0&&jsx(motion.div,{ref:R,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((O,q)=>jsxs("button",{type:"button",onClick:()=>_e(O),className:p("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",q===k?v?"bg-white/10":"bg-gray-100":v?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:O.color||"#8B5CF6"},children:Xf(O.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:p("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:O.name}),O.email&&jsx("p",{className:p("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:O.email})]})]},O.id))})})]})]})]})}function Cu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((d,c)=>d.type==="mention"?jsx("span",{className:p("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},c):jsx("span",{children:d.value},c))})}var Fs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function oo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,c]=useState(false),[i,u]=useState(""),[l,m]=useState(false),[g,x]=useState(Fs[10]||"#2E94FF"),[b,v]=useState({top:0,left:0}),f=useRef(null),h=useRef(null),w=useRef(null),y=useRef(null),k=t.filter(S=>S.name.toLowerCase().includes(i.toLowerCase())),C=t.some(S=>S.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(d&&h.current){let S=h.current.getBoundingClientRect();v({top:S.bottom+6,left:S.left});}},[d]),useEffect(()=>{let S=R=>{let $=R.target,de=f.current?.contains($),F=w.current?.contains($);!de&&!F&&(c(false),u(""),m(false));};if(d)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[d]),useEffect(()=>{d&&y.current&&y.current.focus();},[d]);let D=S=>{let R=e.some($=>$.id===S.id);a(R?e.filter($=>$.id!==S.id):[...e,S]);},T=async()=>{if(!(!r||!i.trim())){m(true);try{let S=await r(i.trim(),g);S&&(a([...e,S]),u(""),x(Fs[Math.floor(Math.random()*Fs.length)]||"#2E94FF"));}finally{m(false);}}},L=(S,R)=>{R.stopPropagation(),a(e.filter($=>$.id!==S));},B={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&c(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:B,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:d&&jsxs(motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:b.top,left:b.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:y,type:"text",value:i,onChange:S=>u(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()&&!C&&r&&T();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(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:R=>L(S.id,R),children:[S.name,jsx(X,{className:"w-3 h-3"})]},S.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(S=>{let R=e.some($=>$.id===S.id);return jsxs("button",{type:"button",onClick:()=>D(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:R?`${S.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{R||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{R||($.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}),R&&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()&&!C&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Fs.map(S=>jsx("button",{type:"button",onClick:()=>x(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:T,disabled:l,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:l?.7:1},children:[l?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 dl({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 Nu({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(dl,{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 So=[{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 Du(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function ib(e){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 lb({className:e}){return jsxs("svg",{className:p("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 cl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=ib(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Du(e.loggedMinutes),i=e.estimateMinutes?Du(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:p("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(lb,{className:d[t]}),jsx("span",{children:u})]})}function Eu(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function Ms(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function ub(e){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 pb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function mb({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 Fu({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 gb({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 ul({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:d,onStopTimer:c,onDiscardTimer:i,onClose:u,className:l}){let[m,g]=useState(""),[x,b]=useState(t.estimateMinutes?Ms(t.estimateMinutes):""),[v,f]=useState(""),[h,w]=useState(false),[y,k]=useState(false),C=useRef(null);useEffect(()=>{C.current?.focus();},[]);let D=async()=>{let B=Eu(m);if(!(B<=0||!s)){w(true);try{await s({durationMinutes:B,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},T=async()=>{if(!n)return;let B=x.trim()?Eu(x):null;await n(B),k(false);},L=B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),D()),B.key==="Escape"&&u?.();};return jsxs("div",{className:p("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",l),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Fu,{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:ub(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(mb,{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(Fu,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:d,className:p("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(pb,{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(gb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:C,type:"text",value:m,onChange:B=>g(B.target.value),onKeyDown:L,placeholder:"8 (=8h), 2h 30m",className:p("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:D,disabled:h||!m.trim(),className:p("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:v,onChange:B=>f(B.target.value),onKeyDown:L,placeholder:"Note (optional)",className:p("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:Ms(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"}),y?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:x,onChange:B=>b(B.target.value),onKeyDown:B=>{B.key==="Enter"&&T(),B.key==="Escape"&&k(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Ms(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:p("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:p("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(B=>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:B.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ms(B.durationMinutes)})]},B.id))})]})]})}function xb(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function vb(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 Ir({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[d,c]=useState(vb(r)),[i,u]=useState(""),[l,m]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let x=async()=>{m(true);let w=xb(d);await o(w&&w>0?w:null,i||void 0),m(false);},b=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),x()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:p("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:g,type:"text",value:d,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 2:30"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:w=>u(w.target.value),onKeyDown:v,placeholder:h?"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:x,disabled:l||!d.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:l?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:b,disabled:l,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:h?"Quitar":"Clear"})]})]})}function wb(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 ml({summary:e,showLabel:t=false,size:a="md",className:r}){let o=wb(e.health),s=kb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},d=e.progressPercent??0,c=Math.min(100,d),i=d>100;return e.health==="no-estimate"?jsxs("div",{className:p("flex items-center gap-2",r),children:[jsx("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:p("h-full w-1/4",o)})}),t&&jsx("span",{className:p("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxs("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:p("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:p("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[d,"%"]})]})}function Zo(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 Tb(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 Nb(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 Db(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 Sb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",d=a?"text-[#9CA3AF]":"text-gray-500",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:p("p-4 rounded-lg border",s,n),children:[jsx("div",{className:p("text-sm font-medium mb-1",d),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:p("text-2xl font-bold",o),children:[r?"+":"",Zo(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:p("text-xs mt-1",d),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsx("div",{className:p("text-sm font-medium mb-2",d),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:p("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:p("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:p("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsx("div",{className:p("text-sm font-medium mb-2",d),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:d,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:p("font-medium",c),children:Zo(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:d,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:p("font-medium",c),children:Zo(e.totalLoggedMinutes)})]}),jsxs("div",{className:p("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:d,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:p("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Eb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",d=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:p("border-b",s,r&&p("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:p("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:p("text-xs mt-1",d),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Zo(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:Zo(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:p("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":d),children:[o,Zo(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:p("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":d),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:p("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Nb(e.status,a),Tb(e.status,a)),children:Db(e.status,t)})})]})}function gl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",d=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",u=n?"text-white/[0.92]":"text-gray-900",l=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((x,b)=>x.varianceMinutes===null?1:b.varianceMinutes===null?-1:b.varianceMinutes-x.varianceMinutes):[],[e]);return t?jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:p("space-y-6 p-6",d,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:p("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:p("text-sm mt-1",l),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Sb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:p("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:p("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:"%"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:p("divide-y",i),children:g.map(x=>jsx(Eb,{task:x,locale:a,isDark:n,onClick:s},x.taskId))})]})})}),jsx("div",{className:p("text-xs text-center",l),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 en(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 Wb(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 Hu(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 Gb(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 jr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:l,onDeleteAttachment:m,availableTasks:g=[],comments:x=[],onAddComment:b,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:h,enableTimeTracking:w=false,timeTrackingSummary:y,timeEntries:k=[],isTimerRunning:C=false,timerElapsedSeconds:D=0,onTimeLog:T,onEstimateUpdate:L,onSoldEffortUpdate:B,onTimerStart:S,onTimerStop:R,onTimerDiscard:$,blurFinancials:de=false}){let F=s==="dark",X$1={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)"},xe=e&&"title"in e&&!("name"in e),_e=e,[M,W]=useState(e?Hu(e,d):null),[re,ke]=useState(false),[O,q]=useState(false),[J,pe]=useState(false),[Be,ze]=useState(null),[it,nt]=useState(new Date),[oe,ct]=useState(false),[Re,yt]=useState(false),[ft,pt]=useState(""),[Te,Xe]=useState(false),[ot,Qe]=useState(false),[H,se]=useState(false),[N,Y]=useState(false),[ie,he]=useState(""),_=useRef(null),ee=useRef(null),[Ve,ve]=useState(""),Ue=useRef(null),[Se,He]=useState(""),[lt,st]=useState(false),[dt,mt]=useState([]),[It,z]=useState(""),[fe,Ce]=useState(false),Ke=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=Hu(e,d);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),W(P),he(P.description||""),ve(P.name||"");}},[e?.id,e?.quotedMinutes,d,t]),useEffect(()=>{if(!t||!ie)return;let P=setTimeout(()=>{let ce=ee.current;ce&&(ce.style.height="auto",ce.style.height=`${Math.max(100,ce.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,ie]),useEffect(()=>()=>{_.current&&clearTimeout(_.current),Ue.current&&clearTimeout(Ue.current);},[]),useEffect(()=>{t&&Ke.current&&x.length>0&&setTimeout(()=>{Ke.current&&(Ke.current.scrollTop=Ke.current.scrollHeight);},100);},[t,x.length]);let qe=useCallback(P=>{W(P),xe&&o&&_e?o(Gb(P,_e)):r&&r(P);},[xe,_e,o,r]),ge=useCallback(()=>{ke(false),q(false),pe(false),ze(null),yt(false),pt(""),Xe(false);},[]),te=useCallback((P,ce)=>{if(!M)return;let $e={...M,[P]:ce};qe($e);},[M,qe]),V=useCallback(()=>{let P=ee.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),me=useCallback(P=>{he(P),setTimeout(V,0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{if(M){let ce={...M,description:P};qe(ce);}},800);},[M,qe,V]),Z=useCallback(P=>{ve(P),Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(()=>{if(M&&P.trim()){let ce={...M,name:P.trim()};qe(ce);}},800);},[M,qe]),A=useCallback(P=>{let ce=P.map($e=>{let Je={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:$e};return $e.type.startsWith("image/")&&(Je.preview=URL.createObjectURL($e)),Je});mt($e=>[...$e,...ce]);},[]),j=useCallback(P=>{mt(ce=>{let $e=ce.find(Je=>Je.id===P);return $e?.preview&&URL.revokeObjectURL($e.preview),ce.filter(Je=>Je.id!==P)});},[]),ae=useCallback(async()=>{if(!(!M||!Se.trim()&&dt.length===0||!b)){st(true);try{let P=wu(Se,f),ce=[];if(dt.length>0&&h){let $e=dt.map(Je=>Je.file);ce=await h($e);}await b(M.id,Se.trim(),P.length>0?P:void 0,ce.length>0?ce:void 0),He(""),dt.forEach($e=>{$e.preview&&URL.revokeObjectURL($e.preview);}),mt([]);}finally{st(false);}}},[M,Se,dt,b,f,h]),Ne=useCallback(()=>{if(!M||!It.trim())return;let P=M.subtasks||[],ce={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:It.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},$e=[...P,ce],Je={...M,subtasks:$e};qe(Je),z(""),Ce(false);},[M,It,qe]),Pe=useCallback(P=>{if(!M?.subtasks)return;let ce=M.subtasks.map(Je=>Je.id===P?{...Je,progress:Je.progress===100?0:100}:Je),$e={...M,subtasks:ce};qe($e);},[M,qe]),Ye=useCallback(P=>{if(!M?.subtasks)return;let ce=M.subtasks.filter(Je=>Je.id!==P),$e={...M,subtasks:ce};qe($e);},[M,qe]),Oe=useCallback(P=>{let ce=typeof P=="string"?new Date(P):P,Je=new Date().getTime()-ce.getTime(),xt=Math.floor(Je/6e4),za=Math.floor(Je/36e5),ta=Math.floor(Je/864e5);return xt<1?n==="es"?"Ahora":"Just now":xt<60?n==="es"?`Hace ${xt} min`:`${xt}m ago`:za<24?n==="es"?`Hace ${za}h`:`${za}h ago`:ta<7?n==="es"?`Hace ${ta}d`:`${ta}d ago`:ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Dt=useCallback(P=>{if(!M)return;let ce=M.progress||0;P==="completed"?ce=100:P==="in-progress"&&ce===0?ce=10:P==="todo"&&(ce=0);let $e={...M,status:P,progress:ce};qe($e),ke(false);},[M,qe]),gt=useCallback((P,ce)=>{if(!M)return;let $e={...M,startDate:P,endDate:ce};qe($e);},[M,qe]),Ut=useCallback(()=>{let P=it.getFullYear(),ce=it.getMonth(),$e=new Date(P,ce,1),xt=new Date(P,ce+1,0).getDate(),za=$e.getDay(),ta=[],rr=new Date(P,ce,0).getDate();for(let sa=za-1;sa>=0;sa--)ta.push({date:new Date(P,ce-1,rr-sa),isCurrentMonth:false});for(let sa=1;sa<=xt;sa++)ta.push({date:new Date(P,ce,sa),isCurrentMonth:true});let na=42-ta.length;for(let sa=1;sa<=na;sa++)ta.push({date:new Date(P,ce+1,sa),isCurrentMonth:false});return ta},[it]),Ta=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),se(false),!M||!l)return;let ce=Array.from(P.dataTransfer.files);if(ce.length!==0){Y(true);try{await l(M.id,ce);}finally{Y(false);}}},[M,l]),ya=useCallback(async P=>{if(!M||!l||!P.target.files)return;let ce=Array.from(P.target.files);if(ce.length!==0){Y(true);try{await l(M.id,ce);}finally{Y(false);}P.target.value="";}},[M,l]),Le=useCallback(P=>{P.preventDefault(),P.stopPropagation(),se(true);},[]),U=useCallback(P=>{P.preventDefault(),P.stopPropagation(),se(false);},[]),we=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Ot=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]);return !t||!M?null:jsx(AnimatePresence,{children:t&&M&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:p("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:p("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:p("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:p("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:p("text-xs font-mono",F?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let P=M.progress===100?0:100,$e={...M,progress:P,status:P===100?"completed":"todo"};qe($e);},className:p("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",M.progress===100?"bg-green-500 border-green-500":F?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ve,onChange:P=>Z(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:p("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",M.progress===100?"line-through text-[#6B7280]":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:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{ge(),ke(!re);},className:p("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",M.progress===100||M.status==="completed"?"bg-green-500/20 text-green-400":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/20 text-blue-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.progress===100||M.status==="completed"?n==="es"?"COMPLETADO":"DONE":M.progress&&M.progress>0||M.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:re&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ke(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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(P=>jsxs("button",{onClick:()=>Dt(P.id),className:p("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",M.status===P.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:p("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{ge(),pe(!J);},className:p("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:[M.assignees&&M.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[M.assignees.slice(0,3).map((P,ce)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},ce)),M.assignees.length>3&&jsxs("span",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",M.assignees.length-3]})]}):jsx("span",{className:p("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:p("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:()=>pe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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:d.length>0?d.map(P=>{let ce=M.assignees?.some($e=>$e.name===P.name);return jsxs("button",{onClick:()=>{let $e=M.assignees||[],Je;ce?Je=$e.filter(xt=>xt.name!==P.name):Je=[...$e,P],te("assignees",Je);},className:p("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",ce&&(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:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsx("span",{className:p("flex-1",F?"text-white":"text-gray-900"),children:P.name}),ce&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsx("div",{className:p("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:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ze(Be?null:"start"),nt(M.startDate||new Date);},className:p("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:[M.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:p("mx-1",F?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),M.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:p("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:P=>P.stopPropagation(),children:[jsxs("div",{className:p("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,ce=new Date(P);ce.setDate(P.getDate()+1);let $e=new Date(P);$e.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Je=new Date(P);Je.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let xt=new Date(P);xt.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let za=new Date(P);za.setDate(P.getDate()+14);let ta=new Date(P);return ta.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ce,display:ce.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:Je,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:xt,display:xt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:za,display:za.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ta,display:ta.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((na,sa)=>jsxs("button",{className:p("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(Be==="start"){let Wo=M.endDate&&na.date>M.endDate?na.date:M.endDate;gt(na.date,Wo),ze("end");}else {let Wo=M.startDate&&na.date<M.startDate?na.date:M.startDate;gt(Wo,na.date),ze(null);}},children:[jsx("span",{children:na.label}),jsx("span",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:na.display})]},sa))})(),jsx("div",{className:p("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{gt(void 0,void 0),ze(null);},className:p("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:p("text-xs mb-3 px-2 py-1 rounded",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Be==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:p("font-medium",F?"text-white":"text-gray-900"),children:it.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>nt(new Date),className:p("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>nt(new Date(it.getFullYear(),it.getMonth()-1)),className:p("p-1 rounded",F?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>nt(new Date(it.getFullYear(),it.getMonth()+1)),className:p("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(P=>jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ut().map((P,ce)=>{let $e=P.date.toDateString()===new Date().toDateString(),Je=M.startDate?.toDateString()===P.date.toDateString(),xt=M.endDate?.toDateString()===P.date.toDateString(),za=Je||xt,ta=M.startDate&&M.endDate&&P.date>=M.startDate&&P.date<=M.endDate;return jsx("button",{onClick:()=>{let rr=new Date(P.date);if(Be==="start"){let na=M.endDate&&rr>M.endDate?rr:M.endDate;gt(rr,na),ze("end");}else {let na=M.startDate&&rr<M.startDate?rr:M.startDate;gt(na,rr),ze(null);}},className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(F?"text-white":"text-gray-900"),$e&&"ring-2 ring-[#2E94FF]",Je&&"bg-[#2E94FF] text-white",xt&&!Je&&"bg-[#7C3AED] text-white",ta&&!za&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!za&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},ce)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{ge(),q(!O);},className:p("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",M.priority==="high"||M.priority==="urgent"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":M.priority==="low"?"bg-green-500/20 text-green-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.priority?M.priority==="high"||M.priority==="urgent"?n==="es"?"Alta":"High":M.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:O&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>q(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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(P=>jsxs("button",{onClick:()=>{te("priority",P.id),q(false);},className:p("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",M.priority===P.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:p("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:p("text-sm",F?"text-white":"text-gray-900"),children:M.startDate&&M.endDate?`${Math.ceil((M.endDate.getTime()-M.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:p("w-4 h-4 rounded-full border-2",F?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:p("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:[oe?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:M.progress||0,onChange:P=>{let ce=parseInt(P.target.value),$e=M.status;ce===100?$e="completed":ce>0?$e="in-progress":$e="todo";let Je={...M,progress:ce,status:$e};qe(Je);},onBlur:()=>ct(false),className:p("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:()=>ct(true),className:p("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:p("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${M.progress||0}%`}})}),jsxs("span",{className:p("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[M.progress||0,"%"]})]})]}),w&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:M.status==="completed"||M.progress===100?jsx("span",{className:p("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:y?.estimateMinutes?en(y.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):y?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(y.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ot==="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(Ir,{mode:"estimate",locale:n,isDark:F,currentValue:y?.estimateMinutes||null,onSave:async P=>{await L?.(M.id,P),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:de?jsx("span",{className:p("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"}):M.status==="completed"||M.progress===100?jsx("span",{className:p("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:M.quotedMinutes?en(M.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):M.quotedMinutes?jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(M.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ot==="quoted"&&!de&&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(Ir,{mode:"quoted",locale:n,isDark:F,currentValue:M.quotedMinutes||null,onSave:async P=>{B?(await B(M.id,P),W(ce=>ce?{...ce,quotedMinutes:P}:null)):te("quotedMinutes",P),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:[M.status==="completed"||M.progress===100?jsx("div",{className:p("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"})}):C?jsxs("button",{type:"button",onClick:()=>R?.(M.id),className:p("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"}),Wb(D||0)]}):jsx("button",{type:"button",onClick:()=>S?.(M.id),className:p("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"})}),M.status==="completed"||M.progress===100?jsxs("div",{className:p("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:()=>Qe("log"),className:p("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"]}),y&&y.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:p("text-sm font-medium",y.health==="over-budget"?"text-red-500":y.health==="at-risk"?"text-yellow-500":F?"text-white":"text-gray-900"),children:[en(y.loggedMinutes),y.estimateMinutes&&jsxs("span",{className:p("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",en(y.estimateMinutes)]})]}),y.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:p("h-full rounded-full transition-all",y.health==="over-budget"?"bg-red-500":y.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,y.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:ot==="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(Ir,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(P,ce)=>{P&&await T?.(M.id,{durationMinutes:P,note:ce,source:"manual"}),Qe(false);},onClose:()=>Qe(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(oo,{selectedTags:M.tags||[],availableTags:c,onChange:P=>{te("tags",P);},onCreateTag:i,theme:X$1})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:p("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:[M.dependencies&&M.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:M.dependencies.map(P=>{let ce=g.find($e=>$e.id===P);return jsxs("span",{className:p("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:[ce?.name||P.slice(0,8),jsx("button",{onClick:()=>{let $e=(M.dependencies||[]).filter(Je=>Je!==P);te("dependencies",$e);},className:p("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{ge(),yt(!Re);},className:p("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:p("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Re&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{yt(false),pt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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:p("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ft,onChange:P=>pt(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:p("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(P=>P.id!==M.id).filter(P=>ft===""||P.name.toLowerCase().includes(ft.toLowerCase())).map(P=>{let ce=M.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let $e=M.dependencies||[],Je;ce?Je=$e.filter(xt=>xt!==P.id):Je=[...$e,P.id],te("dependencies",Je);},className:p("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",ce&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:p("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ce?"bg-blue-500 border-blue-500":F?"border-white/30":"border-gray-300"),children:ce&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:p("block truncate",F?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:p("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:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{ge(),Xe(!Te);},className:p("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:M.color||"#6366F1"}}),jsx("span",{className:p("text-sm",F?"text-white":"text-gray-900"),children:So.find(P=>P.value===M.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:p("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Xe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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:So.map(P=>{let ce=M.color===P.value;return jsx("button",{onClick:()=>{te("color",P.value),Xe(false);},className:p("w-7 h-7 rounded-full flex items-center justify-center transition-all",ce&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:ce?P.value:void 0},title:P.name,children:ce&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:M.isMilestone||false,onChange:P=>te("isMilestone",P.target.checked),className:p("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",M.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:p("text-sm",F?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:p("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:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:p("text-sm font-semibold",F?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ee,value:ie,onChange:P=>me(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:p("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:p("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:p("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",M.subtasks&&M.subtasks.length>0&&jsxs("span",{className:p("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",M.subtasks.filter(P=>P.progress===100).length,"/",M.subtasks.length,")"]})]})}),M.subtasks&&M.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...M.subtasks].sort((P,ce)=>(P.position??0)-(ce.position??0)).map(P=>jsxs("div",{className:p("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:()=>Pe(P.id),className:p("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":F?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:p("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:P.name}),jsx("button",{onClick:()=>Ye(P.id),className:p("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"})})]},P.id))}),fe?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:It,onChange:P=>z(P.target.value),onKeyDown:P=>{P.key==="Enter"&&It.trim()?Ne():P.key==="Escape"&&(Ce(false),z(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:p("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:Ne,disabled:!It.trim(),className:p("px-3 py-2 rounded-lg text-sm font-medium transition-colors",It.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:()=>{Ce(false),z("");},className:p("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:()=>Ce(true),className:p("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:p("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:p("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:p("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(P=>{let ce=Ot(P.type),$e=P.type.startsWith("image/");return jsxs("div",{className:p("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:[$e&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:p("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsx(ce,{className:p("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:p("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:we(P.size)})]}),m&&jsx("button",{onClick:()=>m(P.id),className:p("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"})})]},P.id)})}),jsxs("div",{onDragOver:Le,onDragLeave:U,onDrop:Ta,className:p("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",N&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:ya,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||N}),N?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:p("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:p("w-6 h-6 mx-auto mb-2",H?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:p("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"})]})}),!l&&jsx("p",{className:p("text-xs mt-1",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:p("w-96 border-l flex flex-col",F?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:p("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",x.length>0&&jsxs("span",{className:p("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",x.length,")"]})]}),jsx("button",{onClick:a,className:p("p-1.5 rounded transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
4
+ `);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=jc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=jc(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((g,x)=>{i[g]=d[x]||"";});let u=i.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let l=o.get(u),m={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.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),l.cardIds.push(m.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function jc(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 Kc(e,t){switch(t){case "json":return yf(e);case "csv":return xf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Yc(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 al=createContext(null);function qc(){return useContext(al)}var Xc=createContext(null);function Jc({children:e,themeName:t}){return jsx(Xc.Provider,{value:{themeName:t},children:e})}function qo(){return useContext(Xc)}function At({children:e,container:t}){let[a,r]=useState(false),o=qc(),s=qo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:d,themeName:c}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return createPortal(jsx("div",{"data-theme":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 au={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Sf="#BDC3C7",Ef=({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 Co({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),d=useRef(null),c=useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,v=160,f=220,h=4,w=g.right-v;w<10&&(w=g.left),w+v>b-10&&(w=b-v-10);let y=x-g.bottom,k=g.top,C;y>=f+h?C=g.bottom+h:k>=f+h?C=g.top-f-h:C=y>=k?g.bottom+h:Math.max(10,g.top-f-h),n({top:C,left:w}),o(true);};useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&!c.current?.contains(x.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=x=>{x.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),o(false);},l=e?au[e]:null,m=l?.color||Sf;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:l?.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(At,{children:jsxs("div",{ref:d,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(au).map(([g,x])=>jsxs("button",{onClick:()=>u(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:x.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(Ef,{color:x.color}),jsx("span",{className:"font-semibold text-sm",children:x.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:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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 Ff=[{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 Sn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),m=(qo()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let w=i.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,C=320,D=380,T=4,L=w.left;L+C>k-10&&(L=k-C-10),L<10&&(L=10);let B=y-w.bottom,S=w.top,R;B>=D+T?R=w.bottom+T:S>=D+T?R=w.top-D-T:R=B>=S?w.bottom+T:Math.max(10,w.top-D-T),d({top:R,left:L}),s(true);};useEffect(()=>{let w=y=>{c.current&&!c.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),useEffect(()=>{let w=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let x=w=>{let y=new Date,k=L=>{let B=L.getFullYear(),S=String(L.getMonth()+1).padStart(2,"0"),R=String(L.getDate()).padStart(2,"0");return `${B}-${S}-${R}`},C=k(y),D=new Date(y);D.setDate(D.getDate()+w);let T=k(D);a(C,T),s(false);},b=()=>{if(!e||!t)return "Set date";let w=D=>{if(D instanceof Date)return D;if(typeof D!="string"||!D.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=D.split("-").map(Number);if(T.length!==3||T.some(R=>isNaN(R)))return null;let L=T[0],B=T[1],S=T[2];return L===void 0||B===void 0||S===void 0?null:new Date(L,B-1,S)},y=w(e),k=w(t);if(!y||!k||isNaN(y.getTime())||isNaN(k.getTime()))return "Set date";let C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${C[y.getMonth()]} ${y.getDate()} \u2013 ${C[k.getMonth()]} ${k.getDate()}`},v=e&&t,h=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),w<y})();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 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:v?`${b()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:b()})]}),o&&jsx(At,{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:Ff.map(w=>jsx("button",{onClick:()=>x(w.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:y=>{y.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",y.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:y=>{y.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",y.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color: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:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function No({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[d,c]=useState(""),[i,u]=useState({top:0,left:0}),l=useRef(null),m=useRef(null),g=()=>{if(!m.current)return;let h=m.current.getBoundingClientRect(),w=window.innerHeight,y=window.innerWidth,k=300,C=380,D=4,T=h.right-k;T<10&&(T=h.left),T+k>y-10&&(T=y-k-10);let L=w-h.bottom,B=h.top,S;L>=C+D?S=h.bottom+D:B>=C+D?S=h.top-C-D:S=L>=B?h.bottom+D:Math.max(10,h.top-C-D),u({top:S,left:T}),n(true);};useEffect(()=>{let h=w=>{l.current&&!l.current.contains(w.target)&&!m.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let x=h=>{let w=e.some(y=>y.id===h.id);a(w?e.filter(y=>y.id!==h.id):[...e,h]);},b=t.filter(h=>h.name.toLowerCase().includes(d.toLowerCase())),v=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:[v.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.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(At,{children:jsxs("div",{ref:l,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:d,onChange:h=>c(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:b.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):b.map(h=>{let w=e.some(y=>y.id===h.id);return jsxs("button",{onClick:()=>x(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:y=>{y.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:h.color,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.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:h.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},h.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 Cs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let l=u;return l.taskId||l.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,d=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let u of i){if(!s.has(u)&&d(u))return true;if(n.has(u))return true}}return n.delete(c),false};return d(a)}function Fn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,c]=useState(false),[i,u]=useState(""),[l,m]=useState(t.length>0),[g,x]=useState({top:0,left:0}),[b,v]=useState(null),f=useRef(null),h=useRef(null),w=()=>{if(!h.current)return;let T=h.current.getBoundingClientRect(),L=window.innerHeight,B=window.innerWidth,S=300,R=l?380:120,$=4,de=T.right-S;de<10&&(de=T.left),de+S>B-10&&(de=B-S-10);let F=L-T.bottom,X=T.top,xe;F>=R+$?xe=T.bottom+$:X>=R+$?xe=T.top-R-$:xe=F>=X?T.bottom+$:Math.max(10,T.top-R-$),x({top:xe,left:de}),c(true);};useEffect(()=>{if(!d||!h.current)return;let T=h.current.getBoundingClientRect(),L=window.innerHeight,B=window.innerWidth,S=300,R=l?380:120,$=4,de=T.right-S;de<10&&(de=T.left),de+S>B-10&&(de=B-S-10);let F=L-T.bottom,X=T.top,xe;F>=R+$?xe=T.bottom+$:X>=R+$?xe=T.top-R-$:xe=F>=X?T.bottom+$:Math.max(10,T.top-R-$),x({top:xe,left:de});},[l,d]),useEffect(()=>{let T=L=>{f.current&&!f.current.contains(L.target)&&!h.current?.contains(L.target)&&(c(false),u(""));};if(d)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[d]),useEffect(()=>{let T=L=>{L.key==="Escape"&&(c(false),u(""));};if(d)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[d]);let y=T=>{let L=t.includes(T),B=a.find(S=>S.id===T);if(v(null),L){let S=t.filter(R=>R!==T);r(S),S.length===0&&m(false);}else {if(s&&Cs(a,T,e)){let R=`Cannot add "${B?.title||T}" as dependency - would create circular reference`;v(R),n?.(T,B?.title||T),setTimeout(()=>v(null),3e3);return}r([...t,T]),m(true);}},k=()=>{let T=!l;m(T),T||r([]);},C=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),D=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:h,onClick:()=>d?c(false):w(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:D,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:D},children:t.length})]}),d&&jsx(At,{children:jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[b&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:b})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&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"})]})}),l&&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:T=>u(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:C.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):C.map(T=>{let L=t.includes(T.id);return jsxs("button",{onClick:()=>y(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:B=>{B.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:B=>{B.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:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),m(false),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 Vr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:l,transform:m,transition:g,isDragging:x}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:xs.Transform.toString(m),transition:g};if(t)return jsx("div",{ref:l,style:b,...i,...u,onClick:()=>a?.(e),children:t(e)});let v=d.filter(y=>e.assignedUserIds?.includes(y.id)),f=e.progress===100,h=(e.attachments||[]).filter(y=>y.type.startsWith("image/")),w={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:l,style:w,className:p("asakaa-card",x&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:y=>{y.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:y=>{y.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[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:y=>{y.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((y,k)=>jsxs("div",{className:"relative",children:[jsx("img",{src:y.url,alt:y.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:C=>{C.currentTarget.style.display="none";}}),k===3&&h.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:["+",h.length-4]})})]},y.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:y=>y.stopPropagation(),className:"priority-selector",children:jsx(Co,{priority:e.priority,onChange:y=>n?.(e.id,{priority:y})})}),jsx("div",{onClick:y=>y.stopPropagation(),className:"date-picker",children:jsx(Sn,{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:(y,k)=>n?.(e.id,{startDate:y,endDate:k})})}),d.length>0&&jsx("div",{onClick:y=>y.stopPropagation(),className:"user-selector",children:jsx(No,{assignedUsers:v,availableUsers:d,onChange:y=>n?.(e.id,{assignedUserIds:y.map(k=>k.id)})})}),jsx("div",{onClick:y=>y.stopPropagation(),className:"dependencies-selector",children:jsx(Fn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(y=>typeof y=="string"?y:y.taskId):[],availableTasks:c,onChange:y=>n?.(e.id,{dependencies:y})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(y=>jsx("span",{className:"asakaa-label",children:y},y))}),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)));Vr.displayName="Card";var Ts={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 mu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),u=[...Object.entries(Ts).map(([v,f])=>({id:v,label:f.label,color:f.color,icon:f.icon})),...r.filter(v=>!Object.keys(Ts).includes(v.id)).map(v=>({id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let v=Ts[e];if(v)return {...v,id:e};let f=r.find(h=>h.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ts.todo,id:"todo"}},m=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),f=window.innerHeight,h=window.innerWidth,w=180,y=280,k=4,C=v.right-w;C<10&&(C=v.left),C+w>h-10&&(C=h-w-10);let D=f-v.bottom,T=v.top,L;D>=y+k?L=v.bottom+k:T>=y+k?L=v.top-y-k:L=D>=T?v.bottom+k:Math.max(10,v.top-y-k),d({top:L,left:C}),s(true);};useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{let v=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[o]);let g=v=>{t(v),s(false);},x=l(),b=x.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:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:x.label,children:jsx(pu,{icon:x.icon,color:b})}),o&&jsx(At,{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:u.map(v=>jsxs("button",{onClick:()=>g(v.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(pu,{icon:v.icon,color:v.color}),jsx("span",{className:"font-semibold",children:v.label}),e===v.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},v.id))})]})})]})}var gu={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 fu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=gu[s]||gu.en,[d,c]=useState(false),[i,u]=useState(false),[l,m]=useState(e),[g,x]=useState({top:0,left:0}),b=useRef(null),v=useRef(null),f=useRef(null);useEffect(()=>{if(d&&v.current){let k=v.current.getBoundingClientRect();x({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[d]),useEffect(()=>{let k=C=>{b.current&&!b.current.contains(C.target)&&!v.current?.contains(C.target)&&(c(false),u(false));};if(d)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[d]),useEffect(()=>{let k=C=>{C.key==="Escape"&&(c(false),u(false),m(e));};if(d)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[d,e]),useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let h=()=>{u(true),m(e);},w=()=>{let k=l.trim();k&&k!==e&&t(k),u(false),c(false),m(e);},y=k=>{k.key==="Enter"?w():k.key==="Escape"&&(u(false),m(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>c(!d),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),d&&jsx(At,{children:jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children: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:l,onChange:k=>m(k.target.value),onKeyDown:y,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,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 Qo=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:l=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:x,onColumnDelete:b,isDeletable:v=false,className:f,renderMetrics:h,locale:w})=>{let{setNodeRef:y,isOver:k}=useDroppable({id:e.id,data:{type:"column",column:e}}),C=useRef(null),D=u??zc(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>C.current,estimateSize:()=>l,enabled:D});if(a)return jsx("div",{ref:y,className:f,children:a(e,t)});let B=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let $=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:$}:$>=80?{state:"warning",percentage:$}:$>=60?{state:"approaching",percentage:$}:{state:"ok",percentage:$}})(),S=B.state==="exceeded",R=()=>"asakaa-column-count";return jsxs("div",{ref:y,className:p("asakaa-column",k&&"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:p(R()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&B.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${B.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[B.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"})]}),B.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"})]}),B.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"})}),B.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"})]})]}),(x||b)&&jsx(fu,{columnTitle:e.title,onRename:$=>x?.(e.id,$),onDelete:b?()=>b(e.id):void 0,isDeletable:v,locale:w}),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"})]})]}),h&&h(e,t),!m&&jsx("div",{ref:C,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsx(SortableContext,{items:t.map($=>$.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"})}):D?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map($=>{let de=t[$.index];return de?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${$.start}px)`},children:jsx(Vr,{card:de,render:r,onClick:n,onUpdate:d,availableUsers:c,allCards:i})},de.id):null})}):t.map($=>jsx(Vr,{card:$,render:r,onClick:n,onUpdate:d,availableUsers:c,allCards:i},$.id))})})]})});Qo.displayName="Column";function il({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),d=useRef(null);useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):n(e),o(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:d,type:"text",value:s,onChange:u=>n(u.target.value),onBlur:c,onKeyDown:i,className:p("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:p("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function qf(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function wu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let c=d.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Xf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Jf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Qf=["\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 ku({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:l=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:x,maxFileSizeMB:b=10}){let v=d==="dark",[f,h]=useState(false),[w,y]=useState([]),[k,C]=useState(0),[D,T]=useState(null),[L,B]=useState(false),S=useRef(null),R=useRef(null),$=useRef(null),de=useRef(null),F=useCallback((O,q)=>{let J=qf(O,q);if(T(J),J){let pe=r.filter(Be=>Be.name.toLowerCase().includes(J.query)||Be.email&&Be.email.toLowerCase().includes(J.query)).slice(0,5);y(pe),h(pe.length>0),C(0);}else h(false),y([]);},[r]),X$1=O=>{let q=O.target.value;if(t(q),F(q,O.target.selectionStart||0),S.current){S.current.style.height="24px";let J=S.current.scrollHeight,pe=280,Be=Math.min(J,pe);S.current.style.height=`${Be}px`,S.current.style.overflowY=J>pe?"auto":"hidden";}},xe=()=>{S.current&&F(e,S.current.selectionStart||0);},_e=useCallback(O=>{if(!D||!S.current)return;let q=e.slice(0,D.start),J=e.slice(D.end),pe=`@${O.name.replace(/\s+/g,"")} `,Be=q+pe+J;t(Be),h(false),T(null),setTimeout(()=>{if(S.current){let ze=D.start+pe.length;S.current.selectionStart=ze,S.current.selectionEnd=ze,S.current.focus();}},0);},[D,e,t]),M=O=>{if(f&&w.length>0)switch(O.key){case "ArrowDown":O.preventDefault(),C(q=>q<w.length-1?q+1:0);break;case "ArrowUp":O.preventDefault(),C(q=>q>0?q-1:w.length-1);break;case "Enter":{O.preventDefault();let q=w[k];q&&_e(q);break}case "Tab":{O.preventDefault();let q=w[k];q&&_e(q);break}case "Escape":O.preventDefault(),h(false);break}else O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),a());};useEffect(()=>{let O=q=>{R.current&&!R.current.contains(q.target)&&S.current&&!S.current.contains(q.target)&&h(false),de.current&&!de.current.contains(q.target)&&B(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let W=useCallback(O=>{if(!S.current)return;let q=S.current.selectionStart||e.length,J=e.slice(0,q)+O+e.slice(q);t(J),B(false),setTimeout(()=>{if(S.current){let pe=q+O.length;S.current.selectionStart=pe,S.current.selectionEnd=pe,S.current.focus();}},0);},[e,t]),re=useCallback(O=>{if(!g||!O.target.files)return;let q=Array.from(O.target.files),J=b*1024*1024,pe=q.filter(Be=>Be.size>J?(console.warn(`File ${Be.name} exceeds max size of ${b}MB`),false):true);pe.length>0&&g(pe),O.target.value="";},[g,b]),Ce=useCallback(O=>O.type.startsWith("image/")?Image:O.type.includes("pdf")||O.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&R.current){let O=R.current.children[k];O&&O.scrollIntoView({block:"nearest"});}},[k,f]),jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:m.map(O=>{let q=Ce(O.file),J=O.file.type.startsWith("image/");return jsxs("div",{className:p("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",v?"bg-white/10":"bg-gray-100"),children:[J&&O.preview?jsx("img",{src:O.preview,alt:O.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(q,{className:p("w-4 h-4",v?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:p("text-xs truncate",v?"text-white":"text-gray-900"),children:O.file.name}),jsx("p",{className:p("text-xs",v?"text-[#6B7280]":"text-gray-400"),children:Jf(O.file.size)})]}),x&&jsx("button",{onClick:()=>x(O.id),className:p("p-0.5 rounded-full transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},O.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:p("flex-1 relative min-w-0"),children:[jsxs("div",{className:p("flex items-end gap-1 px-2 py-2 rounded-lg",v?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>B(!L),disabled:s||n,className:p("p-1 rounded transition-colors flex-shrink-0",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:L&&jsx(motion.div,{ref:de,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Qf.map(O=>jsx("button",{type:"button",onClick:()=>W(O),className:p("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",v?"hover:bg-white/10":"hover:bg-gray-100"),children:O},O))})})})]}),l&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||n,className:p("p-1.5 rounded transition-colors",v?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:$,type:"file",multiple:true,onChange:re,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:S,value:e,onChange:X$1,onSelect:xe,onKeyDown:M,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:p("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",v?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:p("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":v?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:f&&w.length>0&&jsx(motion.div,{ref:R,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:p("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",v?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:w.map((O,q)=>jsxs("button",{type:"button",onClick:()=>_e(O),className:p("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",q===k?v?"bg-white/10":"bg-gray-100":v?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:O.color||"#8B5CF6"},children:Xf(O.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:p("text-sm font-medium truncate",v?"text-white":"text-gray-900"),children:O.name}),O.email&&jsx("p",{className:p("text-xs truncate",v?"text-[#6B7280]":"text-gray-500"),children:O.email})]})]},O.id))})})]})]})]})}function Cu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((d,c)=>d.type==="mention"?jsx("span",{className:p("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},c):jsx("span",{children:d.value},c))})}var Fs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function oo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,c]=useState(false),[i,u]=useState(""),[l,m]=useState(false),[g,x]=useState(Fs[10]||"#2E94FF"),[b,v]=useState({top:0,left:0}),f=useRef(null),h=useRef(null),w=useRef(null),y=useRef(null),k=t.filter(S=>S.name.toLowerCase().includes(i.toLowerCase())),C=t.some(S=>S.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(d&&h.current){let S=h.current.getBoundingClientRect();v({top:S.bottom+6,left:S.left});}},[d]),useEffect(()=>{let S=R=>{let $=R.target,de=f.current?.contains($),F=w.current?.contains($);!de&&!F&&(c(false),u(""),m(false));};if(d)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[d]),useEffect(()=>{d&&y.current&&y.current.focus();},[d]);let D=S=>{let R=e.some($=>$.id===S.id);a(R?e.filter($=>$.id!==S.id):[...e,S]);},T=async()=>{if(!(!r||!i.trim())){m(true);try{let S=await r(i.trim(),g);S&&(a([...e,S]),u(""),x(Fs[Math.floor(Math.random()*Fs.length)]||"#2E94FF"));}finally{m(false);}}},L=(S,R)=>{R.stopPropagation(),a(e.filter($=>$.id!==S));},B={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&c(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:B,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:d&&jsxs(motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:b.top,left:b.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:y,type:"text",value:i,onChange:S=>u(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()&&!C&&r&&T();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(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:R=>L(S.id,R),children:[S.name,jsx(X,{className:"w-3 h-3"})]},S.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(S=>{let R=e.some($=>$.id===S.id);return jsxs("button",{type:"button",onClick:()=>D(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:R?`${S.color}15`:"transparent",color:o.textPrimary},onMouseEnter:$=>{R||($.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:$=>{R||($.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}),R&&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()&&!C&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Fs.map(S=>jsx("button",{type:"button",onClick:()=>x(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:T,disabled:l,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:l?.7:1},children:[l?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 dl({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 Nu({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(dl,{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 So=[{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 Du(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function ib(e){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 lb({className:e}){return jsxs("svg",{className:p("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 cl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=ib(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Du(e.loggedMinutes),i=e.estimateMinutes?Du(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:p("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(lb,{className:d[t]}),jsx("span",{children:u})]})}function Eu(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function Ms(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function ub(e){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 pb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function mb({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 Fu({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 gb({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 ul({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:d,onStopTimer:c,onDiscardTimer:i,onClose:u,className:l}){let[m,g]=useState(""),[x,b]=useState(t.estimateMinutes?Ms(t.estimateMinutes):""),[v,f]=useState(""),[h,w]=useState(false),[y,k]=useState(false),C=useRef(null);useEffect(()=>{C.current?.focus();},[]);let D=async()=>{let B=Eu(m);if(!(B<=0||!s)){w(true);try{await s({durationMinutes:B,note:v.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},T=async()=>{if(!n)return;let B=x.trim()?Eu(x):null;await n(B),k(false);},L=B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),D()),B.key==="Escape"&&u?.();};return jsxs("div",{className:p("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",l),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Fu,{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:ub(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(mb,{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(Fu,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:d,className:p("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(pb,{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(gb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:C,type:"text",value:m,onChange:B=>g(B.target.value),onKeyDown:L,placeholder:"8 (=8h), 2h 30m",className:p("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:D,disabled:h||!m.trim(),className:p("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:v,onChange:B=>f(B.target.value),onKeyDown:L,placeholder:"Note (optional)",className:p("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:Ms(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"}),y?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:x,onChange:B=>b(B.target.value),onKeyDown:B=>{B.key==="Enter"&&T(),B.key==="Escape"&&k(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Ms(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:p("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:p("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(B=>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:B.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ms(B.durationMinutes)})]},B.id))})]})]})}function xb(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function vb(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 Ir({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[d,c]=useState(vb(r)),[i,u]=useState(""),[l,m]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let x=async()=>{m(true);let w=xb(d);await o(w&&w>0?w:null,i||void 0),m(false);},b=async()=>{m(true),await o(null),m(false);},v=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),x()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:p("w-56",n),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:w=>w.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#2E94FF"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:g,type:"text",value:d,onChange:w=>c(w.target.value),onKeyDown:v,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 2:30"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:w=>u(w.target.value),onKeyDown:v,placeholder:h?"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:x,disabled:l||!d.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:l?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:b,disabled:l,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:h?"Quitar":"Clear"})]})]})}function wb(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 ml({summary:e,showLabel:t=false,size:a="md",className:r}){let o=wb(e.health),s=kb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},d=e.progressPercent??0,c=Math.min(100,d),i=d>100;return e.health==="no-estimate"?jsxs("div",{className:p("flex items-center gap-2",r),children:[jsx("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:p("h-full w-1/4",o)})}),t&&jsx("span",{className:p("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:p("flex items-center gap-2",r),children:[jsxs("div",{className:p("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:p("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:p("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[d,"%"]})]})}function Zo(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 Tb(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 Nb(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 Db(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 Sb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",d=a?"text-[#9CA3AF]":"text-gray-500",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:p("p-4 rounded-lg border",s,n),children:[jsx("div",{className:p("text-sm font-medium mb-1",d),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:p("text-2xl font-bold",o),children:[r?"+":"",Zo(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:p("text-xs mt-1",d),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsx("div",{className:p("text-sm font-medium mb-2",d),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:p("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:p("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:p("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:p("p-4 rounded-lg border",s,n),children:[jsx("div",{className:p("text-sm font-medium mb-2",d),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:d,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:p("font-medium",c),children:Zo(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:d,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:p("font-medium",c),children:Zo(e.totalLoggedMinutes)})]}),jsxs("div",{className:p("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:d,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:p("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Eb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",d=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:p("border-b",s,r&&p("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:p("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:p("text-xs mt-1",d),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Zo(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:Zo(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:p("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":d),children:[o,Zo(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:p("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":d),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:p("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Nb(e.status,a),Tb(e.status,a)),children:Db(e.status,t)})})]})}function gl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",d=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",u=n?"text-white/[0.92]":"text-gray-900",l=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((x,b)=>x.varianceMinutes===null?1:b.varianceMinutes===null?-1:b.varianceMinutes-x.varianceMinutes):[],[e]);return t?jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:p("p-8 text-center",l,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:p("space-y-6 p-6",d,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:p("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:p("text-sm mt-1",l),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Sb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:p("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:p("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:"%"}),jsx("th",{className:p("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:p("divide-y",i),children:g.map(x=>jsx(Eb,{task:x,locale:a,isDark:n,onClick:s},x.taskId))})]})})}),jsx("div",{className:p("text-xs text-center",l),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 en(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 Wb(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 Hu(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 Gb(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 jr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:l,onDeleteAttachment:m,availableTasks:g=[],comments:x=[],onAddComment:b,currentUser:v,mentionableUsers:f=[],onUploadCommentAttachments:h,enableTimeTracking:w=false,timeTrackingSummary:y,timeEntries:k=[],isTimerRunning:C=false,timerElapsedSeconds:D=0,onTimeLog:T,onEstimateUpdate:L,onSoldEffortUpdate:B,onTimerStart:S,onTimerStop:R,onTimerDiscard:$,blurFinancials:de=false}){let F=s==="dark",X$1={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)"},xe=e&&"title"in e&&!("name"in e),_e=e,[M,W]=useState(e?Hu(e,d):null),[re,Ce]=useState(false),[O,q]=useState(false),[J,pe]=useState(false),[Be,ze]=useState(null),[it,nt]=useState(new Date),[oe,ct]=useState(false),[Re,yt]=useState(false),[ft,pt]=useState(""),[Te,Xe]=useState(false),[ot,Qe]=useState(false),[H,se]=useState(false),[N,Y]=useState(false),[ie,he]=useState(""),_=useRef(null),ee=useRef(null),[Ve,ve]=useState(""),Ue=useRef(null),[Se,He]=useState(""),[lt,st]=useState(false),[dt,mt]=useState([]),[It,z]=useState(""),[fe,we]=useState(false),Ke=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=Hu(e,d);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),W(P),he(P.description||""),ve(P.name||"");}},[e?.id,e?.quotedMinutes,d,t]),useEffect(()=>{if(!t||!ie)return;let P=setTimeout(()=>{let ce=ee.current;ce&&(ce.style.height="auto",ce.style.height=`${Math.max(100,ce.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,ie]),useEffect(()=>()=>{_.current&&clearTimeout(_.current),Ue.current&&clearTimeout(Ue.current);},[]),useEffect(()=>{t&&Ke.current&&x.length>0&&setTimeout(()=>{Ke.current&&(Ke.current.scrollTop=Ke.current.scrollHeight);},100);},[t,x.length]);let qe=useCallback(P=>{W(P),xe&&o&&_e?o(Gb(P,_e)):r&&r(P);},[xe,_e,o,r]),ge=useCallback(()=>{Ce(false),q(false),pe(false),ze(null),yt(false),pt(""),Xe(false);},[]),te=useCallback((P,ce)=>{if(!M)return;let $e={...M,[P]:ce};qe($e);},[M,qe]),V=useCallback(()=>{let P=ee.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),me=useCallback(P=>{he(P),setTimeout(V,0),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{if(M){let ce={...M,description:P};qe(ce);}},800);},[M,qe,V]),Z=useCallback(P=>{ve(P),Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(()=>{if(M&&P.trim()){let ce={...M,name:P.trim()};qe(ce);}},800);},[M,qe]),A=useCallback(P=>{let ce=P.map($e=>{let Je={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:$e};return $e.type.startsWith("image/")&&(Je.preview=URL.createObjectURL($e)),Je});mt($e=>[...$e,...ce]);},[]),j=useCallback(P=>{mt(ce=>{let $e=ce.find(Je=>Je.id===P);return $e?.preview&&URL.revokeObjectURL($e.preview),ce.filter(Je=>Je.id!==P)});},[]),ae=useCallback(async()=>{if(!(!M||!Se.trim()&&dt.length===0||!b)){st(true);try{let P=wu(Se,f),ce=[];if(dt.length>0&&h){let $e=dt.map(Je=>Je.file);ce=await h($e);}await b(M.id,Se.trim(),P.length>0?P:void 0,ce.length>0?ce:void 0),He(""),dt.forEach($e=>{$e.preview&&URL.revokeObjectURL($e.preview);}),mt([]);}finally{st(false);}}},[M,Se,dt,b,f,h]),Ne=useCallback(()=>{if(!M||!It.trim())return;let P=M.subtasks||[],ce={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:It.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},$e=[...P,ce],Je={...M,subtasks:$e};qe(Je),z(""),we(false);},[M,It,qe]),Pe=useCallback(P=>{if(!M?.subtasks)return;let ce=M.subtasks.map(Je=>Je.id===P?{...Je,progress:Je.progress===100?0:100}:Je),$e={...M,subtasks:ce};qe($e);},[M,qe]),Ye=useCallback(P=>{if(!M?.subtasks)return;let ce=M.subtasks.filter(Je=>Je.id!==P),$e={...M,subtasks:ce};qe($e);},[M,qe]),Oe=useCallback(P=>{let ce=typeof P=="string"?new Date(P):P,Je=new Date().getTime()-ce.getTime(),xt=Math.floor(Je/6e4),za=Math.floor(Je/36e5),ta=Math.floor(Je/864e5);return xt<1?n==="es"?"Ahora":"Just now":xt<60?n==="es"?`Hace ${xt} min`:`${xt}m ago`:za<24?n==="es"?`Hace ${za}h`:`${za}h ago`:ta<7?n==="es"?`Hace ${ta}d`:`${ta}d ago`:ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Dt=useCallback(P=>{if(!M)return;let ce=M.progress||0;P==="completed"?ce=100:P==="in-progress"&&ce===0?ce=10:P==="todo"&&(ce=0);let $e={...M,status:P,progress:ce};qe($e),Ce(false);},[M,qe]),gt=useCallback((P,ce)=>{if(!M)return;let $e={...M,startDate:P,endDate:ce};qe($e);},[M,qe]),Ut=useCallback(()=>{let P=it.getFullYear(),ce=it.getMonth(),$e=new Date(P,ce,1),xt=new Date(P,ce+1,0).getDate(),za=$e.getDay(),ta=[],rr=new Date(P,ce,0).getDate();for(let sa=za-1;sa>=0;sa--)ta.push({date:new Date(P,ce-1,rr-sa),isCurrentMonth:false});for(let sa=1;sa<=xt;sa++)ta.push({date:new Date(P,ce,sa),isCurrentMonth:true});let na=42-ta.length;for(let sa=1;sa<=na;sa++)ta.push({date:new Date(P,ce+1,sa),isCurrentMonth:false});return ta},[it]),Ta=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),se(false),!M||!l)return;let ce=Array.from(P.dataTransfer.files);if(ce.length!==0){Y(true);try{await l(M.id,ce);}finally{Y(false);}}},[M,l]),ya=useCallback(async P=>{if(!M||!l||!P.target.files)return;let ce=Array.from(P.target.files);if(ce.length!==0){Y(true);try{await l(M.id,ce);}finally{Y(false);}P.target.value="";}},[M,l]),Le=useCallback(P=>{P.preventDefault(),P.stopPropagation(),se(true);},[]),U=useCallback(P=>{P.preventDefault(),P.stopPropagation(),se(false);},[]),ke=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Ot=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]);return !t||!M?null:jsx(AnimatePresence,{children:t&&M&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:p("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:p("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:p("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:p("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:p("text-xs font-mono",F?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let P=M.progress===100?0:100,$e={...M,progress:P,status:P===100?"completed":"todo"};qe($e);},className:p("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",M.progress===100?"bg-green-500 border-green-500":F?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:M.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ve,onChange:P=>Z(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:p("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",M.progress===100?"line-through text-[#6B7280]":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:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{ge(),Ce(!re);},className:p("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",M.progress===100||M.status==="completed"?"bg-green-500/20 text-green-400":M.progress&&M.progress>0||M.status==="in-progress"?"bg-blue-500/20 text-blue-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.progress===100||M.status==="completed"?n==="es"?"COMPLETADO":"DONE":M.progress&&M.progress>0||M.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:re&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ce(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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(P=>jsxs("button",{onClick:()=>Dt(P.id),className:p("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",M.status===P.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:p("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{ge(),pe(!J);},className:p("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:[M.assignees&&M.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[M.assignees.slice(0,3).map((P,ce)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},ce)),M.assignees.length>3&&jsxs("span",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",M.assignees.length-3]})]}):jsx("span",{className:p("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:p("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:()=>pe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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:d.length>0?d.map(P=>{let ce=M.assignees?.some($e=>$e.name===P.name);return jsxs("button",{onClick:()=>{let $e=M.assignees||[],Je;ce?Je=$e.filter(xt=>xt.name!==P.name):Je=[...$e,P],te("assignees",Je);},className:p("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",ce&&(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:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsx("span",{className:p("flex-1",F?"text-white":"text-gray-900"),children:P.name}),ce&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsx("div",{className:p("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:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ze(Be?null:"start"),nt(M.startDate||new Date);},className:p("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:[M.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:p("mx-1",F?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),M.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:p("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:P=>P.stopPropagation(),children:[jsxs("div",{className:p("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,ce=new Date(P);ce.setDate(P.getDate()+1);let $e=new Date(P);$e.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let Je=new Date(P);Je.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let xt=new Date(P);xt.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let za=new Date(P);za.setDate(P.getDate()+14);let ta=new Date(P);return ta.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ce,display:ce.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:Je,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:xt,display:xt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:za,display:za.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ta,display:ta.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((na,sa)=>jsxs("button",{className:p("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(Be==="start"){let Wo=M.endDate&&na.date>M.endDate?na.date:M.endDate;gt(na.date,Wo),ze("end");}else {let Wo=M.startDate&&na.date<M.startDate?na.date:M.startDate;gt(Wo,na.date),ze(null);}},children:[jsx("span",{children:na.label}),jsx("span",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:na.display})]},sa))})(),jsx("div",{className:p("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{gt(void 0,void 0),ze(null);},className:p("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:p("text-xs mb-3 px-2 py-1 rounded",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Be==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:p("font-medium",F?"text-white":"text-gray-900"),children:it.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>nt(new Date),className:p("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>nt(new Date(it.getFullYear(),it.getMonth()-1)),className:p("p-1 rounded",F?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>nt(new Date(it.getFullYear(),it.getMonth()+1)),className:p("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(P=>jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ut().map((P,ce)=>{let $e=P.date.toDateString()===new Date().toDateString(),Je=M.startDate?.toDateString()===P.date.toDateString(),xt=M.endDate?.toDateString()===P.date.toDateString(),za=Je||xt,ta=M.startDate&&M.endDate&&P.date>=M.startDate&&P.date<=M.endDate;return jsx("button",{onClick:()=>{let rr=new Date(P.date);if(Be==="start"){let na=M.endDate&&rr>M.endDate?rr:M.endDate;gt(rr,na),ze("end");}else {let na=M.startDate&&rr<M.startDate?rr:M.startDate;gt(na,rr),ze(null);}},className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(F?"text-white":"text-gray-900"),$e&&"ring-2 ring-[#2E94FF]",Je&&"bg-[#2E94FF] text-white",xt&&!Je&&"bg-[#7C3AED] text-white",ta&&!za&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!za&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},ce)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{ge(),q(!O);},className:p("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",M.priority==="high"||M.priority==="urgent"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":M.priority==="low"?"bg-green-500/20 text-green-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:M.priority?M.priority==="high"||M.priority==="urgent"?n==="es"?"Alta":"High":M.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:O&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>q(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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(P=>jsxs("button",{onClick:()=>{te("priority",P.id),q(false);},className:p("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",M.priority===P.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:p("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:p("text-sm",F?"text-white":"text-gray-900"),children:M.startDate&&M.endDate?`${Math.ceil((M.endDate.getTime()-M.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:p("w-4 h-4 rounded-full border-2",F?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:p("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:[oe?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:M.progress||0,onChange:P=>{let ce=parseInt(P.target.value),$e=M.status;ce===100?$e="completed":ce>0?$e="in-progress":$e="todo";let Je={...M,progress:ce,status:$e};qe(Je);},onBlur:()=>ct(false),className:p("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:()=>ct(true),className:p("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:p("h-full rounded-full transition-all",M.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${M.progress||0}%`}})}),jsxs("span",{className:p("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[M.progress||0,"%"]})]})]}),w&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:M.status==="completed"||M.progress===100?jsx("span",{className:p("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:y?.estimateMinutes?en(y.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):y?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(y.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Qe("estimate"),className:p("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ot==="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(Ir,{mode:"estimate",locale:n,isDark:F,currentValue:y?.estimateMinutes||null,onSave:async P=>{await L?.(M.id,P),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:de?jsx("span",{className:p("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"}):M.status==="completed"||M.progress===100?jsx("span",{className:p("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:M.quotedMinutes?en(M.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):M.quotedMinutes?jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:en(M.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Qe("quoted"),className:p("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ot==="quoted"&&!de&&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(Ir,{mode:"quoted",locale:n,isDark:F,currentValue:M.quotedMinutes||null,onSave:async P=>{B?(await B(M.id,P),W(ce=>ce?{...ce,quotedMinutes:P}:null)):te("quotedMinutes",P),Qe(false);},onClose:()=>Qe(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:[M.status==="completed"||M.progress===100?jsx("div",{className:p("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"})}):C?jsxs("button",{type:"button",onClick:()=>R?.(M.id),className:p("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"}),Wb(D||0)]}):jsx("button",{type:"button",onClick:()=>S?.(M.id),className:p("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"})}),M.status==="completed"||M.progress===100?jsxs("div",{className:p("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:()=>Qe("log"),className:p("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"]}),y&&y.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:p("text-sm font-medium",y.health==="over-budget"?"text-red-500":y.health==="at-risk"?"text-yellow-500":F?"text-white":"text-gray-900"),children:[en(y.loggedMinutes),y.estimateMinutes&&jsxs("span",{className:p("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",en(y.estimateMinutes)]})]}),y.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:p("h-full rounded-full transition-all",y.health==="over-budget"?"bg-red-500":y.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,y.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:ot==="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(Ir,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(P,ce)=>{P&&await T?.(M.id,{durationMinutes:P,note:ce,source:"manual"}),Qe(false);},onClose:()=>Qe(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(oo,{selectedTags:M.tags||[],availableTags:c,onChange:P=>{te("tags",P);},onCreateTag:i,theme:X$1})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:p("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:[M.dependencies&&M.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:M.dependencies.map(P=>{let ce=g.find($e=>$e.id===P);return jsxs("span",{className:p("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:[ce?.name||P.slice(0,8),jsx("button",{onClick:()=>{let $e=(M.dependencies||[]).filter(Je=>Je!==P);te("dependencies",$e);},className:p("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{ge(),yt(!Re);},className:p("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:p("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Re&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{yt(false),pt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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:p("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ft,onChange:P=>pt(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:p("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(P=>P.id!==M.id).filter(P=>ft===""||P.name.toLowerCase().includes(ft.toLowerCase())).map(P=>{let ce=M.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let $e=M.dependencies||[],Je;ce?Je=$e.filter(xt=>xt!==P.id):Je=[...$e,P.id],te("dependencies",Je);},className:p("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",ce&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:p("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ce?"bg-blue-500 border-blue-500":F?"border-white/30":"border-gray-300"),children:ce&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:p("block truncate",F?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:p("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:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{ge(),Xe(!Te);},className:p("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:M.color||"#6366F1"}}),jsx("span",{className:p("text-sm",F?"text-white":"text-gray-900"),children:So.find(P=>P.value===M.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:p("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Xe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:p("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:So.map(P=>{let ce=M.color===P.value;return jsx("button",{onClick:()=>{te("color",P.value),Xe(false);},className:p("w-7 h-7 rounded-full flex items-center justify-center transition-all",ce&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:ce?P.value:void 0},title:P.name,children:ce&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:p("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:M.isMilestone||false,onChange:P=>te("isMilestone",P.target.checked),className:p("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",M.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:p("text-sm",F?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:p("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:p("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:p("text-sm font-semibold",F?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ee,value:ie,onChange:P=>me(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:p("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:p("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:p("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",M.subtasks&&M.subtasks.length>0&&jsxs("span",{className:p("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",M.subtasks.filter(P=>P.progress===100).length,"/",M.subtasks.length,")"]})]})}),M.subtasks&&M.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...M.subtasks].sort((P,ce)=>(P.position??0)-(ce.position??0)).map(P=>jsxs("div",{className:p("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:()=>Pe(P.id),className:p("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":F?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:p("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:P.name}),jsx("button",{onClick:()=>Ye(P.id),className:p("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"})})]},P.id))}),fe?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:It,onChange:P=>z(P.target.value),onKeyDown:P=>{P.key==="Enter"&&It.trim()?Ne():P.key==="Escape"&&(we(false),z(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:p("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:Ne,disabled:!It.trim(),className:p("px-3 py-2 rounded-lg text-sm font-medium transition-colors",It.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:()=>{we(false),z("");},className:p("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:()=>we(true),className:p("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:p("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:p("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:p("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(P=>{let ce=Ot(P.type),$e=P.type.startsWith("image/");return jsxs("div",{className:p("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:[$e&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:p("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsx(ce,{className:p("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:p("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:ke(P.size)})]}),m&&jsx("button",{onClick:()=>m(P.id),className:p("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"})})]},P.id)})}),jsxs("div",{onDragOver:Le,onDragLeave:U,onDrop:Ta,className:p("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",N&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:ya,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||N}),N?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:p("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:p("w-6 h-6 mx-auto mb-2",H?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:p("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"})]})}),!l&&jsx("p",{className:p("text-xs mt-1",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:p("w-96 border-l flex flex-col",F?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:p("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",x.length>0&&jsxs("span",{className:p("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",x.length,")"]})]}),jsx("button",{onClick:a,className:p("p-1.5 rounded transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
5
5
  .activity-comments-scroll::-webkit-scrollbar {
6
6
  width: 4px !important;
7
7
  }
@@ -15,7 +15,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
15
15
  .activity-comments-scroll:hover::-webkit-scrollbar-thumb {
16
16
  background: ${F?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsx("div",{ref:Ke,className:p("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:x.length>0?jsx("div",{className:"space-y-4",children:[...x].sort((P,ce)=>{let $e=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,Je=typeof ce.createdAt=="string"?new Date(ce.createdAt):ce.createdAt;return $e.getTime()-Je.getTime()}).map(P=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:p("text-sm font-medium",F?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Oe(P.createdAt)})]}),jsx("div",{className:p("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Cu,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(ce=>{let $e=ce.type.startsWith("image/");return jsxs("a",{href:ce.url,target:"_blank",rel:"noopener noreferrer",className:p("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:[$e?jsx(Image,{className:p("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:p("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:p("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:ce.name})]},ce.id)})})]})]},P.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:p("w-10 h-10 mb-3",F?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:p("text-sm",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:p("py-4 pl-4 pr-2 border-t",F?"border-white/10":"border-gray-200"),children:jsx(ku,{value:Se,onChange:He,onSubmit:ae,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!b,isSubmitting:lt,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!h,pendingFiles:dt,onFilesSelect:A,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 io({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:d,isLoading:c,error:i,children:u,availableTags:l=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:x,onDeleteAttachment:b,comments:v,onAddComment:f,currentUser:h,mentionableUsers:w,onTaskOpen:y,onUploadCommentAttachments:k,enableTimeTracking:C,timeTrackingSummary:D,timeEntries:T,timerState:L,onLogTime:B,onUpdateEstimate:S,onUpdateSoldEffort:R,onStartTimer:$,onStopTimer:de,onDiscardTimer:F,blurFinancials:X=false,sidePanel:xe,renderColumnMetrics:_e,suppressDetailModal:M=false}){let[W,re]=bl(),[ke,O]=useState(null),[q,J]=useState(false),pe=useRef(null),Be=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),ze=o?.theme||"dark",it=ze==="dark"||ze==="neutral",nt=it?"dark":"",oe=useCallback((N,Y)=>{t.onCardUpdate?.(N,Y);},[t]),ct=useCallback((N,Y)=>{t.onColumnUpdate?.(N,{title:Y});},[t]),Re=useCallback(N=>{t.onColumnDelete?.(N);},[t]),yt=["todo","in-progress","completed"],ft=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),pt=useMemo(()=>{let N=new Map;return e.columns.forEach(Y=>{let ie=Y.cardIds.map(he=>e.cards.find(_=>_.id===he)).filter(he=>he!==void 0).sort((he,_)=>he.position-_.position);N.set(Y.id,ie);}),N},[e.cards,e.columns]);useEffect(()=>{let N=pe.current;if(!N)return;let Y=ee=>{let Ve=ee.target,ve=ee.button===1,Ue=Ve===N||Ve.classList.contains("asakaa-column")&&!Ve.closest(".asakaa-card");(ve||ee.button===0&&Ue&&!W.isDragging)&&(ee.preventDefault(),J(true),Be.current={x:ee.clientX,y:ee.clientY,scrollLeft:N.scrollLeft,scrollTop:N.scrollTop},N.style.cursor="grabbing",N.style.userSelect="none");},ie=ee=>{if(!q)return;let Ve=ee.clientX-Be.current.x,ve=ee.clientY-Be.current.y;N.scrollLeft=Be.current.scrollLeft-Ve,N.scrollTop=Be.current.scrollTop-ve;},he=()=>{q&&(J(false),N.style.cursor="",N.style.userSelect="");},_=()=>{q&&(J(false),N.style.cursor="",N.style.userSelect="");};return N.addEventListener("mousedown",Y),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",he),N.addEventListener("mouseleave",_),()=>{N.removeEventListener("mousedown",Y),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",he),N.removeEventListener("mouseleave",_);}},[q,W.isDragging]);let Te=useMemo(()=>e.cards.map(N=>({id:N.id,name:N.title,startDate:N.startDate?new Date(N.startDate):void 0,endDate:N.endDate?new Date(N.endDate):void 0,progress:N.progress||0,status:N.columnId,priority:N.priority?.toLowerCase(),dependencies:Array.isArray(N.dependencies)?N.dependencies.map(Y=>typeof Y=="string"?Y:Y.taskId):[]})),[e.cards]),Xe=useCallback(N=>{let{active:Y}=N,ie=e.cards.find(he=>he.id===Y.id);ie&&re({isDragging:true,draggedCardId:ie.id,sourceColumnId:ie.columnId,targetColumnId:ie.columnId});},[e.cards,re]),ot=useCallback(N=>{let{active:Y,over:ie}=N;if(!ie||!e.cards.find(ee=>ee.id===Y.id))return;let _=null;ie.data.current?.type==="column"?_=ie.id:ie.data.current?.type==="card"&&(_=e.cards.find(Ve=>Ve.id===ie.id)?.columnId||null),_&&_!==W.targetColumnId&&re({...W,targetColumnId:_});},[e.cards,W,re]),Qe=useCallback(async N=>{let{active:Y,over:ie}=N;if(re({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ie)return;let he=e.cards.find(ve=>ve.id===Y.id);if(!he)return;let _,ee;if(ie.data.current?.type==="column"){_=ie.id;let ve=pt.get(_)||[];ee=Qi(ve,0);}else {let ve=e.cards.find(He=>He.id===ie.id);if(!ve)return;_=ve.columnId;let Ue=pt.get(_)||[],Se=Ue.findIndex(He=>He.id===ie.id);ee=Qi(Ue,Se);}let Ve=e.columns.find(ve=>ve.id===_);if(Ve&&Ve.wipLimit&&Ve.wipLimitType==="hard"){let ve=pt.get(_)||[];if(he.columnId!==_&&ve.length>=Ve.wipLimit){t.onWipLimitExceeded?.(Ve,he);return}}(he.columnId!==_||he.position!==ee)&&await t.onCardMove?.(he.id,_,ee);},[e.cards,e.columns,pt,t,re]),H=useCallback(N=>{M||O(N),a?.(N),y?.(N.id);},[a,y,M]),se=useCallback(N=>{t.onCardUpdate?.(N.id,N),O(N);},[t]);return c?jsx("div",{className:p("asakaa-board",nt,n),style:d,children:jsx(th,{columnCount:3})}):i?jsx("div",{className:p("asakaa-board",nt,n),style:d,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Jc,{themeName:ze,children:[jsxs("div",{className:p("flex h-full overflow-hidden",xe?"flex-row":""),children:[jsxs(DndContext,{sensors:ft,collisionDetection:closestCorners,onDragStart:Xe,onDragOver:ot,onDragEnd:Qe,children:[jsxs("div",{ref:pe,className:p("asakaa-board",xe?"flex-1":"",nt,n),style:{...d,cursor:q?"grabbing":void 0},"data-theme":ze,children:[e.columns.sort((N,Y)=>N.position-Y.position).map(N=>{let Y=pt.get(N.id)||[],ie=!yt.includes(N.id),he=r?.renderColumnFooter?.(N);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(Qo,{column:N,cards:Y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:_e?(_,ee)=>_e(_,ee):void 0,onCardClick:H,onCardUpdate:oe,onColumnRename:t.onColumnUpdate?ct:void 0,onColumnDelete:t.onColumnDelete?Re:void 0,isDeletable:ie,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),he]},N.id)}),u]}),jsx(DragOverlay,{children:W.draggedCardId?jsx(Vr,{card:e.cards.find(N=>N.id===W.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),xe]}),!M&&jsx(jr,{task:ke,isOpen:!!ke,onClose:()=>O(null),onCardUpdate:se,theme:it?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:m,attachments:ke?g?.get(ke.id)||[]:[],onUploadAttachments:x,onDeleteAttachment:b,availableTasks:Te,comments:v,onAddComment:f,currentUser:h,mentionableUsers:w,onUploadCommentAttachments:k,enableTimeTracking:C,timeTrackingSummary:D,timeEntries:T,isTimerRunning:L?.isRunning,timerElapsedSeconds:L?.elapsedSeconds,onTimeLog:B,onEstimateUpdate:S,onSoldEffortUpdate:R,onTimerStart:$,onTimerStop:de,onTimerDiscard:F,blurFinancials:X})]})}function th({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var sh={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)"},ih={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"},dh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function ch({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let i=u=>{d.current&&!d.current.contains(u.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:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function uh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[d,c]=useState(null),i=useRef(null);if(useEffect(()=>{let g=x=>{i.current&&!i.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let l=[{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,x)=>{if(x){c(g);try{await x();}catch(b){console.error(`Export ${g} failed:`,b);}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:l.map((g,x)=>jsxs(motion.button,{onClick:()=>m(g.id,g.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function ph({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 yl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:c,translations:i,toolbarRightContent:u}){let l=r==="dark"?sh:ih,m={...o==="es"?lh:dh,...i},g=n||d||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:l.bgGrid,borderColor:l.border},children:jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:l.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(uh,{theme:l,t:m,onExportCSV:n,onExportJSON:d,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:l.borderLight}})]}),t&&(s?jsx(ch,{columns:e,onSelect:t,theme:l,t:m,createTaskLabel:a}):jsx(ph,{onClick:()=>t(),label:a||m.newTask}))]})})}function vl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[d,c]=useState(""),i=useCallback(()=>{let m=d.trim();m&&(e(m),c(""),n(false));},[d,e]),u=useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(c(""),n(false));},[i]),l=useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);return s?jsx("div",{className:p("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:d,onChange:m=>c(m.target.value),onKeyDown:u,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!d.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{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:p("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 Eo({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:d="up"}){let[c,i]=useState(""),[u,l]=useState(void 0),[m,g]=useState(null),[x,b]=useState(null),[v,f]=useState(false),[h,w]=useState(false),[y,k]=useState(false),[C,D]=useState(s||new Date),T=useRef(null),L=o==="es",B=d==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let S=useCallback(()=>{f(false),w(false),k(false);},[]),R=useCallback(()=>{i(""),l(void 0),g(null),b(null),S(),t();},[t,S]),$=useCallback(()=>{let X=c.trim();if(!X)return;let xe=a.find(M=>M.id===m),_e=x||s;e({name:X,priority:u,assignee:xe||void 0,assigneeId:m,startDate:_e,endDate:_e}),i(""),l(void 0),g(null),b(null),S(),T.current?.focus();},[c,u,m,x,s,a,e,S]),de=useCallback(X=>{X.key==="Enter"&&c.trim()&&(X.preventDefault(),$()),X.key==="Escape"&&R();},[$,R,c]),F=x||s||new Date;return jsxs("div",{className:p("quick-task-create",n),onClick:()=>S(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:c,onChange:X=>i(X.target.value),placeholder:L?"Nombre de la tarea...":"Task name...",className:p("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:de})}),jsxs("div",{className:p("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:X=>{X.stopPropagation(),f(!v),w(false),k(false);},type:"button",className:p("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",B,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:L?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:L?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:L?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:L?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:L?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxs("button",{onClick:()=>{l(X.id),f(false);},type:"button",className:p("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:p("w-2 h-2 rounded-full",X.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:X=>{X.stopPropagation(),k(!y),f(false),w(false),D(x||s||new Date);},type:"button",className:p("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",x?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(L?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",B,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsx("div",{className:p("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,xe=new Date(X);xe.setDate(X.getDate()+1);let _e=new Date(X);_e.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let M=new Date(X);M.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let W=new Date(X);W.setDate(X.getDate()+14);let re=new Date(X);re.setDate(X.getDate()+28);let ke=L?"es-ES":"en-US";return [{label:L?"Hoy":"Today",date:X,display:X.toLocaleDateString(ke,{weekday:"short"}).slice(0,3)+"."},{label:L?"Ma\xF1ana":"Tomorrow",date:xe,display:xe.toLocaleDateString(ke,{weekday:"short"}).slice(0,3)+"."},{label:L?"Este fin de semana":"This weekend",date:_e,display:L?"s\xE1b.":"sat."},{label:L?"Pr\xF3xima semana":"Next week",date:M,display:L?"lun.":"mon."},{label:L?"2 semanas":"2 weeks",date:W,display:W.toLocaleDateString(ke,{day:"numeric",month:"short"})},{label:L?"4 semanas":"4 weeks",date:re,display:re.toLocaleDateString(ke,{day:"numeric",month:"short"})}].map((q,J)=>jsxs("button",{type:"button",className:p("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{b(q.date),k(false);},children:[jsx("span",{children:q.label}),jsx("span",{className:p("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:q.display})]},J))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:p("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:C.toLocaleDateString(L?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>D(new Date),className:p("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:L?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>D(new Date(C.getFullYear(),C.getMonth()-1)),className:p("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:()=>D(new Date(C.getFullYear(),C.getMonth()+1)),className:p("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:(L?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsx("div",{className:p("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:X},X))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=C.getFullYear(),xe=C.getMonth(),_e=new Date(X,xe,1).getDay(),M=new Date(X,xe+1,0).getDate(),W=new Date(X,xe,0).getDate(),re=new Date().toDateString(),ke=[];for(let q=_e-1;q>=0;q--)ke.push({dayNum:W-q,isCurrent:false,date:new Date(X,xe-1,W-q)});for(let q=1;q<=M;q++)ke.push({dayNum:q,isCurrent:true,date:new Date(X,xe,q)});let O=42-ke.length;for(let q=1;q<=O;q++)ke.push({dayNum:q,isCurrent:false,date:new Date(X,xe+1,q)});return ke.map((q,J)=>{let pe=q.date.toDateString()===re,Be=(x||s)?.toDateString()===q.date.toDateString();return jsx("button",{type:"button",className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!q.isCurrent&&(r?"text-white/20":"text-gray-300"),q.isCurrent&&(r?"text-white":"text-gray-900"),pe&&"ring-1 ring-[#007FFF]",Be&&"bg-[#007FFF] text-white",!Be&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{b(q.date),k(false);},children:q.dayNum},J)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),w(!h),f(false),k(false);},type:"button",className:p("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(X=>X.id===m)?.color||"#007FFF"},children:a.find(X=>X.id===m)?.initials||a.find(X=>X.id===m)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",B,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:p("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:p("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:L?"Sin asignar":"Unassigned"})]}),a.map(X=>jsxs("button",{type:"button",onClick:()=>{g(X.id),w(false);},className:p("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===X.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:X.color||"#007FFF"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.name})]},X.id)),a.length===0&&jsx("div",{className:p("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:L?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:$,disabled:!c.trim(),type:"button",className:p("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:L?"Guardar":"Save"})]})]})}function Nl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:d="es"}){let[c,i]=useState(false),u=useRef(null),l=useRef(null),[m,g]=useState({}),[x,b]=useState(false),v=n==="dark",h={buttonLabel:o||(d==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!u.current)return;let y=90,k=()=>{let C=u.current.getBoundingClientRect(),T=window.innerHeight-C.bottom<y+8;b(T),g({position:"fixed",...T?{bottom:window.innerHeight-C.top+4}:{top:C.bottom+4},left:C.left,width:C.width,zIndex:9999});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[c]),useEffect(()=>{if(!c)return;let y=k=>{let C=k.target;l.current&&!l.current.contains(C)&&u.current&&!u.current.contains(C)&&i(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]);let w=useCallback(y=>{t({name:y.name,columnId:e,assigneeIds:y.assigneeId?[y.assigneeId]:void 0,startDate:y.startDate,endDate:y.endDate,priority:y.priority});},[t,e]);return jsxs("div",{ref:u,className:p("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"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:l,initial:{opacity:0,y:x?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:x?4:-4,scale:.97},transition:{duration:.12},style:m,className:p("rounded-lg shadow-2xl",v?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Eo,{onSubmit:w,onCancel:()=>i(false),availableUsers:a,isDark:v,locale:d,dropdownDirection:"up"})})}),document.body)]})}var $n=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(io,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
18
+ `}),jsx("div",{ref:Ke,className:p("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:x.length>0?jsx("div",{className:"space-y-4",children:[...x].sort((P,ce)=>{let $e=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,Je=typeof ce.createdAt=="string"?new Date(ce.createdAt):ce.createdAt;return $e.getTime()-Je.getTime()}).map(P=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:p("text-sm font-medium",F?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:p("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Oe(P.createdAt)})]}),jsx("div",{className:p("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Cu,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(ce=>{let $e=ce.type.startsWith("image/");return jsxs("a",{href:ce.url,target:"_blank",rel:"noopener noreferrer",className:p("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:[$e?jsx(Image,{className:p("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:p("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:p("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:ce.name})]},ce.id)})})]})]},P.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:p("w-10 h-10 mb-3",F?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:p("text-sm",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:p("py-4 pl-4 pr-2 border-t",F?"border-white/10":"border-gray-200"),children:jsx(ku,{value:Se,onChange:He,onSubmit:ae,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!b,isSubmitting:lt,theme:s,locale:n,currentUser:v,enableEmoji:true,enableAttachments:!!h,pendingFiles:dt,onFilesSelect:A,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 io({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:d,isLoading:c,error:i,children:u,availableTags:l=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:x,onDeleteAttachment:b,comments:v,onAddComment:f,currentUser:h,mentionableUsers:w,onTaskOpen:y,onUploadCommentAttachments:k,enableTimeTracking:C,timeTrackingSummary:D,timeEntries:T,timerState:L,onLogTime:B,onUpdateEstimate:S,onUpdateSoldEffort:R,onStartTimer:$,onStopTimer:de,onDiscardTimer:F,blurFinancials:X=false,sidePanel:xe,renderColumnMetrics:_e,suppressDetailModal:M=false}){let[W,re]=bl(),[Ce,O]=useState(null),[q,J]=useState(false),pe=useRef(null),Be=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),ze=o?.theme||"dark",it=ze==="dark"||ze==="neutral",nt=it?"dark":"",oe=useCallback((N,Y)=>{t.onCardUpdate?.(N,Y);},[t]),ct=useCallback((N,Y)=>{t.onColumnUpdate?.(N,{title:Y});},[t]),Re=useCallback(N=>{t.onColumnDelete?.(N);},[t]),yt=["todo","in-progress","completed"],ft=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),pt=useMemo(()=>{let N=new Map;return e.columns.forEach(Y=>{let ie=Y.cardIds.map(he=>e.cards.find(_=>_.id===he)).filter(he=>he!==void 0).sort((he,_)=>he.position-_.position);N.set(Y.id,ie);}),N},[e.cards,e.columns]);useEffect(()=>{let N=pe.current;if(!N)return;let Y=ee=>{let Ve=ee.target,ve=ee.button===1,Ue=Ve===N||Ve.classList.contains("asakaa-column")&&!Ve.closest(".asakaa-card");(ve||ee.button===0&&Ue&&!W.isDragging)&&(ee.preventDefault(),J(true),Be.current={x:ee.clientX,y:ee.clientY,scrollLeft:N.scrollLeft,scrollTop:N.scrollTop},N.style.cursor="grabbing",N.style.userSelect="none");},ie=ee=>{if(!q)return;let Ve=ee.clientX-Be.current.x,ve=ee.clientY-Be.current.y;N.scrollLeft=Be.current.scrollLeft-Ve,N.scrollTop=Be.current.scrollTop-ve;},he=()=>{q&&(J(false),N.style.cursor="",N.style.userSelect="");},_=()=>{q&&(J(false),N.style.cursor="",N.style.userSelect="");};return N.addEventListener("mousedown",Y),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",he),N.addEventListener("mouseleave",_),()=>{N.removeEventListener("mousedown",Y),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",he),N.removeEventListener("mouseleave",_);}},[q,W.isDragging]);let Te=useMemo(()=>e.cards.map(N=>({id:N.id,name:N.title,startDate:N.startDate?new Date(N.startDate):void 0,endDate:N.endDate?new Date(N.endDate):void 0,progress:N.progress||0,status:N.columnId,priority:N.priority?.toLowerCase(),dependencies:Array.isArray(N.dependencies)?N.dependencies.map(Y=>typeof Y=="string"?Y:Y.taskId):[]})),[e.cards]),Xe=useCallback(N=>{let{active:Y}=N,ie=e.cards.find(he=>he.id===Y.id);ie&&re({isDragging:true,draggedCardId:ie.id,sourceColumnId:ie.columnId,targetColumnId:ie.columnId});},[e.cards,re]),ot=useCallback(N=>{let{active:Y,over:ie}=N;if(!ie||!e.cards.find(ee=>ee.id===Y.id))return;let _=null;ie.data.current?.type==="column"?_=ie.id:ie.data.current?.type==="card"&&(_=e.cards.find(Ve=>Ve.id===ie.id)?.columnId||null),_&&_!==W.targetColumnId&&re({...W,targetColumnId:_});},[e.cards,W,re]),Qe=useCallback(async N=>{let{active:Y,over:ie}=N;if(re({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ie)return;let he=e.cards.find(ve=>ve.id===Y.id);if(!he)return;let _,ee;if(ie.data.current?.type==="column"){_=ie.id;let ve=pt.get(_)||[];ee=Qi(ve,0);}else {let ve=e.cards.find(He=>He.id===ie.id);if(!ve)return;_=ve.columnId;let Ue=pt.get(_)||[],Se=Ue.findIndex(He=>He.id===ie.id);ee=Qi(Ue,Se);}let Ve=e.columns.find(ve=>ve.id===_);if(Ve&&Ve.wipLimit&&Ve.wipLimitType==="hard"){let ve=pt.get(_)||[];if(he.columnId!==_&&ve.length>=Ve.wipLimit){t.onWipLimitExceeded?.(Ve,he);return}}(he.columnId!==_||he.position!==ee)&&await t.onCardMove?.(he.id,_,ee);},[e.cards,e.columns,pt,t,re]),H=useCallback(N=>{M||O(N),a?.(N),y?.(N.id);},[a,y,M]),se=useCallback(N=>{t.onCardUpdate?.(N.id,N),O(N);},[t]);return c?jsx("div",{className:p("asakaa-board",nt,n),style:d,children:jsx(th,{columnCount:3})}):i?jsx("div",{className:p("asakaa-board",nt,n),style:d,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Jc,{themeName:ze,children:[jsxs("div",{className:p("flex h-full overflow-hidden",xe?"flex-row":""),children:[jsxs(DndContext,{sensors:ft,collisionDetection:closestCorners,onDragStart:Xe,onDragOver:ot,onDragEnd:Qe,children:[jsxs("div",{ref:pe,className:p("asakaa-board",xe?"flex-1":"",nt,n),style:{...d,cursor:q?"grabbing":void 0},"data-theme":ze,children:[e.columns.sort((N,Y)=>N.position-Y.position).map(N=>{let Y=pt.get(N.id)||[],ie=!yt.includes(N.id),he=r?.renderColumnFooter?.(N);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(Qo,{column:N,cards:Y,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:_e?(_,ee)=>_e(_,ee):void 0,onCardClick:H,onCardUpdate:oe,onColumnRename:t.onColumnUpdate?ct:void 0,onColumnDelete:t.onColumnDelete?Re:void 0,isDeletable:ie,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),he]},N.id)}),u]}),jsx(DragOverlay,{children:W.draggedCardId?jsx(Vr,{card:e.cards.find(N=>N.id===W.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),xe]}),!M&&jsx(jr,{task:Ce,isOpen:!!Ce,onClose:()=>O(null),onCardUpdate:se,theme:it?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:m,attachments:Ce?g?.get(Ce.id)||[]:[],onUploadAttachments:x,onDeleteAttachment:b,availableTasks:Te,comments:v,onAddComment:f,currentUser:h,mentionableUsers:w,onUploadCommentAttachments:k,enableTimeTracking:C,timeTrackingSummary:D,timeEntries:T,isTimerRunning:L?.isRunning,timerElapsedSeconds:L?.elapsedSeconds,onTimeLog:B,onEstimateUpdate:S,onSoldEffortUpdate:R,onTimerStart:$,onTimerStop:de,onTimerDiscard:F,blurFinancials:X})]})}function th({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var sh={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)"},ih={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"},dh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function ch({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let i=u=>{d.current&&!d.current.contains(u.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:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function uh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[d,c]=useState(null),i=useRef(null);if(useEffect(()=>{let g=x=>{i.current&&!i.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let l=[{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,x)=>{if(x){c(g);try{await x();}catch(b){console.error(`Export ${g} failed:`,b);}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:l.map((g,x)=>jsxs(motion.button,{onClick:()=>m(g.id,g.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function ph({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 yl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:c,translations:i,toolbarRightContent:u}){let l=r==="dark"?sh:ih,m={...o==="es"?lh:dh,...i},g=n||d||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:l.bgGrid,borderColor:l.border},children:jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:l.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(uh,{theme:l,t:m,onExportCSV:n,onExportJSON:d,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:l.borderLight}})]}),t&&(s?jsx(ch,{columns:e,onSelect:t,theme:l,t:m,createTaskLabel:a}):jsx(ph,{onClick:()=>t(),label:a||m.newTask}))]})})}function vl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[d,c]=useState(""),i=useCallback(()=>{let m=d.trim();m&&(e(m),c(""),n(false));},[d,e]),u=useCallback(m=>{m.key==="Enter"?(m.preventDefault(),i()):m.key==="Escape"&&(c(""),n(false));},[i]),l=useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);return s?jsx("div",{className:p("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:d,onChange:m=>c(m.target.value),onKeyDown:u,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!d.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{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:p("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 Eo({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:d="up"}){let[c,i]=useState(""),[u,l]=useState(void 0),[m,g]=useState(null),[x,b]=useState(null),[v,f]=useState(false),[h,w]=useState(false),[y,k]=useState(false),[C,D]=useState(s||new Date),T=useRef(null),L=o==="es",B=d==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let S=useCallback(()=>{f(false),w(false),k(false);},[]),R=useCallback(()=>{i(""),l(void 0),g(null),b(null),S(),t();},[t,S]),$=useCallback(()=>{let X=c.trim();if(!X)return;let xe=a.find(M=>M.id===m),_e=x||s;e({name:X,priority:u,assignee:xe||void 0,assigneeId:m,startDate:_e,endDate:_e}),i(""),l(void 0),g(null),b(null),S(),T.current?.focus();},[c,u,m,x,s,a,e,S]),de=useCallback(X=>{X.key==="Enter"&&c.trim()&&(X.preventDefault(),$()),X.key==="Escape"&&R();},[$,R,c]),F=x||s||new Date;return jsxs("div",{className:p("quick-task-create",n),onClick:()=>S(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:c,onChange:X=>i(X.target.value),placeholder:L?"Nombre de la tarea...":"Task name...",className:p("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:de})}),jsxs("div",{className:p("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:X=>{X.stopPropagation(),f(!v),w(false),k(false);},type:"button",className:p("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",B,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:L?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:L?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:L?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:L?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:L?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxs("button",{onClick:()=>{l(X.id),f(false);},type:"button",className:p("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:p("w-2 h-2 rounded-full",X.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:X=>{X.stopPropagation(),k(!y),f(false),w(false),D(x||s||new Date);},type:"button",className:p("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",x?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(L?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",B,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsx("div",{className:p("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,xe=new Date(X);xe.setDate(X.getDate()+1);let _e=new Date(X);_e.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let M=new Date(X);M.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let W=new Date(X);W.setDate(X.getDate()+14);let re=new Date(X);re.setDate(X.getDate()+28);let Ce=L?"es-ES":"en-US";return [{label:L?"Hoy":"Today",date:X,display:X.toLocaleDateString(Ce,{weekday:"short"}).slice(0,3)+"."},{label:L?"Ma\xF1ana":"Tomorrow",date:xe,display:xe.toLocaleDateString(Ce,{weekday:"short"}).slice(0,3)+"."},{label:L?"Este fin de semana":"This weekend",date:_e,display:L?"s\xE1b.":"sat."},{label:L?"Pr\xF3xima semana":"Next week",date:M,display:L?"lun.":"mon."},{label:L?"2 semanas":"2 weeks",date:W,display:W.toLocaleDateString(Ce,{day:"numeric",month:"short"})},{label:L?"4 semanas":"4 weeks",date:re,display:re.toLocaleDateString(Ce,{day:"numeric",month:"short"})}].map((q,J)=>jsxs("button",{type:"button",className:p("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{b(q.date),k(false);},children:[jsx("span",{children:q.label}),jsx("span",{className:p("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:q.display})]},J))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:p("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:C.toLocaleDateString(L?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>D(new Date),className:p("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:L?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>D(new Date(C.getFullYear(),C.getMonth()-1)),className:p("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:()=>D(new Date(C.getFullYear(),C.getMonth()+1)),className:p("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:(L?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsx("div",{className:p("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:X},X))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=C.getFullYear(),xe=C.getMonth(),_e=new Date(X,xe,1).getDay(),M=new Date(X,xe+1,0).getDate(),W=new Date(X,xe,0).getDate(),re=new Date().toDateString(),Ce=[];for(let q=_e-1;q>=0;q--)Ce.push({dayNum:W-q,isCurrent:false,date:new Date(X,xe-1,W-q)});for(let q=1;q<=M;q++)Ce.push({dayNum:q,isCurrent:true,date:new Date(X,xe,q)});let O=42-Ce.length;for(let q=1;q<=O;q++)Ce.push({dayNum:q,isCurrent:false,date:new Date(X,xe+1,q)});return Ce.map((q,J)=>{let pe=q.date.toDateString()===re,Be=(x||s)?.toDateString()===q.date.toDateString();return jsx("button",{type:"button",className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!q.isCurrent&&(r?"text-white/20":"text-gray-300"),q.isCurrent&&(r?"text-white":"text-gray-900"),pe&&"ring-1 ring-[#007FFF]",Be&&"bg-[#007FFF] text-white",!Be&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{b(q.date),k(false);},children:q.dayNum},J)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),w(!h),f(false),k(false);},type:"button",className:p("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(X=>X.id===m)?.color||"#007FFF"},children:a.find(X=>X.id===m)?.initials||a.find(X=>X.id===m)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:p("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",B,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:p("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:p("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:L?"Sin asignar":"Unassigned"})]}),a.map(X=>jsxs("button",{type:"button",onClick:()=>{g(X.id),w(false);},className:p("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===X.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:X.color||"#007FFF"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.name})]},X.id)),a.length===0&&jsx("div",{className:p("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:L?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:$,disabled:!c.trim(),type:"button",className:p("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:L?"Guardar":"Save"})]})]})}function Nl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:d="es"}){let[c,i]=useState(false),u=useRef(null),l=useRef(null),[m,g]=useState({}),[x,b]=useState(false),v=n==="dark",h={buttonLabel:o||(d==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!u.current)return;let y=90,k=()=>{let C=u.current.getBoundingClientRect(),T=window.innerHeight-C.bottom<y+8;b(T),g({position:"fixed",...T?{bottom:window.innerHeight-C.top+4}:{top:C.bottom+4},left:C.left,width:C.width,zIndex:9999});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[c]),useEffect(()=>{if(!c)return;let y=k=>{let C=k.target;l.current&&!l.current.contains(C)&&u.current&&!u.current.contains(C)&&i(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]);let w=useCallback(y=>{t({name:y.name,columnId:e,assigneeIds:y.assigneeId?[y.assigneeId]:void 0,startDate:y.startDate,endDate:y.endDate,priority:y.priority});},[t,e]);return jsxs("div",{ref:u,className:p("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"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:l,initial:{opacity:0,y:x?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:x?4:-4,scale:.97},transition:{duration:.12},style:m,className:p("rounded-lg shadow-2xl",v?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Eo,{onSubmit:w,onCancel:()=>i(false),availableUsers:a,isDark:v,locale:d,dropdownDirection:"up"})})}),document.body)]})}var $n=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(io,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
19
19
  `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function tp(e={}){return new $n(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 Dl(e,t){let a=r=>jsx(tn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function El({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:d,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[l,m]=useState(false),[g,x]=useState(""),[b,v]=useState("home"),[f,h]=useState(""),[w,y]=useState("");useEffect(()=>{let T=L=>{(L.metaKey||L.ctrlKey)&&L.key===i&&(L.preventDefault(),m(B=>!B)),L.key==="Escape"&&(m(false),v("home"),x(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),useEffect(()=>{l||(v("home"),x(""),h(""),y(""));},[l]);let k=useCallback(()=>{m(false);},[]),C=useCallback(T=>{let[L,B]=T.split(":");switch(L){case "create-card":v("create-card");break;case "create-card-in":h(B||"");break;case "navigate":B?(a?.(B),k()):v("navigate");break;case "search":r?.(g),k();break;case "priority":v("priority");break;case "set-priority":w&&B&&(o?.(w,B),k());break;case "assign":v("assign");break;case "assign-user":w&&B&&(s?.(w,B),k());break;case "ai":v("ai");break;case "ai-generate-plan":n?.(),k();break;case "ai-predict-risks":d?.(),k();break;case "ai-usage":c?.(),k();break;case "back":v("home");break;}},[g,w,t,a,r,o,s,n,d,c,k]),D=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),k());},[f,g,t,k]);return l?jsx(At,{children:jsx("div",{className:"command-palette-overlay",onClick:k,children:jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:x,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:b==="create-card"&&f?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&b==="create-card"&&f&&D();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),b==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:C,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:C,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:C,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:C,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:C,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(L=>jsx("span",{className:"command-palette-item-label",children:L},L))})]},T.id))})]}),b==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:C,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxs(Command.Item,{value:`create-card-in:${T.id}`,onSelect:C,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),b==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:C,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let L=e.columns.find(B=>B.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:C,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(B=>jsx("span",{className:"command-palette-item-label",children:B},B))})]},T.id)})})]}),b==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:C,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:C,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:C,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:C,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function op(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
20
20
  position: fixed !important;
21
21
  inset: 0 !important;
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
82
82
  border: none !important;
83
83
  cursor: pointer !important;
84
84
  opacity: 0.5 !important;
85
- `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=x=>{x.stopPropagation();let b=r<a.length-1?r+1:0;i(),o(b);},n.appendChild(l),n.appendChild(m),n.appendChild(g);}n.appendChild(d),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Sh(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 Eh(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 Pl(e){return e.startsWith("image/")}function Or({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=useState(false),[c,i]=useState(false),[u,l]=useState(null),m=useRef(null),g=useRef(e);g.current=e;let x=useCallback((T,L)=>{L.preventDefault(),L.stopPropagation();let B=g.current.filter($=>Pl($.type)),S=B.findIndex($=>$.id===T.id),R=$=>{let de=g.current.filter(X=>Pl(X.type)),F=de[$];F&&op(F.url,F.name,de,$,R);};op(T.url,T.name,B,S,R);},[]),b=useCallback(T=>{let L=[],B=[];return e.length+T.length>s?(B.push(`Maximum ${s} files allowed`),{valid:L,errors:B}):(T.forEach(S=>{if(S.size/1048576>r){B.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>S.type.match($))){B.push(`${S.name} has invalid file type`);return}L.push(S);}),{valid:L,errors:B})},[e.length,s,r,o]),v=useCallback(async T=>{let{valid:L,errors:B}=b(T);if(B.length>0){l(B.join(", ")),setTimeout(()=>l(null),5e3);return}if(L.length!==0){i(true),l(null);try{await t?.(L);}catch(S){l(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[b,t]),f=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(true);},[]),h=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);},[]),w=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),y=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);let L=Array.from(T.dataTransfer.files);v(L);},[v]),k=useCallback(T=>{let L=T.target.files?Array.from(T.target.files):[];v(L),m.current&&(m.current.value="");},[v]),C=useCallback(()=>{m.current?.click();},[]),D=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:h,onDragOver:w,onDrop:y,onClick:C,children:[jsx("input",{ref:m,type:"file",multiple:true,onChange:k,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"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Pl(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>x(T,L),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:Eh(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Sh(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>D(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function Ml({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:c=[],attachments:i=[],onAddComment:u,onDeleteComment:l,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:x,onGenerateSubtasks:b,onEstimateEffort:v,currentUserId:f="user-1"}){let[h,w]=useState("details"),[y,k]=useState(false),[C,D]=useState({}),[T,L]=useState(""),[B,S]=useState(false),[R,$]=useState({});if(!t||!e)return null;let de=useCallback(()=>{k(false),D({}),w("details"),L(""),$({}),a();},[a]),F=useCallback(()=>{r&&Object.keys(C).length>0&&(r(e.id,C),D({}),k(false));},[e.id,C,r]),X=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),de());},[e.id,o,de]),xe=useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),L(""));},[e.id,T,u]),_e=useCallback(async()=>{if(x){S(true);try{let O=await x(e);$(q=>({...q,assignees:O}));}catch(O){console.error("Failed to suggest assignee:",O);}finally{S(false);}}},[e,x]),M=useCallback(async()=>{if(b){S(true);try{let O=await b(e);$(q=>({...q,subtasks:O}));}catch(O){console.error("Failed to generate subtasks:",O);}finally{S(false);}}},[e,b]),W=useCallback(async()=>{if(v){S(true);try{let O=await v(e);$(q=>({...q,effort:O}));}catch(O){console.error("Failed to estimate effort:",O);}finally{S(false);}}},[e,v]),re={...e,...C},ke=s.filter(O=>re.assignedUserIds?.includes(O.id));return jsx(At,{children:jsx("div",{className:"card-detail-overlay",onClick:de,children:jsxs("div",{className:"card-detail-modal",onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),y?jsx("input",{type:"text",value:C.title??re.title,onChange:O=>D({...C,title:O.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:re.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[y?jsxs(Fragment,{children:[jsx("button",{onClick:F,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{k(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>k(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:X,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:de,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${h==="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:()=>w("ai"),className:`card-detail-tab ${h==="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:[h==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),y?jsx("textarea",{value:C.description??re.description??"",onChange:O=>D({...C,description:O.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:re.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),y?jsx("select",{multiple:true,value:C.assignedUserIds??re.assignedUserIds??[],onChange:O=>{let q=Array.from(O.target.selectedOptions,J=>J.value);D({...C,assignedUserIds:q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(O=>jsx("option",{value:O.id,children:O.name},O.id))}):jsx("div",{className:"card-detail-users",children:ke.length>0?ke.map(O=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:O.color},children:O.initials}),jsx("span",{children:O.name})]},O.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),y?jsxs("select",{value:C.priority??re.priority??"",onChange:O=>D({...C,priority:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:re.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:re.labels&&re.labels.length>0?re.labels.map(O=>jsx("span",{className:"card-detail-label-tag",children:O},O)):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"}),y?jsx("input",{type:"date",value:C.startDate?new Date(C.startDate).toISOString().split("T")[0]:re.startDate?new Date(re.startDate).toISOString().split("T")[0]:"",onChange:O=>D({...C,startDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.startDate?new Date(re.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),y?jsx("input",{type:"date",value:C.endDate?new Date(C.endDate).toISOString().split("T")[0]:re.endDate?new Date(re.endDate).toISOString().split("T")[0]:"",onChange:O=>D({...C,endDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.endDate?new Date(re.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),y?jsx("input",{type:"number",min:"0",step:"0.5",value:C.estimatedTime??re.estimatedTime??"",onChange:O=>D({...C,estimatedTime:O.target.value?parseFloat(O.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:re.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:re.dependencies&&re.dependencies.length>0?re.dependencies.map(O=>{let q=typeof O=="string"?O:O.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",q.slice(-4)]},q)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:re.createdAt?new Date(re.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:T,onChange:O=>L(O.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:xe,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(O=>{let q=s.find(J=>J.id===O.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:[q&&jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:q?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(O.createdAt).toLocaleString()})]})]}),l&&jsx("button",{onClick:()=>l(O.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:O.content})]},O.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"})]})})]}),h==="activity"&&jsx("div",{className:"card-detail-activity",children:d.length>0?jsx("div",{className:"card-detail-activity-list",children:d.map(O=>{let q=s.find(J=>J.id===O.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[O.type.includes("CREATED")&&"\u2795",O.type.includes("UPDATED")&&"\u270F\uFE0F",O.type.includes("MOVED")&&"\u27A1\uFE0F",O.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",O.type.includes("COMMENT")&&"\u{1F4AC}",O.type.includes("ASSIGNED")&&"\u{1F464}",O.type.includes("PRIORITY")&&"\u{1F3AF}",O.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",O.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:q?.name||"Unknown"})," ",O.type.replace(/_/g," ").toLowerCase(),O.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:O.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(O.timestamp).toLocaleString()})]})]},O.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"})]})}),h==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Or,{cardId:e.id,attachments:i,onUpload:m?O=>m(e.id,O):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:_e,disabled:B||!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("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:M,disabled:B||!b,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:W,disabled:B||!v,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),R.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),R.assignees.map((O,q)=>{let J=s.find(pe=>pe.id===O.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:O.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(O.confidence*100).toFixed(0),"%"]})]})]},q)})]}),R.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),R.subtasks.map((O,q)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:O.title}),O.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:O.description}),O.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",O.estimatedTime,"h"]})]},q))]}),R.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:[R.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(R.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.map(O=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${O.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:O.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:O.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:O.description}),O.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",O.suggestedAction]})]},O.id))]}),!R.assignees&&!R.subtasks&&!R.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 zn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,c]=useState({top:0,left:0}),i=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,x=4,b=l.left;b+o>g-10&&(b=g-o-10),b<10&&(b=10);let v=m-l.bottom,f=l.top,h;return v>=s+x?h=l.bottom+x:f>=s+x?h=l.top-s-x:v>=f?h=l.bottom+x:h=Math.max(10,l.top-s-x),{top:h,left:b}},[e,o,s]);return useEffect(()=>{t&&c(u());},[t,u]),useEffect(()=>{if(!t)return;let l=g=>{let x=g.target;i.current&&!i.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",l);}},[t,a,e]),useEffect(()=>{if(!t)return;let l=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsx(At,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var tt={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 Rh=["LOW","MEDIUM","HIGH","URGENT"],Oh=["todo","in-progress","review","done"];function Il({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:c,onDeleteComment:i,currentUser:u,onAIGenerateDescription:l,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:x=[],availableLabels:b=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:h,unsplashAccessKey:w,theme:y,onSubtasksChange:k,attachments:C=[],onUploadAttachments:D,onDeleteAttachment:T}){let L=qo(),B=y||L?.themeName||"dark",[S,R]=useState(e),[$,de]=useState(false),[F,X]=useState(()=>[...e?.subtasks||[]].sort((j,ae)=>(j.position??0)-(ae.position??0))),[xe,_e]=useState(false),[M,W]=useState(""),[re,ke]=useState(""),[O,q]=useState("all"),[J,pe]=useState(false),[Be,ze]=useState(false),[it,nt]=useState(false),[oe,ct]=useState(false),[Re,yt]=useState(false),[ft,pt]=useState(false),Te=useRef(null),Xe=useRef(null),ot=useRef(null),Qe=useRef(null),H=useRef(null),se=useRef(null),N=useRef(null),Y=useRef(null),ie=useRef(null),he=useRef(null),_=useRef(null),ee=useRef(null);useEffect(()=>{if(e&&!S){R({...e});let A=[...e.subtasks||[]].sort((j,ae)=>(j.position??0)-(ae.position??0));X(A);}else if(e&&S&&e.id!==S.id){R({...e});let A=[...e.subtasks||[]].sort((j,ae)=>(j.position??0)-(ae.position??0));X(A);}},[e,S]),useEffect(()=>{let A=j=>{let ae=j.target;Qe.current&&!Qe.current.contains(ae)&&pe(false),H.current&&!H.current.contains(ae)&&ze(false),se.current&&!se.current.contains(ae)&&nt(false),N.current&&!N.current.contains(ae)&&ct(false);};if(J||Be||it||oe)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[J,Be,it,oe]),useEffect(()=>{if(!t)return;let A=j=>{let ae=j.target,Ne=ae.tagName==="INPUT"||ae.tagName==="TEXTAREA"||ae.isContentEditable;if(j.key==="Escape"){j.preventDefault(),J||Be||it||oe||Re||ft?(pe(false),ze(false),nt(false),ct(false),yt(false),pt(false)):Ne||a();return}if(Ne&&j.key!=="Escape")return;let Pe=j.metaKey||j.ctrlKey;switch(j.key.toLowerCase()){case "s":j.preventDefault(),pe(true);break;case "a":j.preventDefault(),nt(true);break;case "p":j.preventDefault(),ze(true);break;case "l":j.preventDefault(),ct(true);break;case "d":Pe||(j.preventDefault(),yt(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":Pe||(j.preventDefault(),pt(true));break;case "i":j.preventDefault(),de(true),setTimeout(()=>Xe.current?.focus(),0);break;case "t":j.preventDefault(),_e(true);break;case "c":j.preventDefault(),ot.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,J,Be,it,oe,Re,ft]);let Ve=useCallback(A=>{let j=A.currentTarget.textContent?.trim()||"";if(S&&j!==S.title){let ae={...S,title:j};R(ae),r?.(S.id,{title:j});}},[S,r]),ve=useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=S?.title||"",A.currentTarget.blur());},[S]),Ue=useCallback(()=>{S&&e&&S.description!==e.description&&r?.(S.id,{description:S.description}),de(false);},[S,e,r]),Se=useCallback(A=>{if(S){let j={...S,columnId:A};R(j),r?.(S.id,{columnId:A}),pe(false);}},[S,r]),He=useCallback(A=>{if(S){let j={...S,priority:A};R(j),r?.(S.id,{priority:A}),ze(false);}},[S,r]),lt=useCallback(A=>{if(S){let j=S.assignedUserIds||[],ae=j.includes(A)?j.filter(Pe=>Pe!==A):[...j,A],Ne={...S,assignedUserIds:ae};R(Ne),r?.(S.id,{assignedUserIds:ae});}},[S,r]),st=useCallback(A=>{if(S){let j=S.labels||[],ae=j.includes(A)?j.filter(Pe=>Pe!==A):[...j,A],Ne={...S,labels:ae};R(Ne),r?.(S.id,{labels:ae});}},[S,r]),dt=useCallback(A=>{if(S){let j={...S,tags:A};R(j),r?.(S.id,{tags:A});}},[S,r]),mt=useCallback(A=>{if(S){let j=A.target.value,ae={...S,endDate:j};R(ae),r?.(S.id,{endDate:j}),yt(false);}},[S,r]),It=useCallback(A=>{if(S){let j={...S,estimatedTime:parseFloat(A)||0};R(j),r?.(S.id,{estimatedTime:parseFloat(A)||0});}},[S,r]),z=useCallback(()=>{if(M.trim()&&S){let A={id:`subtask-${Date.now()}`,title:M.trim(),completed:false,position:F.length,createdAt:new Date},j=[...F,A];X(j),W(""),_e(false),k?.(S.id,j);}},[M,F,S,k]),fe=useCallback(A=>{let j=F.map(ae=>ae.id===A?{...ae,completed:!ae.completed,updatedAt:new Date}:ae);X(j),S&&k?.(S.id,j);},[F,S,k]),Ce=useCallback(A=>{let j=F.filter(ae=>ae.id!==A);X(j),S&&k?.(S.id,j);},[F,S,k]),Ke=useCallback(()=>{re.trim()&&S&&c&&(c(S.id,re.trim()),ke(""));},[re,S,c]),qe=useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),Ke());},[Ke]),ge=A=>jsx(Lh,{remarkPlugins:[Ih],rehypePlugins:[Bh],components:{a:({node:j,...ae})=>jsx("a",{...ae,target:"_blank",rel:"noopener noreferrer"})},children:A}),te=d.filter(A=>O==="comments"?A.type.includes("COMMENT"):O==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let V=S||e,me=s.filter(A=>V.assignedUserIds?.includes(A.id)),Z=F.filter(A=>A.completed).length;return jsx(At,{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:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":B,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:Te,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ve,onKeyDown:ve,children:V.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:Qe,children:[jsxs("button",{ref:ie,className:"modal-v2-field",onClick:()=>pe(!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:V.columnId||"No status"})]}),jsx(zn,{triggerRef:ie,isOpen:J,onClose:()=>pe(false),width:250,estimatedHeight:200,children:(x.length>0?x:Oh.map(A=>({id:A,title:A}))).map(A=>jsx("button",{className:`modal-v2-popover-item ${V.columnId===A.id?"active":""}`,onClick:()=>Se(A.id),children:A.title},A.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:se,children:[jsxs("button",{ref:he,className:"modal-v2-field",onClick:()=>nt(!it),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:me.length>0?jsx("div",{className:"modal-v2-avatars",children:me.map(A=>jsx("div",{className:"modal-v2-avatar",style:{background:A.color},title:A.name,children:A.initials},A.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(zn,{triggerRef:he,isOpen:it,onClose:()=>nt(false),width:280,estimatedHeight:300,children:s.map(A=>jsxs("button",{className:`modal-v2-popover-item ${V.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>lt(A.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,V.assignedUserIds?.includes(A.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"})})]},A.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxs("button",{ref:_,className:"modal-v2-field",onClick:()=>ze(!Be),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:V.priority||"None"})]}),jsxs(zn,{triggerRef:_,isOpen:Be,onClose:()=>ze(false),width:180,estimatedHeight:220,children:[Rh.map(A=>jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${V.priority===A?"active":""}`,onClick:()=>He(A),children:A},A)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>He(""),children:"None"})]})]}),v.length>0||f?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(oo,{selectedTags:V.tags||[],availableTags:v,onChange:dt,onCreateTag:f,theme:tt[B]||tt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:N,children:[jsxs("button",{ref:ee,className:"modal-v2-field",onClick:()=>ct(!oe),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:V.labels&&V.labels.length>0?jsx("span",{children:V.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(zn,{triggerRef:ee,isOpen:oe,onClose:()=>ct(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxs("button",{className:`modal-v2-popover-item ${V.labels?.includes(A)?"active":""}`,onClick:()=>st(A),children:[A,V.labels?.includes(A)&&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"})})]},A))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{yt(!Re),setTimeout(()=>Y.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:V.endDate?new Date(V.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Y,type:"date",value:typeof V.endDate=="string"?V.endDate.split("T")[0]:V.endDate?(()=>{let A=new Date(V.endDate),j=A.getUTCFullYear(),ae=String(A.getUTCMonth()+1).padStart(2,"0"),Ne=String(A.getUTCDate()).padStart(2,"0");return `${j}-${ae}-${Ne}`})():"",onChange:mt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>pt(!ft),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:V.estimatedTime?`${V.estimatedTime}h`:"Not set"})]}),ft&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:V.estimatedTime||"",onChange:A=>It(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>pt(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"})]}),$?jsx("textarea",{className:"modal-v2-textarea",value:V.description||"",onChange:A=>{if(S){let j={...S,description:A.target.value};R(j);}},onBlur:Ue,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>de(true),children:V.description?jsx("div",{className:"modal-v2-markdown",children:ge(V.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:[Z,"/",F.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>_e(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[F.map(A=>jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>fe(A.id),children:A.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:A.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ce(A.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"})]})})]},A.id)),xe&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:M,onChange:A=>W(A.target.value),onKeyDown:A=>{A.key==="Enter"&&z(),A.key==="Escape"&&(_e(false),W(""));},onBlur:z,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(D||C.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsx("h2",{children:"Attachments"}),C.length>0&&jsx("span",{className:"modal-v2-count",children:C.length})]}),jsx(Or,{cardId:V.id,attachments:C,onUpload:D?A=>D(V.id,A):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${O==="all"?"active":""}`,onClick:()=>q("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${O==="comments"?"active":""}`,onClick:()=>q("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${O==="history"?"active":""}`,onClick:()=>q("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:ot,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:re,onChange:A=>ke(A.target.value),onKeyDown:qe,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:Ke,disabled:!re.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[te.map(A=>{let j=s.find(Ne=>Ne.id===A.userId);if(A.type.includes("COMMENT")){let Ne=n.find(Pe=>Pe.id===A.metadata?.commentId);return Ne?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(A.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Ne.content})]})]},A.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.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"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:A.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.id)}),te.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function jh({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function Rl({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((d,c)=>d+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(jh,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,d)=>n+d.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,d)=>n+d.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,d)=>n+(d.planned||0),0)})]})]})]})}function ty({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function Ol({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=d;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ty,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke: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 cy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},mp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function uy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:d,y:c,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function gp({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 $l({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||cy[c.name]||mp[e.indexOf(c)%mp.length]})),d=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?uy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsx(Cell,{fill:d[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(gp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,l=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${l}%)`}})]}):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(gp,{})}),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:d[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 Gs=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=useState(false),[c,i]=useState(false),[u,l]=useState(false),[m,g]=useState(false);if(e.length===0)return null;let x=e.map(y=>y.id),b=y=>{r.onBulkUpdate?.(x,{priority:y}),d(false);},v=y=>{r.onBulkMove?.(x,y),i(false),a();},f=y=>{r.onBulkUpdate?.(x,{assignedUserIds:y}),l(false);},h=y=>{let k=new Set;e.forEach(D=>{D.labels?.forEach(T=>k.add(T));});let C=Array.from(new Set([...k,...y]));r.onBulkUpdate?.(x,{labels:C}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(y=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(y),children:[jsx("span",{className:p("asakaa-priority-dot",y==="LOW"&&"bg-asakaa-priority-low",y==="MEDIUM"&&"bg-asakaa-priority-medium",y==="HIGH"&&"bg-asakaa-priority-high",y==="URGENT"&&"bg-asakaa-priority-urgent")}),y]},y))})]}),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(y=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(y.id),children:y.title},y.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(y=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([y.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:y.color},children:y.initials}),y.name]},y.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(y=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([y]),children:y},y))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Gs.displayName="BulkOperationsToolbar";function by(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,c,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(g=>{let x=a?.find(b=>b.id===g);n=`assignee-${g}`,d=x?.name||`User ${g}`,c=x?.color,i=x?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,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];d=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:d,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}`,d=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:d,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 Hl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),d=useMemo(()=>by(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(i=>{n(u=>{let l=new Set(u);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsx(io,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:p("asakaa-swimlane-view",o),children:[d.map(i=>{let u=s.has(i.id),l=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:l};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":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(io,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),d.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var zl=[{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 Ul({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),d=zl.find(i=>i.value===e)||zl[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.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:p("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:d.icon}),jsx("span",{children:d.label}),jsx("svg",{className:p("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:zl.map(i=>jsxs("button",{onClick:()=>c(i.value),className:p("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 Un=[{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 xy(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,d=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&d&&c}function xp(e={}){let{shortcuts:t=Un,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];},[]),d=useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(xy(i,l)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function wy(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 Cy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=ky(e),r=t?wy(t):"";return a?`${a} + ${r}`:r}function Ty(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 Wl({shortcuts:e=Un,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function d(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=Ty(e);return jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([d,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"}),d]}),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:Cy(i)})]},i.action))})]},d))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Gl=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
85
+ `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=x=>{x.stopPropagation();let b=r<a.length-1?r+1:0;i(),o(b);},n.appendChild(l),n.appendChild(m),n.appendChild(g);}n.appendChild(d),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Sh(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 Eh(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 Pl(e){return e.startsWith("image/")}function Or({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=useState(false),[c,i]=useState(false),[u,l]=useState(null),m=useRef(null),g=useRef(e);g.current=e;let x=useCallback((T,L)=>{L.preventDefault(),L.stopPropagation();let B=g.current.filter($=>Pl($.type)),S=B.findIndex($=>$.id===T.id),R=$=>{let de=g.current.filter(X=>Pl(X.type)),F=de[$];F&&op(F.url,F.name,de,$,R);};op(T.url,T.name,B,S,R);},[]),b=useCallback(T=>{let L=[],B=[];return e.length+T.length>s?(B.push(`Maximum ${s} files allowed`),{valid:L,errors:B}):(T.forEach(S=>{if(S.size/1048576>r){B.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>S.type.match($))){B.push(`${S.name} has invalid file type`);return}L.push(S);}),{valid:L,errors:B})},[e.length,s,r,o]),v=useCallback(async T=>{let{valid:L,errors:B}=b(T);if(B.length>0){l(B.join(", ")),setTimeout(()=>l(null),5e3);return}if(L.length!==0){i(true),l(null);try{await t?.(L);}catch(S){l(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[b,t]),f=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(true);},[]),h=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);},[]),w=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),y=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);let L=Array.from(T.dataTransfer.files);v(L);},[v]),k=useCallback(T=>{let L=T.target.files?Array.from(T.target.files):[];v(L),m.current&&(m.current.value="");},[v]),C=useCallback(()=>{m.current?.click();},[]),D=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:h,onDragOver:w,onDrop:y,onClick:C,children:[jsx("input",{ref:m,type:"file",multiple:true,onChange:k,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"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Pl(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>x(T,L),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:Eh(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Sh(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>D(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function Ml({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:c=[],attachments:i=[],onAddComment:u,onDeleteComment:l,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:x,onGenerateSubtasks:b,onEstimateEffort:v,currentUserId:f="user-1"}){let[h,w]=useState("details"),[y,k]=useState(false),[C,D]=useState({}),[T,L]=useState(""),[B,S]=useState(false),[R,$]=useState({});if(!t||!e)return null;let de=useCallback(()=>{k(false),D({}),w("details"),L(""),$({}),a();},[a]),F=useCallback(()=>{r&&Object.keys(C).length>0&&(r(e.id,C),D({}),k(false));},[e.id,C,r]),X=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),de());},[e.id,o,de]),xe=useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),L(""));},[e.id,T,u]),_e=useCallback(async()=>{if(x){S(true);try{let O=await x(e);$(q=>({...q,assignees:O}));}catch(O){console.error("Failed to suggest assignee:",O);}finally{S(false);}}},[e,x]),M=useCallback(async()=>{if(b){S(true);try{let O=await b(e);$(q=>({...q,subtasks:O}));}catch(O){console.error("Failed to generate subtasks:",O);}finally{S(false);}}},[e,b]),W=useCallback(async()=>{if(v){S(true);try{let O=await v(e);$(q=>({...q,effort:O}));}catch(O){console.error("Failed to estimate effort:",O);}finally{S(false);}}},[e,v]),re={...e,...C},Ce=s.filter(O=>re.assignedUserIds?.includes(O.id));return jsx(At,{children:jsx("div",{className:"card-detail-overlay",onClick:de,children:jsxs("div",{className:"card-detail-modal",onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),y?jsx("input",{type:"text",value:C.title??re.title,onChange:O=>D({...C,title:O.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:re.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[y?jsxs(Fragment,{children:[jsx("button",{onClick:F,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{k(false),D({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>k(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:X,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:de,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${h==="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:()=>w("ai"),className:`card-detail-tab ${h==="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:[h==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),y?jsx("textarea",{value:C.description??re.description??"",onChange:O=>D({...C,description:O.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:re.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),y?jsx("select",{multiple:true,value:C.assignedUserIds??re.assignedUserIds??[],onChange:O=>{let q=Array.from(O.target.selectedOptions,J=>J.value);D({...C,assignedUserIds:q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(O=>jsx("option",{value:O.id,children:O.name},O.id))}):jsx("div",{className:"card-detail-users",children:Ce.length>0?Ce.map(O=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:O.color},children:O.initials}),jsx("span",{children:O.name})]},O.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),y?jsxs("select",{value:C.priority??re.priority??"",onChange:O=>D({...C,priority:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:re.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:re.labels&&re.labels.length>0?re.labels.map(O=>jsx("span",{className:"card-detail-label-tag",children:O},O)):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"}),y?jsx("input",{type:"date",value:C.startDate?new Date(C.startDate).toISOString().split("T")[0]:re.startDate?new Date(re.startDate).toISOString().split("T")[0]:"",onChange:O=>D({...C,startDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.startDate?new Date(re.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),y?jsx("input",{type:"date",value:C.endDate?new Date(C.endDate).toISOString().split("T")[0]:re.endDate?new Date(re.endDate).toISOString().split("T")[0]:"",onChange:O=>D({...C,endDate:O.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.endDate?new Date(re.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),y?jsx("input",{type:"number",min:"0",step:"0.5",value:C.estimatedTime??re.estimatedTime??"",onChange:O=>D({...C,estimatedTime:O.target.value?parseFloat(O.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:re.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:re.dependencies&&re.dependencies.length>0?re.dependencies.map(O=>{let q=typeof O=="string"?O:O.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",q.slice(-4)]},q)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:re.createdAt?new Date(re.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:T,onChange:O=>L(O.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:xe,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(O=>{let q=s.find(J=>J.id===O.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:[q&&jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:q?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(O.createdAt).toLocaleString()})]})]}),l&&jsx("button",{onClick:()=>l(O.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:O.content})]},O.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"})]})})]}),h==="activity"&&jsx("div",{className:"card-detail-activity",children:d.length>0?jsx("div",{className:"card-detail-activity-list",children:d.map(O=>{let q=s.find(J=>J.id===O.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[O.type.includes("CREATED")&&"\u2795",O.type.includes("UPDATED")&&"\u270F\uFE0F",O.type.includes("MOVED")&&"\u27A1\uFE0F",O.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",O.type.includes("COMMENT")&&"\u{1F4AC}",O.type.includes("ASSIGNED")&&"\u{1F464}",O.type.includes("PRIORITY")&&"\u{1F3AF}",O.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",O.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:q?.name||"Unknown"})," ",O.type.replace(/_/g," ").toLowerCase(),O.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:O.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(O.timestamp).toLocaleString()})]})]},O.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"})]})}),h==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Or,{cardId:e.id,attachments:i,onUpload:m?O=>m(e.id,O):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:_e,disabled:B||!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("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:M,disabled:B||!b,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:W,disabled:B||!v,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),R.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),R.assignees.map((O,q)=>{let J=s.find(pe=>pe.id===O.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:O.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(O.confidence*100).toFixed(0),"%"]})]})]},q)})]}),R.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),R.subtasks.map((O,q)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:O.title}),O.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:O.description}),O.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",O.estimatedTime,"h"]})]},q))]}),R.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:[R.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(R.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.map(O=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${O.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:O.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:O.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:O.description}),O.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",O.suggestedAction]})]},O.id))]}),!R.assignees&&!R.subtasks&&!R.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 zn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,c]=useState({top:0,left:0}),i=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,x=4,b=l.left;b+o>g-10&&(b=g-o-10),b<10&&(b=10);let v=m-l.bottom,f=l.top,h;return v>=s+x?h=l.bottom+x:f>=s+x?h=l.top-s-x:v>=f?h=l.bottom+x:h=Math.max(10,l.top-s-x),{top:h,left:b}},[e,o,s]);return useEffect(()=>{t&&c(u());},[t,u]),useEffect(()=>{if(!t)return;let l=g=>{let x=g.target;i.current&&!i.current.contains(x)&&e.current&&!e.current.contains(x)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",l);}},[t,a,e]),useEffect(()=>{if(!t)return;let l=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsx(At,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var tt={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 Rh=["LOW","MEDIUM","HIGH","URGENT"],Oh=["todo","in-progress","review","done"];function Il({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:c,onDeleteComment:i,currentUser:u,onAIGenerateDescription:l,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:x=[],availableLabels:b=[],availableTags:v=[],onCreateTag:f,onUploadCoverImage:h,unsplashAccessKey:w,theme:y,onSubtasksChange:k,attachments:C=[],onUploadAttachments:D,onDeleteAttachment:T}){let L=qo(),B=y||L?.themeName||"dark",[S,R]=useState(e),[$,de]=useState(false),[F,X]=useState(()=>[...e?.subtasks||[]].sort((j,ae)=>(j.position??0)-(ae.position??0))),[xe,_e]=useState(false),[M,W]=useState(""),[re,Ce]=useState(""),[O,q]=useState("all"),[J,pe]=useState(false),[Be,ze]=useState(false),[it,nt]=useState(false),[oe,ct]=useState(false),[Re,yt]=useState(false),[ft,pt]=useState(false),Te=useRef(null),Xe=useRef(null),ot=useRef(null),Qe=useRef(null),H=useRef(null),se=useRef(null),N=useRef(null),Y=useRef(null),ie=useRef(null),he=useRef(null),_=useRef(null),ee=useRef(null);useEffect(()=>{if(e&&!S){R({...e});let A=[...e.subtasks||[]].sort((j,ae)=>(j.position??0)-(ae.position??0));X(A);}else if(e&&S&&e.id!==S.id){R({...e});let A=[...e.subtasks||[]].sort((j,ae)=>(j.position??0)-(ae.position??0));X(A);}},[e,S]),useEffect(()=>{let A=j=>{let ae=j.target;Qe.current&&!Qe.current.contains(ae)&&pe(false),H.current&&!H.current.contains(ae)&&ze(false),se.current&&!se.current.contains(ae)&&nt(false),N.current&&!N.current.contains(ae)&&ct(false);};if(J||Be||it||oe)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[J,Be,it,oe]),useEffect(()=>{if(!t)return;let A=j=>{let ae=j.target,Ne=ae.tagName==="INPUT"||ae.tagName==="TEXTAREA"||ae.isContentEditable;if(j.key==="Escape"){j.preventDefault(),J||Be||it||oe||Re||ft?(pe(false),ze(false),nt(false),ct(false),yt(false),pt(false)):Ne||a();return}if(Ne&&j.key!=="Escape")return;let Pe=j.metaKey||j.ctrlKey;switch(j.key.toLowerCase()){case "s":j.preventDefault(),pe(true);break;case "a":j.preventDefault(),nt(true);break;case "p":j.preventDefault(),ze(true);break;case "l":j.preventDefault(),ct(true);break;case "d":Pe||(j.preventDefault(),yt(true),setTimeout(()=>Y.current?.focus(),0));break;case "e":Pe||(j.preventDefault(),pt(true));break;case "i":j.preventDefault(),de(true),setTimeout(()=>Xe.current?.focus(),0);break;case "t":j.preventDefault(),_e(true);break;case "c":j.preventDefault(),ot.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,J,Be,it,oe,Re,ft]);let Ve=useCallback(A=>{let j=A.currentTarget.textContent?.trim()||"";if(S&&j!==S.title){let ae={...S,title:j};R(ae),r?.(S.id,{title:j});}},[S,r]),ve=useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=S?.title||"",A.currentTarget.blur());},[S]),Ue=useCallback(()=>{S&&e&&S.description!==e.description&&r?.(S.id,{description:S.description}),de(false);},[S,e,r]),Se=useCallback(A=>{if(S){let j={...S,columnId:A};R(j),r?.(S.id,{columnId:A}),pe(false);}},[S,r]),He=useCallback(A=>{if(S){let j={...S,priority:A};R(j),r?.(S.id,{priority:A}),ze(false);}},[S,r]),lt=useCallback(A=>{if(S){let j=S.assignedUserIds||[],ae=j.includes(A)?j.filter(Pe=>Pe!==A):[...j,A],Ne={...S,assignedUserIds:ae};R(Ne),r?.(S.id,{assignedUserIds:ae});}},[S,r]),st=useCallback(A=>{if(S){let j=S.labels||[],ae=j.includes(A)?j.filter(Pe=>Pe!==A):[...j,A],Ne={...S,labels:ae};R(Ne),r?.(S.id,{labels:ae});}},[S,r]),dt=useCallback(A=>{if(S){let j={...S,tags:A};R(j),r?.(S.id,{tags:A});}},[S,r]),mt=useCallback(A=>{if(S){let j=A.target.value,ae={...S,endDate:j};R(ae),r?.(S.id,{endDate:j}),yt(false);}},[S,r]),It=useCallback(A=>{if(S){let j={...S,estimatedTime:parseFloat(A)||0};R(j),r?.(S.id,{estimatedTime:parseFloat(A)||0});}},[S,r]),z=useCallback(()=>{if(M.trim()&&S){let A={id:`subtask-${Date.now()}`,title:M.trim(),completed:false,position:F.length,createdAt:new Date},j=[...F,A];X(j),W(""),_e(false),k?.(S.id,j);}},[M,F,S,k]),fe=useCallback(A=>{let j=F.map(ae=>ae.id===A?{...ae,completed:!ae.completed,updatedAt:new Date}:ae);X(j),S&&k?.(S.id,j);},[F,S,k]),we=useCallback(A=>{let j=F.filter(ae=>ae.id!==A);X(j),S&&k?.(S.id,j);},[F,S,k]),Ke=useCallback(()=>{re.trim()&&S&&c&&(c(S.id,re.trim()),Ce(""));},[re,S,c]),qe=useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),Ke());},[Ke]),ge=A=>jsx(Lh,{remarkPlugins:[Ih],rehypePlugins:[Bh],components:{a:({node:j,...ae})=>jsx("a",{...ae,target:"_blank",rel:"noopener noreferrer"})},children:A}),te=d.filter(A=>O==="comments"?A.type.includes("COMMENT"):O==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let V=S||e,me=s.filter(A=>V.assignedUserIds?.includes(A.id)),Z=F.filter(A=>A.completed).length;return jsx(At,{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:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":B,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:Te,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ve,onKeyDown:ve,children:V.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:Qe,children:[jsxs("button",{ref:ie,className:"modal-v2-field",onClick:()=>pe(!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:V.columnId||"No status"})]}),jsx(zn,{triggerRef:ie,isOpen:J,onClose:()=>pe(false),width:250,estimatedHeight:200,children:(x.length>0?x:Oh.map(A=>({id:A,title:A}))).map(A=>jsx("button",{className:`modal-v2-popover-item ${V.columnId===A.id?"active":""}`,onClick:()=>Se(A.id),children:A.title},A.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:se,children:[jsxs("button",{ref:he,className:"modal-v2-field",onClick:()=>nt(!it),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:me.length>0?jsx("div",{className:"modal-v2-avatars",children:me.map(A=>jsx("div",{className:"modal-v2-avatar",style:{background:A.color},title:A.name,children:A.initials},A.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(zn,{triggerRef:he,isOpen:it,onClose:()=>nt(false),width:280,estimatedHeight:300,children:s.map(A=>jsxs("button",{className:`modal-v2-popover-item ${V.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>lt(A.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,V.assignedUserIds?.includes(A.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"})})]},A.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxs("button",{ref:_,className:"modal-v2-field",onClick:()=>ze(!Be),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:V.priority||"None"})]}),jsxs(zn,{triggerRef:_,isOpen:Be,onClose:()=>ze(false),width:180,estimatedHeight:220,children:[Rh.map(A=>jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${V.priority===A?"active":""}`,onClick:()=>He(A),children:A},A)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>He(""),children:"None"})]})]}),v.length>0||f?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(oo,{selectedTags:V.tags||[],availableTags:v,onChange:dt,onCreateTag:f,theme:tt[B]||tt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:N,children:[jsxs("button",{ref:ee,className:"modal-v2-field",onClick:()=>ct(!oe),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:V.labels&&V.labels.length>0?jsx("span",{children:V.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(zn,{triggerRef:ee,isOpen:oe,onClose:()=>ct(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxs("button",{className:`modal-v2-popover-item ${V.labels?.includes(A)?"active":""}`,onClick:()=>st(A),children:[A,V.labels?.includes(A)&&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"})})]},A))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{yt(!Re),setTimeout(()=>Y.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:V.endDate?new Date(V.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Y,type:"date",value:typeof V.endDate=="string"?V.endDate.split("T")[0]:V.endDate?(()=>{let A=new Date(V.endDate),j=A.getUTCFullYear(),ae=String(A.getUTCMonth()+1).padStart(2,"0"),Ne=String(A.getUTCDate()).padStart(2,"0");return `${j}-${ae}-${Ne}`})():"",onChange:mt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>pt(!ft),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:V.estimatedTime?`${V.estimatedTime}h`:"Not set"})]}),ft&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:V.estimatedTime||"",onChange:A=>It(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>pt(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"})]}),$?jsx("textarea",{className:"modal-v2-textarea",value:V.description||"",onChange:A=>{if(S){let j={...S,description:A.target.value};R(j);}},onBlur:Ue,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>de(true),children:V.description?jsx("div",{className:"modal-v2-markdown",children:ge(V.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:[Z,"/",F.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>_e(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[F.map(A=>jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>fe(A.id),children:A.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:A.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>we(A.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"})]})})]},A.id)),xe&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:M,onChange:A=>W(A.target.value),onKeyDown:A=>{A.key==="Enter"&&z(),A.key==="Escape"&&(_e(false),W(""));},onBlur:z,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(D||C.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsx("h2",{children:"Attachments"}),C.length>0&&jsx("span",{className:"modal-v2-count",children:C.length})]}),jsx(Or,{cardId:V.id,attachments:C,onUpload:D?A=>D(V.id,A):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${O==="all"?"active":""}`,onClick:()=>q("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${O==="comments"?"active":""}`,onClick:()=>q("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${O==="history"?"active":""}`,onClick:()=>q("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:ot,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:re,onChange:A=>Ce(A.target.value),onKeyDown:qe,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:Ke,disabled:!re.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[te.map(A=>{let j=s.find(Ne=>Ne.id===A.userId);if(A.type.includes("COMMENT")){let Ne=n.find(Pe=>Pe.id===A.metadata?.commentId);return Ne?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(A.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Ne.content})]})]},A.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.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"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:A.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.id)}),te.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function jh({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function Rl({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((d,c)=>d+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(jh,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,d)=>n+d.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,d)=>n+d.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,d)=>n+(d.planned||0),0)})]})]})]})}function ty({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function Ol({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=d;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ty,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke: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 cy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},mp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function uy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:d,y:c,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function gp({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 $l({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||cy[c.name]||mp[e.indexOf(c)%mp.length]})),d=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?uy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsx(Cell,{fill:d[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(gp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,l=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${l}%)`}})]}):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(gp,{})}),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:d[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 Gs=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=useState(false),[c,i]=useState(false),[u,l]=useState(false),[m,g]=useState(false);if(e.length===0)return null;let x=e.map(y=>y.id),b=y=>{r.onBulkUpdate?.(x,{priority:y}),d(false);},v=y=>{r.onBulkMove?.(x,y),i(false),a();},f=y=>{r.onBulkUpdate?.(x,{assignedUserIds:y}),l(false);},h=y=>{let k=new Set;e.forEach(D=>{D.labels?.forEach(T=>k.add(T));});let C=Array.from(new Set([...k,...y]));r.onBulkUpdate?.(x,{labels:C}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(x),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(y=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(y),children:[jsx("span",{className:p("asakaa-priority-dot",y==="LOW"&&"bg-asakaa-priority-low",y==="MEDIUM"&&"bg-asakaa-priority-medium",y==="HIGH"&&"bg-asakaa-priority-high",y==="URGENT"&&"bg-asakaa-priority-urgent")}),y]},y))})]}),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(y=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(y.id),children:y.title},y.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(y=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([y.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:y.color},children:y.initials}),y.name]},y.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(y=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([y]),children:y},y))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Gs.displayName="BulkOperationsToolbar";function by(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,c,i;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(g=>{let x=a?.find(b=>b.id===g);n=`assignee-${g}`,d=x?.name||`User ${g}`,c=x?.color,i=x?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,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];d=m.title,c=m.color,r.has(n)||r.set(n,{id:n,title:d,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}`,d=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:d,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 Hl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),d=useMemo(()=>by(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(i=>{n(u=>{let l=new Set(u);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsx(io,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:p("asakaa-swimlane-view",o),children:[d.map(i=>{let u=s.has(i.id),l=e.cards.filter(g=>i.cardIds.includes(g.id)),m={...e,cards:l};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":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(io,{board:m,callbacks:r,availableUsers:a})})]},i.id)}),d.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var zl=[{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 Ul({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),d=zl.find(i=>i.value===e)||zl[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.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:p("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:d.icon}),jsx("span",{children:d.label}),jsx("svg",{className:p("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:zl.map(i=>jsxs("button",{onClick:()=>c(i.value),className:p("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 Un=[{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 xy(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,d=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&d&&c}function xp(e={}){let{shortcuts:t=Un,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];},[]),d=useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(xy(i,l)){r&&i.preventDefault();let m=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function wy(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 Cy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=ky(e),r=t?wy(t):"";return a?`${a} + ${r}`:r}function Ty(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 Wl({shortcuts:e=Un,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function d(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=Ty(e);return jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([d,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"}),d]}),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:Cy(i)})]},i.action))})]},d))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Gl=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
86
86
  1.
87
87
 
88
88
  **Expected behavior:**
@@ -122,12 +122,12 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
122
122
  1.
123
123
 
124
124
  **Action items:**
125
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},c=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxs("div",{className:p("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:p("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(l=>jsxs("button",{onClick:()=>d(l),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:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.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 jl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=useState("export"),[c,i]=useState("json"),[u,l]=useState(null),m=useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,v=await Vc(e,c,b);_c(v,c);},x=async b=>{let v=b.target.files?.[0];if(v){try{let f=await Yc(v),h=v.name.endsWith(".json")?"json":"csv",w=Kc(f,h);l(w),w.success&&r&&r(w,f);}catch(f){l({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>d("export"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>d("import"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(b=>jsxs("button",{onClick:()=>i(b),className:p("p-4 rounded-lg border-2 transition-all text-center",c===b?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:m,type:"file",accept:".json,.csv",onChange:x,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"})]})]}),u&&jsxs("div",{className:p("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:p("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,v)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},v))})]})]})]})]})]})}var Fy=["URGENT","HIGH","MEDIUM","LOW"],Py=[{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"}],My=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Kl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:m=false,groupBy:g="none",onGroupByChange:x}){let[b,v]=useState(true),f=useCallback(C=>{a({search:C.target.value});},[a]),h=useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=useCallback(C=>{r({by:C.target.value});},[r]),y=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>v(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&jsxs("div",{className:"filter-bar__content",children:[l&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:C=>{let D=C.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Fy.map(C=>jsx("option",{value:C,children:C},C))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let D=C.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(C=>jsx("option",{value:C.id,children:C.name},C.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let D=C.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(C=>jsx("option",{value:C,children:C},C))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:w,className:"filter-bar__select filter-bar__select--sm",children:Py.map(C=>jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:C=>x(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:My.map(C=>jsx("option",{value:C.value,children:C.label},C.value))})}),k&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Yl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:c}){let[i,u]=useState(false),l=useRef(null);useEffect(()=>{let g=x=>{l.current&&!l.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),u(false);};return jsxs("div",{className:p("relative",r),ref:l,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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 d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>m(()=>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 ql={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"}},Xl={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"}},Jl={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"}},Mo={dark:ql,light:Xl,neutral:Jl},_s="dark";var js=createContext(void 0),Uy="asakaa-theme";function kp({children:e,defaultTheme:t=_s,storageKey:a=Uy}){let[r,o]=useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,c=Mo[r];Object.entries(c.colors).forEach(([u,l])=>{l&&d.style.setProperty(`--theme-${Wy(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let m=c.colors[u];m&&d.style.setProperty(l,m);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Mo};return jsx(js.Provider,{value:n,children:e})}function nn(){let e=useContext(js);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Wy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ql({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=nn();return e?jsxs("div",{className:p("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(Mo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:p("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 Cp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return tt[e]||tt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",tt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",tt[e].bgSecondary),bgGrid:r("--theme-bg-card",tt[e].bgGrid),bgWeekend:r("--theme-bg-hover",tt[e].bgWeekend),border:r("--theme-border-primary",tt[e].border),borderLight:r("--theme-border-subtle",tt[e].borderLight),textPrimary:r("--theme-text-primary",tt[e].textPrimary),textSecondary:r("--theme-text-secondary",tt[e].textSecondary),textTertiary:r("--theme-text-tertiary",tt[e].textTertiary),accent:r("--theme-accent-primary",tt[e].accent),accentHover:r("--theme-accent-hover",tt[e].accentHover),accentLight:r("--theme-accent-primary",tt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",tt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",tt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",tt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",tt[e].dependency),dependencyHover:r("--theme-border-secondary",tt[e].dependencyHover),criticalPath:r("--theme-error",tt[e].criticalPath),criticalPathLight:r("--theme-error",tt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",tt[e].today):e==="neutral"?r("--theme-text-primary",tt[e].today):r("--theme-error",tt[e].today),todayLight:e==="light"?r("--theme-accent-primary",tt[e].todayLight):e==="neutral"?r("--theme-text-primary",tt[e].todayLight):r("--theme-error",tt[e].todayLight),milestone:r("--theme-warning",tt[e].milestone),milestoneLight:r("--theme-warning",tt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",tt[e].statusTodo),statusInProgress:r("--theme-accent-primary",tt[e].statusInProgress),statusCompleted:r("--theme-success",tt[e].statusCompleted),hoverBg:r("--theme-bg-hover",tt[e].hoverBg),focusRing:r("--theme-accent-primary",tt[e].focusRing),...tt[e].dotGrid&&{dotGrid:tt[e].dotGrid},...tt[e].glassHeader&&{glassHeader:tt[e].glassHeader},...tt[e].glassToolbar&&{glassToolbar:tt[e].glassToolbar},...tt[e].forecastHud&&{forecastHud:tt[e].forecastHud},...tt[e].neonRedGlow&&{neonRedGlow:tt[e].neonRedGlow},...tt[e].executionBarBg&&{executionBarBg:tt[e].executionBarBg}}}var Ks={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"}},Tp={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"}},Zl={en:Ks,es:Tp};function Np(e){return Zl[e]||Zl.en}function ed(e,t){let a=Np(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 ln=createContext(Ks);function Nr(){return useContext(ln)}function Xs(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),d=n.bottom+4,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:d,left:c});},[t,a,e,r]),o}function Sp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,d]=useState(false),[c,i]=useState(null),[u,l]=useState(false),m=useRef(null),g=useRef(null),x=Nr(),b=Xs(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=x.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let k=C=>{let D=C.target;m.current&&!m.current.contains(D)&&g.current&&!g.current.contains(D)&&d(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let h=[{id:"png",label:x.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:x.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:x.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:x.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(k=>k.handler),w=async(k,C)=>{if(C){i(k);try{await C();}catch(D){console.error(`Export ${k} failed:`,D);}finally{i(null),d(false);}}},y=()=>{s?.(),l(true),setTimeout(()=>l(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>d(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:x.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((k,C)=>jsxs(motion.button,{onClick:()=>w(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:y,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:u?x.toolbar.copied:x.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function gx({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 fx({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 Ep({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),d=useRef(null),c=Nr(),i=Xs(n,o,"left");useEffect(()=>{if(!o)return;let m=g=>{let x=g.target;n.current&&!n.current.contains(x)&&d.current&&!d.current.contains(x)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],l=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"}: ${l}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:l})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((m,g)=>{let x=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:x?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:x?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:x?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:x?600:500},children:m.label}),x&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Fp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),d=useRef(null),c=useRef(null),i=Nr(),u=Xs(d,s,"left");useEffect(()=>{if(!s)return;let x=setTimeout(()=>{let b=f=>{let h=f.target;d.current&&!d.current.contains(h)&&c.current&&!c.current.contains(h)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(x),c._cleanup&&c._cleanup();}},[s]);let l=[{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:d,onClick:x=>{x.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children: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:u.top,left:u.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:l.map(x=>{let b=t===x.value&&!r,v=()=>x.value==="all"?b?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):x.icon;return jsxs(motion.button,{onClick:()=>{a(x.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${b?x.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:x.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},x.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 bx({value:e,onChange:t,theme:a}){let r=Nr(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let d=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:d?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:d?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function hx({theme:e,forecast:t}){let a=Nr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,d=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,l=t?.costAtCompletion,m=t?.currency||"$",g=l!=null?l>=1e6?`${m}${(l/1e6).toFixed(2)}M`:l>=1e3?`${m}${(l/1e3).toFixed(1)}K`:`${m}${l.toFixed(0)}`:"\u2014",x=t?.budgetVariancePercent,b=x!=null&&x!==0,v=x!=null?x>0?`+${x.toFixed(0)}% ${a.toolbar.budgetOver}`:`${x.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=x!=null&&x>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:x!=null&&x<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&d&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:d})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),b&&v&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function yx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:d,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u}){let[l,m]=useState(false),g=useRef(null),x=useRef(null),b=Nr(),v=Xs(g,l,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!l)return;let y=k=>{let C=k.target;g.current&&!g.current.contains(C)&&x.current&&!x.current.contains(C)&&m(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]);let h=[{key:"criticalPath",label:b.toolbar.visibility==="Visibilidad"?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a},{key:"baselines",label:b.toolbar.visibility==="Visibilidad"?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:b.toolbar.visibility==="Visibilidad"?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:b.toolbar.visibility==="Visibilidad"?"Dependencias":"Dependencies",icon:GitBranch,active:d,onChange:c}],w=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>m(!l),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:l?e.accent:e.textTertiary,backgroundColor:l?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:l&&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:v.top,left:v.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:h.map((y,k)=>{let C=y.icon;return jsxs(motion.button,{onClick:()=>y.onChange?.(!y.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:y.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:y.label}),y.active&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),w.map((y,k)=>{let C=i===y.value;return jsxs(motion.button,{onClick:()=>u(y.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(h.length+k)*.03},children:[jsx("span",{style:{color:C?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:y.label}),C&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.value)})]})]})}),document.body)]})}function Js({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:x,hideCompleted:b=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:h,onWbsLevelChange:w,maxWbsDepth:y=4,viewMode:k="execution",onViewModeChange:C,projectForecast:D,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportCSV:S,onExportJSON:R,onExportMSProject:$,showCriticalPath:de=true,onShowCriticalPathChange:F,showDependencies:X=true,onShowDependenciesChange:xe,highlightWeekends:_e=true,onHighlightWeekendsChange:M,showBaseline:W=false,onShowBaselineChange:re,onCopySnapshotLink:ke}){let O=Nr(),q=T||L||B||S||R||$,J=!!e.glassToolbar,[pe,Be]=useState(false),ze=useRef(null);useEffect(()=>{pe&&ze.current&&ze.current.focus();},[pe]);let it=[{value:"day",label:O.toolbar.day},{value:"week",label:O.toolbar.week},{value:"month",label:O.toolbar.month}],nt=[{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"})}],oe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(J){let ct=oe?"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:oe?"#1A1A1A":e.bgSecondary,border:`1px solid ${oe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:pe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Be(!pe),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"})}),pe&&jsx("input",{ref:ze,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:()=>Be(false),onKeyDown:Re=>{Re.key==="Escape"&&Be(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),C&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:oe?"#000000":e.bgSecondary,border:`1px solid ${oe?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="execution"?oe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:k==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="execution"?{color:e.textSecondary}:{},children:O.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="oracle"?oe?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:k==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="oracle"?{color:e.textSecondary}:{},children:O.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(bx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),w&&jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),jsx(yx,{theme:e,showCriticalPath:de,onShowCriticalPathChange:F,showBaseline:W,onShowBaselineChange:re,highlightWeekends:_e,onHighlightWeekendsChange:M,showDependencies:X,onShowDependenciesChange:xe,rowDensity:d,onRowDensityChange:c}),jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportMSProject:$,onCopySnapshotLink:ke}),u&&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 ${oe?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${oe?"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:l||O.toolbar.createTask})]})]})]}),D&&jsx(hx,{theme:e,forecast:D})]})}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(fx,{options:it,value:t,onChange:ct=>a(ct),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&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:l||O.toolbar.createTask})]}),(q||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportMSProject:$,onCopySnapshotLink:ke}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(gx,{options:nt,value:s,onChange:ct=>n(ct),theme:e})]})]})}function Qs({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),d=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let u=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();n({x:u.left,y:u.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(At,{children:jsx(motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function un({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[d,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,l=r.length*36+8,m=8,g=window.innerWidth,x=window.innerHeight,b=t,v=a;t+u+m>g&&(b=t-u,b<m&&(b=m)),a+l+m>x&&(v=x-l-m,v<m&&(v=m)),c({x:b,y:v});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=m=>{n.current&&!n.current.contains(m.target)&&o();},l=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:l=>{u.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Vt={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 Op({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:m=true}){let g=useRef(false),x=useCallback(w=>{g.current=w;},[]),b=useCallback(w=>{let y=[],k=C=>{for(let D of C)y.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&k(D.subtasks);};return k(w),y},[]),v=useCallback(()=>{let w=b(e);for(let y of w)if(t.has(y.id))return y;return null},[e,t,b]),f=useCallback((w,y)=>{let k=b(e);if(k.length===0)return;let C=v();if(!C){a(k[0].id,false);return}let D=k.findIndex(B=>B.id===C.id);if(D===-1)return;let T=w==="up"?D-1:D+1;if(T<0||T>=k.length)return;let L=k[T];a(L.id,y);},[e,v,b,a]),h=useCallback(w=>{if(!m)return;let y=w.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||g.current){w.key==="Escape"&&(y.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),L=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(L&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!L.isExpanded||w.key==="ArrowLeft"&&L.isExpanded)&&u(L.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),d(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),c(T));return}if(w.key==="Enter"&&!w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"above"));return}if(w.key==="Enter"&&D){L&&(w.preventDefault(),l(L.id));return}if(w.key==="F2"){L&&(w.preventDefault(),i(L.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&D&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,d,c,i,u,l]);return useEffect(()=>{if(m)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[m,h]),{setIsEditing:x}}function Hp(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(l=>{t(new Set([l])),r(l);},[]),s=useCallback(l=>{t(m=>{let g=new Set(m);return g.has(l)?g.delete(l):g.add(l),g}),r(l);},[]),n=useCallback((l,m)=>{if(!a){o(l);return}let g=m.indexOf(a),x=m.indexOf(l);if(g===-1||x===-1){o(l);return}let b=Math.min(g,x),v=Math.max(g,x),f=m.slice(b,v+1);t(new Set(f)),r(l);},[a,o]),d=useCallback((l,m,g,x)=>{x?n(l,m):g?s(l):o(l);},[o,s,n]),c=useCallback((l,m)=>{m?t(g=>{let x=new Set(g);return x.add(l),x}):o(l);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function rd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?rd(t.subtasks):t.subtasks}))}function pn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((d,c)=>(d.position??0)-(c.position??0));for(let d=0;d<n.length;d++){let c={...n[d],parentId:o,level:s,position:n[d].position??d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Zs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Zs(a.subtasks,t);if(r)return r}}return null}function ad(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ad(a.subtasks,t);if(r)return r}return null}function od(e,t){if(t.length===0)return e;let a=pn(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 x=[];return {tasks:m.filter(v=>{if(g.has(v.id))return x.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,x.push(...f.removed);}return true}),removed:x}},d=(m,g,x)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...x],isExpanded:true}:b.subtasks?{...b,subtasks:d(b.subtasks,g,x)}:b),c=new Set(t),{tasks:i,removed:u}=n(e,c),l=d(i,s.id,u);return rd(l)}function nd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ad(a,r);if(!o)continue;let s=ad(a,o.id),n=(i,u,l)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===u&&g.subtasks){let x=g.subtasks.findIndex(b=>b.id===l);if(x!==-1){let[b]=g.subtasks.splice(x,1);return b}}if(g.subtasks){let x=n(g.subtasks,u,l);if(x)return x}}return null},d=(i,u,l)=>{let m=i.findIndex(g=>g.id===u);if(m!==-1)return i.splice(m+1,0,l),i;for(let g of i)g.subtasks&&d(g.subtasks,u,l);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?d(s.subtasks,o.id,c):d(a,o.id,c));}return rd(a)}function sd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,c)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],n[i]={...n[i],position:i},n[u]={...n[u],position:u},true)};return s(r,o,a),r}function id(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 Gn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((u,l)=>({...u,id:`${u.id}-copy-${Date.now()}-${l}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${l}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let x=n(g.subtasks);if(x)return x}return null}let u=c[i],l=`${u.id}-copy-${Date.now()}`,m={...u,id:l,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,l):void 0};return c.splice(i+1,0,m),m},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function zp(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},d=c=>{let i=c.findIndex(l=>l.id===t);if(i===-1){for(let l of c)if(l.subtasks&&d(l.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,n),true};return d(r),{tasks:r,newTask:n}}function ld(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ld(r.subtasks,t,a)}:r)}function dd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:dd(a.subtasks,t)}:a)}function cd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let x=a(g.subtasks);if(x)return x}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let x=c(g.subtasks);if(x>=0)return x}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#2E94FF",position:i,parentId:t},l=m=>m.map(g=>{if(g.id===t){let x=g.subtasks||[];return {...g,subtasks:[...x,u],isExpanded:true}}return g.subtasks?{...g,subtasks:l(g.subtasks)}:g});return {tasks:l(e),newTask:u}}function Up(e,t,a,r){if(t===a)return e;let o=Zs(e,t);if(!o)return e;if(a){let d=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||d(u,i))return true;return false};if(d(o,a))return e}let s=d=>{let c=d.filter(u=>u.id!==t),i=c.length<d.length;return c.map((u,l)=>{let m=i?{...u,position:l}:u;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let d=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],l=r!==void 0?r:u.length,m=[...u];m.splice(l,0,{...o,parentId:a});let g=m.map((x,b)=>({...x,position:b}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function fr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=fr(t.subtasks),r=a.reduce((d,c)=>(c.startDate&&d.starts.push(new Date(c.startDate).getTime()),c.endDate&&d.ends.push(new Date(c.endDate).getTime()),d.progresses.push(c.progress??0),d),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((d,c)=>d+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ti({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:m,onTaskUpdate:g,onTaskIndent:x,onTaskOutdent:b,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:h,onTaskCreate:w,onTaskRename:y,onCreateSubtask:k,onOpenTaskModal:C,onDeleteRequest:D,onTaskReparent:T,scrollContainerRef:L}){let B=useContext(ln),[S,R]=useState(null),[$,de]=useState(null),[F,X]=useState(""),xe=useRef(null),[_e,M]=useState(null),[W,re]=useState(0),[ke,O]=useState(0),[q,J]=useState({isOpen:false,x:0,y:0,type:"header"}),[pe,Be]=useState(null),[ze,it]=useState(null),[nt,oe]=useState(null),ct=useRef(0),Re=5,yt=useRef(false),[ft,pt]=useState(null),[Te,Xe]=useState(false),ot=useRef(null),[Qe,H]=useState(null),[se,N]=useState(false),Y=useRef(null);useEffect(()=>{function V(me){Y.current&&!Y.current.contains(me.target)&&N(false);}if(se)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[se]),useEffect(()=>{$&&xe.current&&(xe.current.focus(),xe.current.select());},[$]),useEffect(()=>{if(!_e)return;let V=Z=>{let A=Z.clientX-W,j=ke+A;m?.(_e,j);},me=()=>{M(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[_e,W,ke,m]);let{selectedTaskIds:ie,handleTaskClick:he,isTaskSelected:_}=Hp(),{setIsEditing:ee}=Op({tasks:e,selectedTaskIds:ie,onTaskSelect:(V,me)=>{let A=pn(e).map(j=>j.id);he(V,A,me||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:V=>{let me=pn(e).find(Z=>Z.id===V);me&&lt(me);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:V=>{let me=pn(e).find(Z=>Z.id===V);me&&C&&C(me);},enableKeyboard:true}),Ve=(V,me=0,Z="")=>{let A=[],j=[...V].sort((ae,Ne)=>(ae.position??0)-(Ne.position??0));for(let ae=0;ae<j.length;ae++){let Ne=j[ae],Pe=ae+1,Ye=Z?`${Z}.${Pe}`:`${Pe}.0`;if(Ne.wbsCode=Ye,A.push({task:Ne,level:me}),Ne.subtasks&&Ne.subtasks.length>0&&Ne.isExpanded){let Oe=Z?`${Z}.${Pe}`:`${Pe}`;A.push(...Ve(Ne.subtasks,me+1,Oe));}}return A},ve=Ve(e),Ue=48,Se=Math.max(ve.length*a,600-Ue),He=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,lt=V=>{de(V.id),X(V.name),ee(true);},st=V=>{F.trim()&&F!==e.find(me=>me.id===V)?.name&&y?.(V,F.trim()),de(null),X(""),ee(false);},dt=()=>{de(null),X(""),ee(false);},mt=(V,me)=>{me.stopPropagation(),k?.(V.id);},It=(V,me)=>{me.preventDefault(),ct.current=me.clientY,Be(V),yt.current=false,Xe(false),pt({x:me.clientX,y:me.clientY});},z=V=>{if(!pe||(Math.abs(V.clientY-ct.current)>Re&&!yt.current&&(yt.current=true,Xe(true)),pt({x:V.clientX,y:V.clientY}),!yt.current))return;if(L?.current){let ae=L.current,Ne=ae.getBoundingClientRect(),Pe=60,Ye=12;ot.current&&(cancelAnimationFrame(ot.current),ot.current=null);let Oe=V.clientY-Ne.top,Dt=Ne.bottom-V.clientY;if(Oe<Pe&&ae.scrollTop>0){let gt=Math.round(Ye*(1-Oe/Pe)),Ut=()=>{ae.scrollTop-=gt,yt.current&&ae.scrollTop>0&&(ot.current=requestAnimationFrame(Ut));};ot.current=requestAnimationFrame(Ut);}else if(Dt<Pe&&ae.scrollTop<ae.scrollHeight-ae.clientHeight){let gt=Math.round(Ye*(1-Dt/Pe)),Ut=()=>{ae.scrollTop+=gt,yt.current&&ae.scrollTop<ae.scrollHeight-ae.clientHeight&&(ot.current=requestAnimationFrame(Ut));};ot.current=requestAnimationFrame(Ut);}}let Z=document.querySelectorAll("[data-task-row]"),A=null,j=null;Z.forEach(ae=>{let Ne=ae.getBoundingClientRect(),Pe=ae.getAttribute("data-task-row");if(Pe&&Pe!==pe&&V.clientY>=Ne.top&&V.clientY<=Ne.bottom){A=Pe;let Ye=V.clientY-Ne.top,Oe=Ne.height;Ye<Oe*.25?j="above":Ye>Oe*.75?j="below":j="child";}}),it(A),oe(j);},fe=()=>{if(yt.current&&pe&&ze&&nt){if(nt==="child")T?.(pe,ze);else if(nt==="above"||nt==="below"){let V=(j,ae,Ne=null)=>{for(let Pe of j){if(Pe.id===ae)return Ne;if(Pe.subtasks){let Ye=V(Pe.subtasks,ae,Pe.id);if(Ye!==void 0)return Ye}}},me=V(e,pe,null),Z=V(e,ze,null),A=(j,ae,Ne,Pe)=>{let Ye=j.findIndex(gt=>gt.id===ae),Oe=Pe?j.findIndex(gt=>gt.id===Ne):-1,Dt=nt==="below"?Ye+1:Ye;return Pe&&Oe!==-1&&Oe<Ye&&(Dt-=1),Math.max(0,Dt)};if(Z===null){let ae=A(e,ze,pe,me===null);T?.(pe,null,ae);}else {let j=ve.find(ae=>ae.task.id===Z)?.task;if(j?.subtasks){let ae=me===Z,Ne=A(j.subtasks,ze,pe,ae);T?.(pe,Z,Ne);}}}}ot.current&&(cancelAnimationFrame(ot.current),ot.current=null),Be(null),it(null),oe(null),pt(null),yt.current=false,Xe(false);};useEffect(()=>{if(pe)return document.addEventListener("mousemove",z),document.addEventListener("mouseup",fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[pe,ze,nt]);let Ce=(V,me,Z)=>{let A=me.subtasks&&me.subtasks.length>0;switch(V.id){case "name":let j=$===me.id,ae=S===me.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Z*20}px`},children:[T&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ae?1:.3},onMouseDown:Le=>It(me.id,Le),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),me.subtasks&&me.subtasks.length>0?jsx("button",{onClick:Le=>{Le.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"}),j?jsx("input",{ref:xe,type:"text",value:F,onChange:Le=>X(Le.target.value),onKeyDown:Le=>{Le.key==="Enter"?st(me.id):Le.key==="Escape"&&dt();},onBlur:()=>st(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:Le=>Le.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:me.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:me.parentId?"13px":"14px",fontWeight:me.isMilestone?600:me.parentId?400:600,letterSpacing:me.parentId?"0":"-0.01em"},title:me.name,children:[me.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:me.wbsCode}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:me.name})]}),ae&&!j&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Le=>Le.stopPropagation(),children:[jsx("button",{onClick:Le=>mt(me,Le),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:Le=>{Le.stopPropagation(),lt(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 Pe=V.id==="startDate"?"startDate":"endDate",Ye=me[Pe],Oe=Qe?.taskId===me.id&&Qe?.field===Pe,Dt=Le=>Le?(typeof Le=="string"?new Date(Le):Le).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Le=>Le.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:A?.5:1,cursor:A?"default":"pointer"},title:A?"Auto-calculated from subtasks":void 0,onClick:Le=>{if(!A)if(Oe)H(null);else {let U=Le.currentTarget.getBoundingClientRect();H({taskId:me.id,field:Pe,month:Ye?typeof Ye=="string"?new Date(Ye):Ye:new Date,position:{top:U.bottom+4,left:U.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Dt(Ye)}),A&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Oe&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>H(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:Qe?.position.top,left:Qe?.position.left},onClick:Le=>Le.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Le=new Date,U=new Date(Le);U.setDate(Le.getDate()+1);let we=new Date(Le);we.setDate(Le.getDate()+7);let Ot=new Date(Le);return Ot.setDate(Le.getDate()+14),[{label:"Hoy",date:Le},{label:"Ma\xF1ana",date:U},{label:"Pr\xF3xima semana",date:we},{label:"2 semanas",date:Ot}].map((ce,$e)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Je=>Je.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Je=>Je.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pe]:ce.date}),H(null);},children:ce.label},$e))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:Le=>Le.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pe]:void 0}),H(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>H(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.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:Qe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>H(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.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((Le,U)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Le},U))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Le=Qe?.month||new Date,U=Le.getFullYear(),we=Le.getMonth(),Ot=new Date(U,we,1).getDay(),P=new Date(U,we+1,0).getDate(),ce=new Date,$e=[];for(let xt=Ot-1;xt>=0;xt--)$e.push({day:new Date(U,we,-xt).getDate(),date:new Date(U,we-1,new Date(U,we,-xt).getDate()),isCurrentMonth:false});for(let xt=1;xt<=P;xt++)$e.push({day:xt,date:new Date(U,we,xt),isCurrentMonth:true});let Je=42-$e.length;for(let xt=1;xt<=Je;xt++)$e.push({day:xt,date:new Date(U,we+1,xt),isCurrentMonth:false});return $e.map((xt,za)=>{let ta=xt.date.toDateString()===ce.toDateString(),na=(Ye?typeof Ye=="string"?new Date(Ye):Ye:null)?.toDateString()===xt.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:xt.isCurrentMonth?na?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:na?"#2E94FF":"transparent",boxShadow:ta&&!na?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(me.id,{[Pe]:xt.date}),H(null);},children:xt.day},za)})})()})]})]})]}),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:He(me)})});case "assignees":if(A)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 gt=r.filter(Le=>me.assignees?.some(U=>U.name===Le.name||U.initials===Le.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(No,{assignedUsers:gt,availableUsers:r,onChange:Le=>{let U=Le.map(we=>({id:we.id,name:we.name,initials:we.initials,color:we.color}));g?.(me.id,{assignees:U.length>0?U:void 0});}})});case "status":if(A){let Le=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:Le})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(mu,{status:me.status||"todo",onChange:Le=>{g?.(me.id,{status:Le,progress:Le==="completed"?100:me.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:A?.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 Ut={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ta={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ya=Ut[me.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(Co,{priority:ya,onChange:Le=>{Le&&g?.(me.id,{priority:Ta[Le]||"medium"});}})});default:return null}},Ke=V=>[{id:"hide",label:"Hide Column",icon:Vt.Hide,onClick:()=>l(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Vt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Vt.SortDesc,onClick:()=>{}}],qe=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(V.id);}},{id:"duplicate",label:B?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([V.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{D?D(V.id,V.name):f?.([V.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{n?.(V);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{g?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{g?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{g?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:B?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([V.id]);}},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{D?D(V.id,V.name):f?.([V.id]);}}],ge=u.filter(V=>V.visible),te=ge.reduce((V,me)=>V+me.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:te},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ue}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ge.map((V,me)=>{let Z=me===ge.length-1,A=V.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${A?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(A?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Z?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:j=>{j.preventDefault(),J({isOpen:true,x:j.clientX,y:j.clientY,type:"header",columnId:V.id});},onMouseEnter:j=>{j.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:j=>{j.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:V.label,children:V.label}),V.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:_e===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:j=>{j.preventDefault(),j.stopPropagation(),M(V.id),re(j.clientX),O(V.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},V.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(Qs,{columns:u,onToggleColumn:l,theme:t}),jsx("button",{onClick:()=>N(!se),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"})}),se&&jsxs("div",{ref:Y,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:V=>V.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:()=>N(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:Se},children:ve.map(({task:V,level:me},Z)=>{let A=_(V.id),j=ze===V.id,ae=j&&nt==="above",Ne=j&&nt==="below",Pe=j&&nt==="child",Ye={};return Pe&&(Ye.backgroundColor=`${t.accent}15`,Ye.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${pe===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:A?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:A?t.accentLight:Pe?`${t.accent}15`:Z%2===0?t.bgPrimary:t.bgGrid,...Ye},onMouseEnter:()=>R(V.id),onMouseLeave:()=>R(null),onClick:Oe=>{let gt=pn(e).map(ya=>ya.id),Ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?Oe.metaKey:Oe.ctrlKey;he(V.id,gt,Ta,Oe.shiftKey),s?.(V);},onDoubleClick:Oe=>{Oe.stopPropagation(),n?.(V);},onContextMenu:Oe=>{Oe.preventDefault(),J({isOpen:true,x:Oe.clientX,y:Oe.clientY,type:"task",task:V}),d?.(V,Oe);},whileHover:{backgroundColor:A?t.accentLight:t.hoverBg},children:[ae&&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}}),ge.map((Oe,Dt)=>{let gt=Dt===ge.length-1,Ut=Oe.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ut?"justify-start":"justify-center"}`,style:{width:`${Oe.width}px`,minWidth:`${Oe.minWidth??(Ut?200:60)}px`,maxWidth:`${Oe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:gt?"none":`1px solid ${S===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ce(Oe,V,Ut?me:0)},`${V.id}-${Oe.id}`)})]},V.id)})}),jsx(un,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?Ke(q.columnId):q.type==="task"&&q.task?qe(q.task):[],onClose:()=>J({...q,isOpen:false}),theme:t}),Te&&ft&&pe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:ft.x+12,top:ft.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=ve.find(me=>me.task.id===pe)?.task;return V?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:V.name})}):null})()}),document.body)]})}function jp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,d]=useState(e),[c,i]=useState(t),[u,l]=useState(null),[m,g]=useState(null),[x,b]=useState(null),[v,f]=useState(null),[h,w]=useState(0),[y,k]=useState(0),[C,D]=useState(null),[T,L]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:m,setHoveredTaskId:g,activeZone:x,setActiveZone:b,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:h,setDraggedSegmentStartX:w,segmentDragOffsetX:y,setSegmentDragOffsetX:k,hoveredSegmentIndex:C,setHoveredSegmentIndex:D,isHovered:T,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(de,F)=>{r("none"),l(null),g(null),d(de),i(F),k(0),f(null),w(0);}}}function oi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:x,onHoverChange:b,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:h=true,readOnly:w=false}){let y=jp(t,r),k=useRef(null),C=useRef(false),D=useRef(null),T=useRef(null),{dragMode:L,setDragMode:B,dragOffset:S,setDragOffset:R,ghostX:$,setGhostX:de,ghostWidth:F,setGhostWidth:X,connectionLine:xe,setConnectionLine:_e,hoveredTaskId:M,setHoveredTaskId:W,activeZone:re,setActiveZone:ke,draggedSegmentIndex:O,setDraggedSegmentIndex:q,draggedSegmentStartX:J,setDraggedSegmentStartX:pe,segmentDragOffsetX:Be,setSegmentDragOffsetX:ze,hoveredSegmentIndex:it,setHoveredSegmentIndex:nt,isHovered:oe,setIsHovered:ct,isDragging:Re,isResizing:yt,isConnecting:ft,resetDragState:pt}=y,Te=18,Xe=!!o.executionBarBg,ot=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Qe=Xe?3:6,H=e.subtasks&&e.subtasks.length>0,se=e.endDate&&(()=>{let Z=new Date;Z.setHours(0,0,0,0);let A=new Date(e.endDate);return A.setHours(0,0,0,0),A<Z})()&&e.progress<100,N=h&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,he={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=h&&e.isCriticalPath||se?"#EF4444":e.color?e.color:e.priority&&he[e.priority]?he[e.priority]:o.taskBarPrimary,Ve=w?"default":Re?ft?"crosshair":yt?"ew-resize":"grabbing":"grab",ve=w?"default":"ew-resize",Se=(Z=>Z>=80?20:Z>=60?15:Z>=50?12:10)(r),He=r<50,lt=r<40;useEffect(()=>{b&&(!oe||Re||e.segments)&&b(null);},[oe,Re,e.segments,b]);let st=Z=>Z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),dt=()=>{let Z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Z} day${Z!==1?"s":""}`},mt=Z=>Math.round(Z/s)*s,It=Z=>{let A=Math.round(Z/s),j=new Date(n);return j.setDate(j.getDate()+A),j},z=(Z,A)=>{for(let j of g){if(j.id===e.id)continue;let ae=5;if(Z>=j.x-ae&&Z<=j.x+j.width+ae&&A>=j.y-ae&&A<=j.y+j.height+ae)return j.id}return null},fe=useCallback((Z,A,j)=>{if(w)return;Z.preventDefault(),Z.stopPropagation();let ae=k.current?.ownerSVGElement;if(!ae)return;let Ne=ae.createSVGPoint();Ne.x=Z.clientX,Ne.y=Z.clientY;let Pe=Ne.matrixTransform(ae.getScreenCTM()?.inverse()),Ye=j!==void 0?j:t,Oe=A;if(!Oe){let Dt=Pe.x-Ye;Z.shiftKey?(Oe="connect",_e({x:t+r,y:a+Te/2})):Z.ctrlKey||Z.metaKey?Oe="move":Z.altKey?Oe=Dt<r/2?"resize-start":"resize-end":lt?Dt<r/2?Oe="move":Oe="resize-end":He?Dt<=Se/2?Oe="resize-start":Dt>=r-Se/2?Oe="resize-end":Oe="move":Dt<=Se?Oe="resize-start":Dt>=r-Se?Oe="resize-end":Oe="move";}C.current=false,B(Oe),ct(false),ke(null),Oe==="move"?R(Pe.x-Ye):Oe==="connect"?_e({x:t+r,y:a+Te/2}):R(0),de(Ye),X(r);},[t,r,a,Te,w]),Ce=useCallback(Z=>{let A=k.current?.ownerSVGElement;if(!A)return;let j=A.closest(".gantt-timeline-scroll");if(!j)return;let ae=j.getBoundingClientRect(),Ne=60,Pe=15,Ye=0;if(Z.clientX<ae.left+Ne){let Oe=ae.left+Ne-Z.clientX;Ye=-Math.min(Pe,Oe/2);}else if(Z.clientX>ae.right-Ne){let Oe=Z.clientX-(ae.right-Ne);Ye=Math.min(Pe,Oe/2);}return Ye!==0&&(j.scrollLeft+=Ye),Ye!==0},[]),Ke=useCallback(Z=>{if(L==="none")return;C.current=true,T.current=Z;let A=k.current?.ownerSVGElement;if(!A)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let Ne=Ce(Z);Ne&&!D.current?D.current=window.setInterval(()=>{T.current&&(Ce(T.current),Ke(T.current));},16):!Ne&&D.current&&(window.clearInterval(D.current),D.current=null);}let j=A.createSVGPoint();j.x=Z.clientX,j.y=Z.clientY;let ae=j.matrixTransform(A.getScreenCTM()?.inverse());if(L==="connect"){_e({x:ae.x,y:ae.y});let Ne=z(ae.x,ae.y);W(Ne);}else if(L==="move"){let Ne=ae.x-S,Pe=mt(Ne);de(Pe),X(r);let Ye=Math.round((Pe-t)/s);if(x?.(e.id,Ye,true),e.segments&&e.segments.length>0&&O!==null){let Oe=Pe-J;ze(Oe);}}else if(L==="resize-start"){let Ne=ae.x,Pe=mt(Ne),Ye=t+r-Pe;Ye>=s&&(de(Pe),X(Ye));}else if(L==="resize-end"){let Ne=ae.x,Ye=mt(Ne)-t;Ye>=s&&X(Ye);}},[L,t,r,s,S,e,mt,O,J,z,W,_e,de,X,ze,x,Ce]),qe=useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),T.current=null,L!=="none"){if(L==="connect")M&&m&&m(e,M),_e(null),W(null);else {let Z=e.endDate.getTime()-e.startDate.getTime(),A,j,ae=true;if(L==="move"){if(A=It($),j=new Date(A.getTime()+Z),e.segments&&e.segments.length>0&&O!==null){let Ne=Math.round(Be/s),Pe=e.segments.map((gt,Ut)=>{if(Ut===O){let Ta=new Date(gt.startDate),ya=new Date(gt.endDate);return Ta.setDate(Ta.getDate()+Ne),ya.setDate(ya.getDate()+Ne),{startDate:Ta,endDate:ya}}return gt}),Ye=Pe.flatMap(gt=>[gt.startDate,gt.endDate]),Oe=new Date(Math.min(...Ye.map(gt=>gt.getTime()))),Dt=new Date(Math.max(...Ye.map(gt=>gt.getTime())));l?.({...e,segments:Pe},Oe,Dt),pt(t,r);return}}else L==="resize-start"?(A=It($),j=e.endDate,A>j&&(console.warn("Invalid date range: start date must be before or equal to end date"),ae=false)):L==="resize-end"?(A=e.startDate,j=It($+F),j.setDate(j.getDate()-1),j<A&&(console.warn("Invalid date range: end date must be after or equal to start date"),ae=false)):ae=false;ae&&A&&j&&(j.getTime()<A.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,A,j));}x?.(e.id,0,false),pt(t,r);}},[L,$,F,e,l,M,m,t,r,s,It,Be,O,pt,x]);useEffect(()=>{if(L==="none")return;let Z=j=>{Ke(j);},A=()=>{qe();};return window.addEventListener("mousemove",Z),window.addEventListener("mouseup",A),()=>{window.removeEventListener("mousemove",Z),window.removeEventListener("mouseup",A),D.current&&(window.clearInterval(D.current),D.current=null);}},[L,Ke,qe]);let ge=Re&&!ft?$:t,te=Re&&!ft?F:r,V=d.taskClass(e);return jsxs("g",{ref:k,"data-task-bar":"true",onClick:()=>{!Re&&!C.current&&c?.(e),C.current=false;},onDoubleClick:Z=>{!Re&&!C.current&&(Z.stopPropagation(),i?.(e));},onContextMenu:Z=>{Z.preventDefault(),u?.(e,Z);},onMouseEnter:()=>!Re&&ct(true),onMouseMove:Z=>{b&&oe&&!Re&&!e.segments&&b({task:e,x:t,y:a,width:r,height:Te,showBelow:false,mouseX:Z.clientX,mouseY:Z.clientY});},onMouseLeave:()=>{Re||(ct(false),ke(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),oe&&!Re&&!He&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Se,height:Te,fill:re==="resize-start"?o.accent:"transparent",opacity:re==="resize-start"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>ke("resize-start"),onMouseDown:Z=>fe(Z,"resize-start")}),jsx("rect",{x:t+Se,y:a,width:r-Se*2,height:Te,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ke("move"),onMouseDown:Z=>fe(Z,"move")}),jsx("rect",{x:t+r-Se,y:a,width:Se,height:Te,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>ke("resize-end"),onMouseDown:Z=>fe(Z,"resize-end")})]}),oe&&!Re&&lt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ke("move"),onMouseDown:Z=>fe(Z,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.2:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>ke("resize-end"),onMouseDown:Z=>fe(Z,"resize-end")}),oe&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Re&&!ft&&!e.segments&&jsx(motion.rect,{x:$,y:a,width:F,height:Te,rx:Qe,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!Re&&(()=>{let Z=e.baselineStartDate.getTime(),A=e.baselineEndDate.getTime(),j=n.getTime(),ae=864e5,Ne=(Z-j)/ae,Pe=(A-Z)/ae,Ye=Ne*s,Oe=Math.max(Pe*s,s),Dt=ge+te,gt=Ye+Oe,Ut=e.endDate?.getTime()??0,Ta=Math.ceil((Ut-A)/ae),ya=Ta>0,Le=Ta<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:Ye,y:a,width:Oe,height:Te,rx:Qe,fill:"none",stroke:ot?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ya&&Dt>gt&&jsx("rect",{x:gt,y:a,width:Dt-gt,height:Te,rx:0,fill:"#EF4444",opacity:.2}),ya&&jsxs("text",{x:Math.max(Dt,gt)+6,y:a+Te/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ta,"d"]}),Le&&jsxs("text",{x:Dt+6,y:a+Te/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ta,"d"]})]})})(),!e.segments&&Xe&&H&&(()=>{let A=a+(Te-6)/2,j=14,ae=a+(Te-j)/2,Ne=2;return jsxs("g",{"data-task-class":V,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:ge,y:A,width:te,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsx("rect",{x:ge,y:ae,width:Ne,height:j,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsx("rect",{x:ge+te-Ne,y:ae,width:Ne,height:j,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&Xe&&!H&&jsx(motion.rect,{x:ge,y:a,width:te,height:Te,rx:Qe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":V,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!ft?.15:e.parentId?.6:1,scale:oe&&!Re?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>fe(Z),style:{cursor:Ve,pointerEvents:"all"}}),!e.segments&&!Xe&&jsx(motion.rect,{x:ge,y:a,width:te,height:Te,rx:Qe,fill:ee,"data-task-class":V,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!ft?.15:e.parentId?.6:oe?.9:.8,scale:oe&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:Z=>fe(Z),style:{cursor:H?"default":Ve,pointerEvents:"all"}}),Xe&&(se||N)&&!e.segments&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&(Xe&&H?null:jsx("rect",{x:ge,y:a,width:Math.max(te*(e.progress/100),Qe*2),height:Te,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})),!e.segments&&!H&&e.progress<100&&(()=>{let Z=e.progress>0?te*(e.progress/100):0,A=ge+Z,j=te-Z,ae=e.progress===0?Qe:0,Ne=e.progress===0?ge:A,Pe=e.progress===0?te:j;return jsxs(Fragment,{children:[jsx("rect",{x:Ne,y:a,width:Pe,height:Te,rx:ae,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Ne,y:a,width:Pe,height:Te,rx:ae,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),Xe&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!Re&&(()=>{let Z=ge+te*(e.progress/100),A=8,j=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:Z,cy:a+Te/2,r:A,fill:j?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:Z,y:a+Te/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:j?.initials||j?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((Z,A)=>{let j=(Z.startDate.getTime()-n.getTime())/864e5*s,Ne=(Z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-j+s,Pe=Re&&L==="move"&&O===A,Ye=it===A,Oe=Pe?j+Be:j;return jsxs("g",{onMouseEnter:()=>!Re&&nt(A),onMouseLeave:()=>!Re&&nt(null),children:[jsx(motion.rect,{x:Oe,y:a,width:Ne,height:Te,rx:Qe,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:Pe||e.parentId?.6:Ye?.9:.8,scale:Ye&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Dt=>{Dt.stopPropagation(),q(A),pe(j),fe(Dt,void 0,j);},style:{cursor:Ve,pointerEvents:"all"}}),jsx("rect",{x:Oe,y:a,width:Ne*(e.progress/100),height:Te,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${A}`)}),Y&&(se||N)&&!e.segments&&jsxs(Fragment,{children:[N&&!se&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&te>60&&!e.segments&&!(Xe&&H)&&(()=>{let Z=d.taskLabel(e),A=typeof Z=="string"?Z:e.name,j=A.length>Math.floor(te/8)?`${A.substring(0,Math.floor(te/8))}...`:A;return jsx("text",{x:ge+8,y:a+Te/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:j})})(),!Re&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(Xe?jsxs("text",{x:ge+te+6,y:a+Te/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):te>100?jsxs("text",{x:ge+te-12,y:a+Te/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&te>80&&!Re&&!e.segments&&!(Xe&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:ge+te-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:ge+te-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(oe||yt)&&!ft&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:ge-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>ke("resize-start"),onMouseLeave:()=>ke(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"resize-start");}}),jsx(motion.rect,{x:ge+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:re==="resize-start"||L==="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:ge+te-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>ke("resize-end"),onMouseLeave:()=>ke(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"resize-end");}}),jsx(motion.rect,{x:ge+te-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:re==="resize-end"||L==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:oe&&!Re&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ke("connect"),onMouseLeave:()=>ke(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:re==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ft&&xe&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Te/2,x2:xe.x,y2:xe.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:xe.x,cy:xe.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsx(motion.text,{x:xe.x+15,y:xe.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:xe.x+10},animate:{opacity:1,x:xe.x+15},transition:{duration:.2},children:"Connect"})]}),(oe||Re)&&!ft&&!e.segments&&jsx(motion.rect,{x:ge-1,y:a-1,width:te+2,height:Te+2,rx:Qe+1,fill:"none",stroke:Re?o.accent:Xe?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:Xe?1:2,opacity:Re||Xe?.6:.4,initial:{opacity:0},animate:{opacity:Re||Xe?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),yt&&jsxs(Fragment,{children:[jsx("line",{x1:$,y1:0,x2:$,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:$+F,y1:0,x2:$+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:oe&&!Re&&!e.segments&&!b&&(()=>{let j=a<100,ae=j?a+Te+13:a-82-13,Ne=j?`M ${ge+te/2-6} ${a+Te+3} L ${ge+te/2} ${a+Te+13} L ${ge+te/2+6} ${a+Te+3}`:`M ${ge+te/2-6} ${a-13} L ${ge+te/2} ${a-3} L ${ge+te/2+6} ${a-13}`,Pe=ae+22,Ye=ae+40,Oe=ae+55,Dt=ae+70,gt=j?ae+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:j?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:j?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:ge+te/2-120,y:ae,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:ge+te/2,y:Pe,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:ge+te/2-110,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:ge+te/2-70,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.startDate)}),jsx("text",{x:ge+te/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:ge+te/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.endDate)}),jsx("text",{x:ge+te/2+10,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:ge+te/2+65,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt()}),jsx("text",{x:ge+te/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:ge+te/2+65,y:Oe,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:ge+te/2-110,y:Dt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:ge+te/2-50,y:Dt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ut=>Ut.name).join(", ").substring(0,30),e.assignees.map(Ut=>Ut.name).join(", ").length>30?"...":""]})]}),!j&&jsx("text",{x:ge+te/2,y:gt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:lt?"Left: move \u2022 Right: resize":He?"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 ud=260,mn=8,qp=16,nv=-12;function Xp({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:h,mouseX:w,mouseY:y}=e,C=h.effortMinutes!=null||h.timeLoggedMinutes!=null||h.soldEffortMinutes!=null?155:105,D=w+qp,T=y+nv-C;D+ud>window.innerWidth-mn&&(D=w-ud-qp),D<mn&&(D=mn);let L=T<mn;L&&(T=y+20),T+C>window.innerHeight-mn&&(T=window.innerHeight-mn-C),o({left:D,top:T,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,d={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=h=>h.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let h=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${h} d\xEDa${h!==1?"s":""}`:`${h} day${h!==1?"s":""}`},u=h=>{if(h==null||h===0)return "N/A";let w=Math.floor(h/60),y=h%60;return w===0?`${y}m`:y===0?`${w}h`:`${w}h ${y}m`},l=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",x=t.accent||"#3B82F6",b=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:ud,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${v}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(ni,{label:d.start,value:s.startDate?c(s.startDate):"N/A",labelColor:l,valueColor:m}),jsx(ni,{label:d.duration,value:i(),labelColor:l,valueColor:m}),jsx(ni,{label:d.end,value:s.endDate?c(s.endDate):"N/A",labelColor:l,valueColor:m}),jsx(ni,{label:d.progress,value:`${s.progress}%`,labelColor:l,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:l},children:[d.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(h=>h.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:l},children:[d.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:l},children:[d.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:u(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:l},children:[d.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},c=e.reduce((i,u)=>{let l=u.category||"Other";return i[l]||(i[l]=[]),i[l].push(u),i},{});return jsxs("div",{className:p("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:p("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(l=>jsxs("button",{onClick:()=>d(l),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:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.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 jl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=useState("export"),[c,i]=useState("json"),[u,l]=useState(null),m=useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,v=await Vc(e,c,b);_c(v,c);},x=async b=>{let v=b.target.files?.[0];if(v){try{let f=await Yc(v),h=v.name.endsWith(".json")?"json":"csv",w=Kc(f,h);l(w),w.success&&r&&r(w,f);}catch(f){l({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxs("div",{className:p("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>d("export"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>d("import"),className:p("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(b=>jsxs("button",{onClick:()=>i(b),className:p("p-4 rounded-lg border-2 transition-all text-center",c===b?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:m,type:"file",accept:".json,.csv",onChange:x,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"})]})]}),u&&jsxs("div",{className:p("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:p("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,v)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},v))})]})]})]})]})]})}var Fy=["URGENT","HIGH","MEDIUM","LOW"],Py=[{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"}],My=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Kl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:l=true,compact:m=false,groupBy:g="none",onGroupByChange:x}){let[b,v]=useState(true),f=useCallback(C=>{a({search:C.target.value});},[a]),h=useCallback(C=>{a({dateFilter:C.target.value});},[a]),w=useCallback(C=>{r({by:C.target.value});},[r]),y=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>v(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!b&&jsxs("div",{className:"filter-bar__content",children:[l&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:C=>{let D=C.target.value;a({priorities:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Fy.map(C=>jsx("option",{value:C,children:C},C))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:C=>{let D=C.target.value;a({assignees:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(C=>jsx("option",{value:C.id,children:C.name},C.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:C=>{let D=C.target.value;a({labels:D==="all"?[]:[D]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(C=>jsx("option",{value:C,children:C},C))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:w,className:"filter-bar__select filter-bar__select--sm",children:Py.map(C=>jsx("option",{value:C.value,children:C.label},C.value))}),t.by!=="none"&&jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:C=>x(C.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:My.map(C=>jsx("option",{value:C.value,children:C.label},C.value))})}),k&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Yl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:c}){let[i,u]=useState(false),l=useRef(null);useEffect(()=>{let g=x=>{l.current&&!l.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let m=g=>{g(),u(false);};return jsxs("div",{className:p("relative",r),ref:l,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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 d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>m(()=>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 ql={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"}},Xl={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"}},Jl={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"}},Mo={dark:ql,light:Xl,neutral:Jl},_s="dark";var js=createContext(void 0),Uy="asakaa-theme";function kp({children:e,defaultTheme:t=_s,storageKey:a=Uy}){let[r,o]=useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,c=Mo[r];Object.entries(c.colors).forEach(([u,l])=>{l&&d.style.setProperty(`--theme-${Wy(u)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,l])=>{let m=c.colors[u];m&&d.style.setProperty(l,m);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Mo};return jsx(js.Provider,{value:n,children:e})}function nn(){let e=useContext(js);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Wy(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ql({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=nn();return e?jsxs("div",{className:p("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(Mo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:p("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 Cp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return tt[e]||tt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",tt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",tt[e].bgSecondary),bgGrid:r("--theme-bg-card",tt[e].bgGrid),bgWeekend:r("--theme-bg-hover",tt[e].bgWeekend),border:r("--theme-border-primary",tt[e].border),borderLight:r("--theme-border-subtle",tt[e].borderLight),textPrimary:r("--theme-text-primary",tt[e].textPrimary),textSecondary:r("--theme-text-secondary",tt[e].textSecondary),textTertiary:r("--theme-text-tertiary",tt[e].textTertiary),accent:r("--theme-accent-primary",tt[e].accent),accentHover:r("--theme-accent-hover",tt[e].accentHover),accentLight:r("--theme-accent-primary",tt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",tt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",tt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",tt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",tt[e].dependency),dependencyHover:r("--theme-border-secondary",tt[e].dependencyHover),criticalPath:r("--theme-error",tt[e].criticalPath),criticalPathLight:r("--theme-error",tt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",tt[e].today):e==="neutral"?r("--theme-text-primary",tt[e].today):r("--theme-error",tt[e].today),todayLight:e==="light"?r("--theme-accent-primary",tt[e].todayLight):e==="neutral"?r("--theme-text-primary",tt[e].todayLight):r("--theme-error",tt[e].todayLight),milestone:r("--theme-warning",tt[e].milestone),milestoneLight:r("--theme-warning",tt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",tt[e].statusTodo),statusInProgress:r("--theme-accent-primary",tt[e].statusInProgress),statusCompleted:r("--theme-success",tt[e].statusCompleted),hoverBg:r("--theme-bg-hover",tt[e].hoverBg),focusRing:r("--theme-accent-primary",tt[e].focusRing),...tt[e].dotGrid&&{dotGrid:tt[e].dotGrid},...tt[e].glassHeader&&{glassHeader:tt[e].glassHeader},...tt[e].glassToolbar&&{glassToolbar:tt[e].glassToolbar},...tt[e].forecastHud&&{forecastHud:tt[e].forecastHud},...tt[e].neonRedGlow&&{neonRedGlow:tt[e].neonRedGlow},...tt[e].executionBarBg&&{executionBarBg:tt[e].executionBarBg}}}var Ks={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"}},Tp={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"}},Zl={en:Ks,es:Tp};function Np(e){return Zl[e]||Zl.en}function ed(e,t){let a=Np(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 ln=createContext(Ks);function Nr(){return useContext(ln)}function Xs(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),d=n.bottom+4,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:d,left:c});},[t,a,e,r]),o}function Sp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,d]=useState(false),[c,i]=useState(null),[u,l]=useState(false),m=useRef(null),g=useRef(null),x=Nr(),b=Xs(m,n,"right",224),v=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=x.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let k=C=>{let D=C.target;m.current&&!m.current.contains(D)&&g.current&&!g.current.contains(D)&&d(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[n]);let h=[{id:"png",label:x.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:x.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:x.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:x.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(k=>k.handler),w=async(k,C)=>{if(C){i(k);try{await C();}catch(D){console.error(`Export ${k} failed:`,D);}finally{i(null),d(false);}}},y=()=>{s?.(),l(true),setTimeout(()=>l(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>d(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:x.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:v?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${v?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:v?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((k,C)=>jsxs(motion.button,{onClick:()=>w(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:v?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:v?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:y,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:v?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:u?x.toolbar.copied:x.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function gx({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 fx({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 Ep({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),d=useRef(null),c=Nr(),i=Xs(n,o,"left");useEffect(()=>{if(!o)return;let m=g=>{let x=g.target;n.current&&!n.current.contains(x)&&d.current&&!d.current.contains(x)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],l=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"}: ${l}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:l})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((m,g)=>{let x=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:x?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:x?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:x?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:x?600:500},children:m.label}),x&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Fp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),d=useRef(null),c=useRef(null),i=Nr(),u=Xs(d,s,"left");useEffect(()=>{if(!s)return;let x=setTimeout(()=>{let b=f=>{let h=f.target;d.current&&!d.current.contains(h)&&c.current&&!c.current.contains(h)&&n(false);},v=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",v),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(x),c._cleanup&&c._cleanup();}},[s]);let l=[{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:d,onClick:x=>{x.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children: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:u.top,left:u.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:l.map(x=>{let b=t===x.value&&!r,v=()=>x.value==="all"?b?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):x.icon;return jsxs(motion.button,{onClick:()=>{a(x.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${b?x.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:x.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},x.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 bx({value:e,onChange:t,theme:a}){let r=Nr(),o=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let d=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:d?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:d?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function hx({theme:e,forecast:t}){let a=Nr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,d=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,l=t?.costAtCompletion,m=t?.currency||"$",g=l!=null?l>=1e6?`${m}${(l/1e6).toFixed(2)}M`:l>=1e3?`${m}${(l/1e3).toFixed(1)}K`:`${m}${l.toFixed(0)}`:"\u2014",x=t?.budgetVariancePercent,b=x!=null&&x!==0,v=x!=null?x>0?`+${x.toFixed(0)}% ${a.toolbar.budgetOver}`:`${x.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=x!=null&&x>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:x!=null&&x<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",o]}),n&&d&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:d})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),b&&v&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:v})]})]})]})}function yx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:d,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u}){let[l,m]=useState(false),g=useRef(null),x=useRef(null),b=Nr(),v=Xs(g,l,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!l)return;let y=k=>{let C=k.target;g.current&&!g.current.contains(C)&&x.current&&!x.current.contains(C)&&m(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]);let h=[{key:"criticalPath",label:b.toolbar.visibility==="Visibilidad"?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a},{key:"baselines",label:b.toolbar.visibility==="Visibilidad"?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:b.toolbar.visibility==="Visibilidad"?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:b.toolbar.visibility==="Visibilidad"?"Dependencias":"Dependencies",icon:GitBranch,active:d,onChange:c}],w=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>m(!l),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:l?e.accent:e.textTertiary,backgroundColor:l?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:l&&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:v.top,left:v.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:h.map((y,k)=>{let C=y.icon;return jsxs(motion.button,{onClick:()=>y.onChange?.(!y.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},children:[jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:y.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:y.label}),y.active&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),w.map((y,k)=>{let C=i===y.value;return jsxs(motion.button,{onClick:()=>u(y.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(h.length+k)*.03},children:[jsx("span",{style:{color:C?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:y.label}),C&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},y.value)})]})]})}),document.body)]})}function Js({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:l,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:x,hideCompleted:b=false,onHideCompletedChange:v,toolbarRightContent:f,wbsLevel:h,onWbsLevelChange:w,maxWbsDepth:y=4,viewMode:k="execution",onViewModeChange:C,projectForecast:D,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportCSV:S,onExportJSON:R,onExportMSProject:$,showCriticalPath:de=true,onShowCriticalPathChange:F,showDependencies:X=true,onShowDependenciesChange:xe,highlightWeekends:_e=true,onHighlightWeekendsChange:M,showBaseline:W=false,onShowBaselineChange:re,onCopySnapshotLink:Ce}){let O=Nr(),q=T||L||B||S||R||$,J=!!e.glassToolbar,[pe,Be]=useState(false),ze=useRef(null);useEffect(()=>{pe&&ze.current&&ze.current.focus();},[pe]);let it=[{value:"day",label:O.toolbar.day},{value:"week",label:O.toolbar.week},{value:"month",label:O.toolbar.month}],nt=[{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"})}],oe=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(J){let ct=oe?"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:oe?"#1A1A1A":e.bgSecondary,border:`1px solid ${oe?"rgba(255,255,255,0.08)":e.border}`},animate:{width:pe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Be(!pe),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"})}),pe&&jsx("input",{ref:ze,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:()=>Be(false),onKeyDown:Re=>{Re.key==="Escape"&&Be(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),C&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:oe?"#000000":e.bgSecondary,border:`1px solid ${oe?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>C("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="execution"?oe?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:k==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="execution"?{color:e.textSecondary}:{},children:O.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>C("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:k==="oracle"?oe?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:k==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:k!=="oracle"?{color:e.textSecondary}:{},children:O.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(bx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),w&&jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ct}}),jsx(yx,{theme:e,showCriticalPath:de,onShowCriticalPathChange:F,showBaseline:W,onShowBaselineChange:re,highlightWeekends:_e,onHighlightWeekendsChange:M,showDependencies:X,onShowDependenciesChange:xe,rowDensity:d,onRowDensityChange:c}),jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportMSProject:$,onCopySnapshotLink:Ce}),u&&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 ${oe?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${oe?"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:l||O.toolbar.createTask})]})]})]}),D&&jsx(hx,{theme:e,forecast:D})]})}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(fx,{options:it,value:t,onChange:ct=>a(ct),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsx(Ep,{theme:e,value:h??"all",onChange:w,maxDepth:y}),x&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Fp,{theme:e,value:g,onChange:x,hideCompleted:b,onHideCompletedChange:v})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&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:l||O.toolbar.createTask})]}),(q||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Sp,{theme:e,onExportPNG:T,onExportPDF:L,onExportExcel:B,onExportMSProject:$,onCopySnapshotLink:Ce}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(gx,{options:nt,value:s,onChange:ct=>n(ct),theme:e})]})]})}function Qs({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),d=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let u=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();n({x:u.left,y:u.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(At,{children:jsx(motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function un({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[d,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,l=r.length*36+8,m=8,g=window.innerWidth,x=window.innerHeight,b=t,v=a;t+u+m>g&&(b=t-u,b<m&&(b=m)),a+l+m>x&&(v=x-l-m,v<m&&(v=m)),c({x:b,y:v});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=m=>{n.current&&!n.current.contains(m.target)&&o();},l=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${d.x}px`,top:`${d.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:l=>{u.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Vt={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 Op({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:l,enableKeyboard:m=true}){let g=useRef(false),x=useCallback(w=>{g.current=w;},[]),b=useCallback(w=>{let y=[],k=C=>{for(let D of C)y.push(D),D.subtasks&&D.subtasks.length>0&&D.isExpanded&&k(D.subtasks);};return k(w),y},[]),v=useCallback(()=>{let w=b(e);for(let y of w)if(t.has(y.id))return y;return null},[e,t,b]),f=useCallback((w,y)=>{let k=b(e);if(k.length===0)return;let C=v();if(!C){a(k[0].id,false);return}let D=k.findIndex(B=>B.id===C.id);if(D===-1)return;let T=w==="up"?D-1:D+1;if(T<0||T>=k.length)return;let L=k[T];a(L.id,y);},[e,v,b,a]),h=useCallback(w=>{if(!m)return;let y=w.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||g.current){w.key==="Escape"&&(y.blur(),g.current=false);return}let D=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,T=Array.from(t),L=v();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(L&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!L.isExpanded||w.key==="ArrowLeft"&&L.isExpanded)&&u(L.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){T.length>0&&(w.preventDefault(),n(T,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){T.length>0&&(w.preventDefault(),d(T));return}if(w.key==="Tab"&&w.shiftKey){T.length>0&&(w.preventDefault(),c(T));return}if(w.key==="Enter"&&!w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!D){L&&(w.preventDefault(),r(L.id,"above"));return}if(w.key==="Enter"&&D){L&&(w.preventDefault(),l(L.id));return}if(w.key==="F2"){L&&(w.preventDefault(),i(L.id));return}if(w.key==="Delete"||w.key==="Backspace"&&D){T.length>0&&(w.preventDefault(),o(T));return}if(w.key==="d"&&D&&!w.shiftKey){T.length>0&&(w.preventDefault(),s(T));return}},[m,t,v,f,r,o,s,n,d,c,i,u,l]);return useEffect(()=>{if(m)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[m,h]),{setIsEditing:x}}function Hp(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(l=>{t(new Set([l])),r(l);},[]),s=useCallback(l=>{t(m=>{let g=new Set(m);return g.has(l)?g.delete(l):g.add(l),g}),r(l);},[]),n=useCallback((l,m)=>{if(!a){o(l);return}let g=m.indexOf(a),x=m.indexOf(l);if(g===-1||x===-1){o(l);return}let b=Math.min(g,x),v=Math.max(g,x),f=m.slice(b,v+1);t(new Set(f)),r(l);},[a,o]),d=useCallback((l,m,g,x)=>{x?n(l,m):g?s(l):o(l);},[o,s,n]),c=useCallback((l,m)=>{m?t(g=>{let x=new Set(g);return x.add(l),x}):o(l);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function rd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?rd(t.subtasks):t.subtasks}))}function pn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((d,c)=>(d.position??0)-(c.position??0));for(let d=0;d<n.length;d++){let c={...n[d],parentId:o,level:s,position:n[d].position??d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Zs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Zs(a.subtasks,t);if(r)return r}}return null}function ad(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ad(a.subtasks,t);if(r)return r}return null}function od(e,t){if(t.length===0)return e;let a=pn(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 x=[];return {tasks:m.filter(v=>{if(g.has(v.id))return x.push(v),false;if(v.subtasks){let f=n(v.subtasks,g);v.subtasks=f.tasks,x.push(...f.removed);}return true}),removed:x}},d=(m,g,x)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...x],isExpanded:true}:b.subtasks?{...b,subtasks:d(b.subtasks,g,x)}:b),c=new Set(t),{tasks:i,removed:u}=n(e,c),l=d(i,s.id,u);return rd(l)}function nd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ad(a,r);if(!o)continue;let s=ad(a,o.id),n=(i,u,l)=>{for(let m=0;m<i.length;m++){let g=i[m];if(g.id===u&&g.subtasks){let x=g.subtasks.findIndex(b=>b.id===l);if(x!==-1){let[b]=g.subtasks.splice(x,1);return b}}if(g.subtasks){let x=n(g.subtasks,u,l);if(x)return x}}return null},d=(i,u,l)=>{let m=i.findIndex(g=>g.id===u);if(m!==-1)return i.splice(m+1,0,l),i;for(let g of i)g.subtasks&&d(g.subtasks,u,l);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?d(s.subtasks,o.id,c):d(a,o.id,c));}return rd(a)}function sd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,c)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],n[i]={...n[i],position:i},n[u]={...n[u],position:u},true)};return s(r,o,a),r}function id(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 Gn(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((u,l)=>({...u,id:`${u.id}-copy-${Date.now()}-${l}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${l}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let x=n(g.subtasks);if(x)return x}return null}let u=c[i],l=`${u.id}-copy-${Date.now()}`,m={...u,id:l,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,l):void 0};return c.splice(i+1,0,m),m},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function zp(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},d=c=>{let i=c.findIndex(l=>l.id===t);if(i===-1){for(let l of c)if(l.subtasks&&d(l.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,n),true};return d(r),{tasks:r,newTask:n}}function ld(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ld(r.subtasks,t,a)}:r)}function dd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:dd(a.subtasks,t)}:a)}function cd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let x=a(g.subtasks);if(x)return x}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,c=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let x=c(g.subtasks);if(x>=0)return x}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#2E94FF",position:i,parentId:t},l=m=>m.map(g=>{if(g.id===t){let x=g.subtasks||[];return {...g,subtasks:[...x,u],isExpanded:true}}return g.subtasks?{...g,subtasks:l(g.subtasks)}:g});return {tasks:l(e),newTask:u}}function Up(e,t,a,r){if(t===a)return e;let o=Zs(e,t);if(!o)return e;if(a){let d=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||d(u,i))return true;return false};if(d(o,a))return e}let s=d=>{let c=d.filter(u=>u.id!==t),i=c.length<d.length;return c.map((u,l)=>{let m=i?{...u,position:l}:u;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let d=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],l=r!==void 0?r:u.length,m=[...u];m.splice(l,0,{...o,parentId:a});let g=m.map((x,b)=>({...x,position:b}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function fr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=fr(t.subtasks),r=a.reduce((d,c)=>(c.startDate&&d.starts.push(new Date(c.startDate).getTime()),c.endDate&&d.ends.push(new Date(c.endDate).getTime()),d.progresses.push(c.progress??0),d),{starts:[],ends:[],progresses:[]}),o=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,n=r.progresses.length>0?Math.round(r.progresses.reduce((d,c)=>d+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ti({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:l,onColumnResize:m,onTaskUpdate:g,onTaskIndent:x,onTaskOutdent:b,onTaskMove:v,onMultiTaskDelete:f,onTaskDuplicate:h,onTaskCreate:w,onTaskRename:y,onCreateSubtask:k,onOpenTaskModal:C,onDeleteRequest:D,onTaskReparent:T,scrollContainerRef:L}){let B=useContext(ln),[S,R]=useState(null),[$,de]=useState(null),[F,X]=useState(""),xe=useRef(null),[_e,M]=useState(null),[W,re]=useState(0),[Ce,O]=useState(0),[q,J]=useState({isOpen:false,x:0,y:0,type:"header"}),[pe,Be]=useState(null),[ze,it]=useState(null),[nt,oe]=useState(null),ct=useRef(0),Re=5,yt=useRef(false),[ft,pt]=useState(null),[Te,Xe]=useState(false),ot=useRef(null),[Qe,H]=useState(null),[se,N]=useState(false),Y=useRef(null);useEffect(()=>{function V(me){Y.current&&!Y.current.contains(me.target)&&N(false);}if(se)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[se]),useEffect(()=>{$&&xe.current&&(xe.current.focus(),xe.current.select());},[$]),useEffect(()=>{if(!_e)return;let V=Z=>{let A=Z.clientX-W,j=Ce+A;m?.(_e,j);},me=()=>{M(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[_e,W,Ce,m]);let{selectedTaskIds:ie,handleTaskClick:he,isTaskSelected:_}=Hp(),{setIsEditing:ee}=Op({tasks:e,selectedTaskIds:ie,onTaskSelect:(V,me)=>{let A=pn(e).map(j=>j.id);he(V,A,me||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:v||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:V=>{let me=pn(e).find(Z=>Z.id===V);me&&lt(me);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:V=>{let me=pn(e).find(Z=>Z.id===V);me&&C&&C(me);},enableKeyboard:true}),Ve=(V,me=0,Z="")=>{let A=[],j=[...V].sort((ae,Ne)=>(ae.position??0)-(Ne.position??0));for(let ae=0;ae<j.length;ae++){let Ne=j[ae],Pe=ae+1,Ye=Z?`${Z}.${Pe}`:`${Pe}.0`;if(Ne.wbsCode=Ye,A.push({task:Ne,level:me}),Ne.subtasks&&Ne.subtasks.length>0&&Ne.isExpanded){let Oe=Z?`${Z}.${Pe}`:`${Pe}`;A.push(...Ve(Ne.subtasks,me+1,Oe));}}return A},ve=Ve(e),Ue=48,Se=Math.max(ve.length*a,600-Ue),He=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,lt=V=>{de(V.id),X(V.name),ee(true);},st=V=>{F.trim()&&F!==e.find(me=>me.id===V)?.name&&y?.(V,F.trim()),de(null),X(""),ee(false);},dt=()=>{de(null),X(""),ee(false);},mt=(V,me)=>{me.stopPropagation(),k?.(V.id);},It=(V,me)=>{me.preventDefault(),ct.current=me.clientY,Be(V),yt.current=false,Xe(false),pt({x:me.clientX,y:me.clientY});},z=V=>{if(!pe||(Math.abs(V.clientY-ct.current)>Re&&!yt.current&&(yt.current=true,Xe(true)),pt({x:V.clientX,y:V.clientY}),!yt.current))return;if(L?.current){let ae=L.current,Ne=ae.getBoundingClientRect(),Pe=60,Ye=12;ot.current&&(cancelAnimationFrame(ot.current),ot.current=null);let Oe=V.clientY-Ne.top,Dt=Ne.bottom-V.clientY;if(Oe<Pe&&ae.scrollTop>0){let gt=Math.round(Ye*(1-Oe/Pe)),Ut=()=>{ae.scrollTop-=gt,yt.current&&ae.scrollTop>0&&(ot.current=requestAnimationFrame(Ut));};ot.current=requestAnimationFrame(Ut);}else if(Dt<Pe&&ae.scrollTop<ae.scrollHeight-ae.clientHeight){let gt=Math.round(Ye*(1-Dt/Pe)),Ut=()=>{ae.scrollTop+=gt,yt.current&&ae.scrollTop<ae.scrollHeight-ae.clientHeight&&(ot.current=requestAnimationFrame(Ut));};ot.current=requestAnimationFrame(Ut);}}let Z=document.querySelectorAll("[data-task-row]"),A=null,j=null;Z.forEach(ae=>{let Ne=ae.getBoundingClientRect(),Pe=ae.getAttribute("data-task-row");if(Pe&&Pe!==pe&&V.clientY>=Ne.top&&V.clientY<=Ne.bottom){A=Pe;let Ye=V.clientY-Ne.top,Oe=Ne.height;Ye<Oe*.25?j="above":Ye>Oe*.75?j="below":j="child";}}),it(A),oe(j);},fe=()=>{if(yt.current&&pe&&ze&&nt){if(nt==="child")T?.(pe,ze);else if(nt==="above"||nt==="below"){let V=(j,ae,Ne=null)=>{for(let Pe of j){if(Pe.id===ae)return Ne;if(Pe.subtasks){let Ye=V(Pe.subtasks,ae,Pe.id);if(Ye!==void 0)return Ye}}},me=V(e,pe,null),Z=V(e,ze,null),A=(j,ae,Ne,Pe)=>{let Ye=j.findIndex(gt=>gt.id===ae),Oe=Pe?j.findIndex(gt=>gt.id===Ne):-1,Dt=nt==="below"?Ye+1:Ye;return Pe&&Oe!==-1&&Oe<Ye&&(Dt-=1),Math.max(0,Dt)};if(Z===null){let ae=A(e,ze,pe,me===null);T?.(pe,null,ae);}else {let j=ve.find(ae=>ae.task.id===Z)?.task;if(j?.subtasks){let ae=me===Z,Ne=A(j.subtasks,ze,pe,ae);T?.(pe,Z,Ne);}}}}ot.current&&(cancelAnimationFrame(ot.current),ot.current=null),Be(null),it(null),oe(null),pt(null),yt.current=false,Xe(false);};useEffect(()=>{if(pe)return document.addEventListener("mousemove",z),document.addEventListener("mouseup",fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[pe,ze,nt]);let we=(V,me,Z)=>{let A=me.subtasks&&me.subtasks.length>0;switch(V.id){case "name":let j=$===me.id,ae=S===me.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Z*20}px`},children:[T&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ae?1:.3},onMouseDown:Le=>It(me.id,Le),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),me.subtasks&&me.subtasks.length>0?jsx("button",{onClick:Le=>{Le.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"}),j?jsx("input",{ref:xe,type:"text",value:F,onChange:Le=>X(Le.target.value),onKeyDown:Le=>{Le.key==="Enter"?st(me.id):Le.key==="Escape"&&dt();},onBlur:()=>st(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:Le=>Le.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:me.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:me.parentId?"13px":"14px",fontWeight:me.isMilestone?600:me.parentId?400:600,letterSpacing:me.parentId?"0":"-0.01em"},title:me.name,children:[me.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:me.wbsCode}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:me.name})]}),ae&&!j&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Le=>Le.stopPropagation(),children:[jsx("button",{onClick:Le=>mt(me,Le),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:Le=>{Le.stopPropagation(),lt(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 Pe=V.id==="startDate"?"startDate":"endDate",Ye=me[Pe],Oe=Qe?.taskId===me.id&&Qe?.field===Pe,Dt=Le=>Le?(typeof Le=="string"?new Date(Le):Le).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Le=>Le.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:A?.5:1,cursor:A?"default":"pointer"},title:A?"Auto-calculated from subtasks":void 0,onClick:Le=>{if(!A)if(Oe)H(null);else {let U=Le.currentTarget.getBoundingClientRect();H({taskId:me.id,field:Pe,month:Ye?typeof Ye=="string"?new Date(Ye):Ye:new Date,position:{top:U.bottom+4,left:U.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Dt(Ye)}),A&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Oe&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>H(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:Qe?.position.top,left:Qe?.position.left},onClick:Le=>Le.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Le=new Date,U=new Date(Le);U.setDate(Le.getDate()+1);let ke=new Date(Le);ke.setDate(Le.getDate()+7);let Ot=new Date(Le);return Ot.setDate(Le.getDate()+14),[{label:"Hoy",date:Le},{label:"Ma\xF1ana",date:U},{label:"Pr\xF3xima semana",date:ke},{label:"2 semanas",date:Ot}].map((ce,$e)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Je=>Je.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Je=>Je.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pe]:ce.date}),H(null);},children:ce.label},$e))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:Le=>Le.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(me.id,{[Pe]:void 0}),H(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>H(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.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:Qe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>H(Le=>Le?{...Le,month:new Date(Le.month.getFullYear(),Le.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((Le,U)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Le},U))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Le=Qe?.month||new Date,U=Le.getFullYear(),ke=Le.getMonth(),Ot=new Date(U,ke,1).getDay(),P=new Date(U,ke+1,0).getDate(),ce=new Date,$e=[];for(let xt=Ot-1;xt>=0;xt--)$e.push({day:new Date(U,ke,-xt).getDate(),date:new Date(U,ke-1,new Date(U,ke,-xt).getDate()),isCurrentMonth:false});for(let xt=1;xt<=P;xt++)$e.push({day:xt,date:new Date(U,ke,xt),isCurrentMonth:true});let Je=42-$e.length;for(let xt=1;xt<=Je;xt++)$e.push({day:xt,date:new Date(U,ke+1,xt),isCurrentMonth:false});return $e.map((xt,za)=>{let ta=xt.date.toDateString()===ce.toDateString(),na=(Ye?typeof Ye=="string"?new Date(Ye):Ye:null)?.toDateString()===xt.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:xt.isCurrentMonth?na?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:na?"#2E94FF":"transparent",boxShadow:ta&&!na?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(me.id,{[Pe]:xt.date}),H(null);},children:xt.day},za)})})()})]})]})]}),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:He(me)})});case "assignees":if(A)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 gt=r.filter(Le=>me.assignees?.some(U=>U.name===Le.name||U.initials===Le.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(No,{assignedUsers:gt,availableUsers:r,onChange:Le=>{let U=Le.map(ke=>({id:ke.id,name:ke.name,initials:ke.initials,color:ke.color}));g?.(me.id,{assignees:U.length>0?U:void 0});}})});case "status":if(A){let Le=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:Le})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(mu,{status:me.status||"todo",onChange:Le=>{g?.(me.id,{status:Le,progress:Le==="completed"?100:me.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:A?.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 Ut={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ta={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ya=Ut[me.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Le=>Le.stopPropagation(),children:jsx(Co,{priority:ya,onChange:Le=>{Le&&g?.(me.id,{priority:Ta[Le]||"medium"});}})});default:return null}},Ke=V=>[{id:"hide",label:"Hide Column",icon:Vt.Hide,onClick:()=>l(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Vt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Vt.SortDesc,onClick:()=>{}}],qe=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(V.id);}},{id:"duplicate",label:B?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([V.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{D?D(V.id,V.name):f?.([V.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{n?.(V);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{k?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{g?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{g?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{g?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:B?.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{h?.([V.id]);}},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{D?D(V.id,V.name):f?.([V.id]);}}],ge=u.filter(V=>V.visible),te=ge.reduce((V,me)=>V+me.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:te},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ue}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ge.map((V,me)=>{let Z=me===ge.length-1,A=V.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${A?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(A?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Z?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:j=>{j.preventDefault(),J({isOpen:true,x:j.clientX,y:j.clientY,type:"header",columnId:V.id});},onMouseEnter:j=>{j.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:j=>{j.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:V.label,children:V.label}),V.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:_e===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:j=>{j.preventDefault(),j.stopPropagation(),M(V.id),re(j.clientX),O(V.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},V.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(Qs,{columns:u,onToggleColumn:l,theme:t}),jsx("button",{onClick:()=>N(!se),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"})}),se&&jsxs("div",{ref:Y,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:V=>V.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:()=>N(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:Se},children:ve.map(({task:V,level:me},Z)=>{let A=_(V.id),j=ze===V.id,ae=j&&nt==="above",Ne=j&&nt==="below",Pe=j&&nt==="child",Ye={};return Pe&&(Ye.backgroundColor=`${t.accent}15`,Ye.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${pe===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:A?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:A?t.accentLight:Pe?`${t.accent}15`:Z%2===0?t.bgPrimary:t.bgGrid,...Ye},onMouseEnter:()=>R(V.id),onMouseLeave:()=>R(null),onClick:Oe=>{let gt=pn(e).map(ya=>ya.id),Ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?Oe.metaKey:Oe.ctrlKey;he(V.id,gt,Ta,Oe.shiftKey),s?.(V);},onDoubleClick:Oe=>{Oe.stopPropagation(),n?.(V);},onContextMenu:Oe=>{Oe.preventDefault(),J({isOpen:true,x:Oe.clientX,y:Oe.clientY,type:"task",task:V}),d?.(V,Oe);},whileHover:{backgroundColor:A?t.accentLight:t.hoverBg},children:[ae&&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}}),ge.map((Oe,Dt)=>{let gt=Dt===ge.length-1,Ut=Oe.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ut?"justify-start":"justify-center"}`,style:{width:`${Oe.width}px`,minWidth:`${Oe.minWidth??(Ut?200:60)}px`,maxWidth:`${Oe.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:gt?"none":`1px solid ${S===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:we(Oe,V,Ut?me:0)},`${V.id}-${Oe.id}`)})]},V.id)})}),jsx(un,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?Ke(q.columnId):q.type==="task"&&q.task?qe(q.task):[],onClose:()=>J({...q,isOpen:false}),theme:t}),Te&&ft&&pe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:ft.x+12,top:ft.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=ve.find(me=>me.task.id===pe)?.task;return V?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:V.name})}):null})()}),document.body)]})}function jp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,d]=useState(e),[c,i]=useState(t),[u,l]=useState(null),[m,g]=useState(null),[x,b]=useState(null),[v,f]=useState(null),[h,w]=useState(0),[y,k]=useState(0),[C,D]=useState(null),[T,L]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:l,hoveredTaskId:m,setHoveredTaskId:g,activeZone:x,setActiveZone:b,draggedSegmentIndex:v,setDraggedSegmentIndex:f,draggedSegmentStartX:h,setDraggedSegmentStartX:w,segmentDragOffsetX:y,setSegmentDragOffsetX:k,hoveredSegmentIndex:C,setHoveredSegmentIndex:D,isHovered:T,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(de,F)=>{r("none"),l(null),g(null),d(de),i(F),k(0),f(null),w(0);}}}function oi({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:l,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:x,onHoverChange:b,showBaseline:v,showTaskBarLabels:f=true,showCriticalPath:h=true,readOnly:w=false}){let y=jp(t,r),k=useRef(null),C=useRef(false),D=useRef(null),T=useRef(null),{dragMode:L,setDragMode:B,dragOffset:S,setDragOffset:R,ghostX:$,setGhostX:de,ghostWidth:F,setGhostWidth:X,connectionLine:xe,setConnectionLine:_e,hoveredTaskId:M,setHoveredTaskId:W,activeZone:re,setActiveZone:Ce,draggedSegmentIndex:O,setDraggedSegmentIndex:q,draggedSegmentStartX:J,setDraggedSegmentStartX:pe,segmentDragOffsetX:Be,setSegmentDragOffsetX:ze,hoveredSegmentIndex:it,setHoveredSegmentIndex:nt,isHovered:oe,setIsHovered:ct,isDragging:Re,isResizing:yt,isConnecting:ft,resetDragState:pt}=y,Te=18,Xe=!!o.executionBarBg,ot=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Qe=Xe?3:6,H=e.subtasks&&e.subtasks.length>0,se=e.endDate&&(()=>{let Z=new Date;Z.setHours(0,0,0,0);let A=new Date(e.endDate);return A.setHours(0,0,0,0),A<Z})()&&e.progress<100,N=h&&e.isCriticalPath,Y=o.name==="neutral"||o.today==="#1C1917",ie=e.status==="completed"||e.progress===100,he={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ee=h&&e.isCriticalPath||se?"#EF4444":e.color?e.color:e.priority&&he[e.priority]?he[e.priority]:o.taskBarPrimary,Ve=w?"default":Re?ft?"crosshair":yt?"ew-resize":"grabbing":"grab",ve=w?"default":"ew-resize",Se=(Z=>Z>=80?20:Z>=60?15:Z>=50?12:10)(r),He=r<50,lt=r<40;useEffect(()=>{b&&(!oe||Re||e.segments)&&b(null);},[oe,Re,e.segments,b]);let st=Z=>Z.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),dt=()=>{let Z=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Z} day${Z!==1?"s":""}`},mt=Z=>Math.round(Z/s)*s,It=Z=>{let A=Math.round(Z/s),j=new Date(n);return j.setDate(j.getDate()+A),j},z=(Z,A)=>{for(let j of g){if(j.id===e.id)continue;let ae=5;if(Z>=j.x-ae&&Z<=j.x+j.width+ae&&A>=j.y-ae&&A<=j.y+j.height+ae)return j.id}return null},fe=useCallback((Z,A,j)=>{if(w)return;Z.preventDefault(),Z.stopPropagation();let ae=k.current?.ownerSVGElement;if(!ae)return;let Ne=ae.createSVGPoint();Ne.x=Z.clientX,Ne.y=Z.clientY;let Pe=Ne.matrixTransform(ae.getScreenCTM()?.inverse()),Ye=j!==void 0?j:t,Oe=A;if(!Oe){let Dt=Pe.x-Ye;Z.shiftKey?(Oe="connect",_e({x:t+r,y:a+Te/2})):Z.ctrlKey||Z.metaKey?Oe="move":Z.altKey?Oe=Dt<r/2?"resize-start":"resize-end":lt?Dt<r/2?Oe="move":Oe="resize-end":He?Dt<=Se/2?Oe="resize-start":Dt>=r-Se/2?Oe="resize-end":Oe="move":Dt<=Se?Oe="resize-start":Dt>=r-Se?Oe="resize-end":Oe="move";}C.current=false,B(Oe),ct(false),Ce(null),Oe==="move"?R(Pe.x-Ye):Oe==="connect"?_e({x:t+r,y:a+Te/2}):R(0),de(Ye),X(r);},[t,r,a,Te,w]),we=useCallback(Z=>{let A=k.current?.ownerSVGElement;if(!A)return;let j=A.closest(".gantt-timeline-scroll");if(!j)return;let ae=j.getBoundingClientRect(),Ne=60,Pe=15,Ye=0;if(Z.clientX<ae.left+Ne){let Oe=ae.left+Ne-Z.clientX;Ye=-Math.min(Pe,Oe/2);}else if(Z.clientX>ae.right-Ne){let Oe=Z.clientX-(ae.right-Ne);Ye=Math.min(Pe,Oe/2);}return Ye!==0&&(j.scrollLeft+=Ye),Ye!==0},[]),Ke=useCallback(Z=>{if(L==="none")return;C.current=true,T.current=Z;let A=k.current?.ownerSVGElement;if(!A)return;if(L==="move"||L==="resize-start"||L==="resize-end"){let Ne=we(Z);Ne&&!D.current?D.current=window.setInterval(()=>{T.current&&(we(T.current),Ke(T.current));},16):!Ne&&D.current&&(window.clearInterval(D.current),D.current=null);}let j=A.createSVGPoint();j.x=Z.clientX,j.y=Z.clientY;let ae=j.matrixTransform(A.getScreenCTM()?.inverse());if(L==="connect"){_e({x:ae.x,y:ae.y});let Ne=z(ae.x,ae.y);W(Ne);}else if(L==="move"){let Ne=ae.x-S,Pe=mt(Ne);de(Pe),X(r);let Ye=Math.round((Pe-t)/s);if(x?.(e.id,Ye,true),e.segments&&e.segments.length>0&&O!==null){let Oe=Pe-J;ze(Oe);}}else if(L==="resize-start"){let Ne=ae.x,Pe=mt(Ne),Ye=t+r-Pe;Ye>=s&&(de(Pe),X(Ye));}else if(L==="resize-end"){let Ne=ae.x,Ye=mt(Ne)-t;Ye>=s&&X(Ye);}},[L,t,r,s,S,e,mt,O,J,z,W,_e,de,X,ze,x,we]),qe=useCallback(()=>{if(D.current&&(window.clearInterval(D.current),D.current=null),T.current=null,L!=="none"){if(L==="connect")M&&m&&m(e,M),_e(null),W(null);else {let Z=e.endDate.getTime()-e.startDate.getTime(),A,j,ae=true;if(L==="move"){if(A=It($),j=new Date(A.getTime()+Z),e.segments&&e.segments.length>0&&O!==null){let Ne=Math.round(Be/s),Pe=e.segments.map((gt,Ut)=>{if(Ut===O){let Ta=new Date(gt.startDate),ya=new Date(gt.endDate);return Ta.setDate(Ta.getDate()+Ne),ya.setDate(ya.getDate()+Ne),{startDate:Ta,endDate:ya}}return gt}),Ye=Pe.flatMap(gt=>[gt.startDate,gt.endDate]),Oe=new Date(Math.min(...Ye.map(gt=>gt.getTime()))),Dt=new Date(Math.max(...Ye.map(gt=>gt.getTime())));l?.({...e,segments:Pe},Oe,Dt),pt(t,r);return}}else L==="resize-start"?(A=It($),j=e.endDate,A>j&&(console.warn("Invalid date range: start date must be before or equal to end date"),ae=false)):L==="resize-end"?(A=e.startDate,j=It($+F),j.setDate(j.getDate()-1),j<A&&(console.warn("Invalid date range: end date must be after or equal to start date"),ae=false)):ae=false;ae&&A&&j&&(j.getTime()<A.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,A,j));}x?.(e.id,0,false),pt(t,r);}},[L,$,F,e,l,M,m,t,r,s,It,Be,O,pt,x]);useEffect(()=>{if(L==="none")return;let Z=j=>{Ke(j);},A=()=>{qe();};return window.addEventListener("mousemove",Z),window.addEventListener("mouseup",A),()=>{window.removeEventListener("mousemove",Z),window.removeEventListener("mouseup",A),D.current&&(window.clearInterval(D.current),D.current=null);}},[L,Ke,qe]);let ge=Re&&!ft?$:t,te=Re&&!ft?F:r,V=d.taskClass(e);return jsxs("g",{ref:k,"data-task-bar":"true",onClick:()=>{!Re&&!C.current&&c?.(e),C.current=false;},onDoubleClick:Z=>{!Re&&!C.current&&(Z.stopPropagation(),i?.(e));},onContextMenu:Z=>{Z.preventDefault(),u?.(e,Z);},onMouseEnter:()=>!Re&&ct(true),onMouseMove:Z=>{b&&oe&&!Re&&!e.segments&&b({task:e,x:t,y:a,width:r,height:Te,showBelow:false,mouseX:Z.clientX,mouseY:Z.clientY});},onMouseLeave:()=>{Re||(ct(false),Ce(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),oe&&!Re&&!He&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Se,height:Te,fill:re==="resize-start"?o.accent:"transparent",opacity:re==="resize-start"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>Ce("resize-start"),onMouseDown:Z=>fe(Z,"resize-start")}),jsx("rect",{x:t+Se,y:a,width:r-Se*2,height:Te,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ce("move"),onMouseDown:Z=>fe(Z,"move")}),jsx("rect",{x:t+r-Se,y:a,width:Se,height:Te,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.15:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>Ce("resize-end"),onMouseDown:Z=>fe(Z,"resize-end")})]}),oe&&!Re&&lt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Ce("move"),onMouseDown:Z=>fe(Z,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.2:0,style:{cursor:ve,pointerEvents:"all"},onMouseEnter:()=>Ce("resize-end"),onMouseDown:Z=>fe(Z,"resize-end")}),oe&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Re&&!ft&&!e.segments&&jsx(motion.rect,{x:$,y:a,width:F,height:Te,rx:Qe,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),v&&e.baselineStartDate&&e.baselineEndDate&&!Re&&(()=>{let Z=e.baselineStartDate.getTime(),A=e.baselineEndDate.getTime(),j=n.getTime(),ae=864e5,Ne=(Z-j)/ae,Pe=(A-Z)/ae,Ye=Ne*s,Oe=Math.max(Pe*s,s),Dt=ge+te,gt=Ye+Oe,Ut=e.endDate?.getTime()??0,Ta=Math.ceil((Ut-A)/ae),ya=Ta>0,Le=Ta<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:Ye,y:a,width:Oe,height:Te,rx:Qe,fill:"none",stroke:ot?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ya&&Dt>gt&&jsx("rect",{x:gt,y:a,width:Dt-gt,height:Te,rx:0,fill:"#EF4444",opacity:.2}),ya&&jsxs("text",{x:Math.max(Dt,gt)+6,y:a+Te/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ta,"d"]}),Le&&jsxs("text",{x:Dt+6,y:a+Te/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ta,"d"]})]})})(),!e.segments&&Xe&&H&&(()=>{let A=a+(Te-6)/2,j=14,ae=a+(Te-j)/2,Ne=2;return jsxs("g",{"data-task-class":V,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:ge,y:A,width:te,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsx("rect",{x:ge,y:ae,width:Ne,height:j,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsx("rect",{x:ge+te-Ne,y:ae,width:Ne,height:j,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&Xe&&!H&&jsx(motion.rect,{x:ge,y:a,width:te,height:Te,rx:Qe,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":V,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!ft?.15:e.parentId?.6:1,scale:oe&&!Re?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>fe(Z),style:{cursor:Ve,pointerEvents:"all"}}),!e.segments&&!Xe&&jsx(motion.rect,{x:ge,y:a,width:te,height:Te,rx:Qe,fill:ee,"data-task-class":V,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!ft?.15:e.parentId?.6:oe?.9:.8,scale:oe&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:Z=>fe(Z),style:{cursor:H?"default":Ve,pointerEvents:"all"}}),Xe&&(se||N)&&!e.segments&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&(Xe&&H?null:jsx("rect",{x:ge,y:a,width:Math.max(te*(e.progress/100),Qe*2),height:Te,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})),!e.segments&&!H&&e.progress<100&&(()=>{let Z=e.progress>0?te*(e.progress/100):0,A=ge+Z,j=te-Z,ae=e.progress===0?Qe:0,Ne=e.progress===0?ge:A,Pe=e.progress===0?te:j;return jsxs(Fragment,{children:[jsx("rect",{x:Ne,y:a,width:Pe,height:Te,rx:ae,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Ne,y:a,width:Pe,height:Te,rx:ae,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),Xe&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!Re&&(()=>{let Z=ge+te*(e.progress/100),A=8,j=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:Z,cy:a+Te/2,r:A,fill:j?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:Z,y:a+Te/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:j?.initials||j?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((Z,A)=>{let j=(Z.startDate.getTime()-n.getTime())/864e5*s,Ne=(Z.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-j+s,Pe=Re&&L==="move"&&O===A,Ye=it===A,Oe=Pe?j+Be:j;return jsxs("g",{onMouseEnter:()=>!Re&&nt(A),onMouseLeave:()=>!Re&&nt(null),children:[jsx(motion.rect,{x:Oe,y:a,width:Ne,height:Te,rx:Qe,fill:ee,initial:{opacity:0,scale:.95},animate:{opacity:Pe||e.parentId?.6:Ye?.9:.8,scale:Ye&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Dt=>{Dt.stopPropagation(),q(A),pe(j),fe(Dt,void 0,j);},style:{cursor:Ve,pointerEvents:"all"}}),jsx("rect",{x:Oe,y:a,width:Ne*(e.progress/100),height:Te,rx:Qe,fill:ee,opacity:1,style:{pointerEvents:"none"}})]},`segment-${A}`)}),Y&&(se||N)&&!e.segments&&jsxs(Fragment,{children:[N&&!se&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsx("rect",{x:ge,y:a,width:te,height:Te,rx:Qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&te>60&&!e.segments&&!(Xe&&H)&&(()=>{let Z=d.taskLabel(e),A=typeof Z=="string"?Z:e.name,j=A.length>Math.floor(te/8)?`${A.substring(0,Math.floor(te/8))}...`:A;return jsx("text",{x:ge+8,y:a+Te/2,dominantBaseline:"middle",fill:ie?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ie?"line-through":"none"},children:j})})(),!Re&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(Xe?jsxs("text",{x:ge+te+6,y:a+Te/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):te>100?jsxs("text",{x:ge+te-12,y:a+Te/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&te>80&&!Re&&!e.segments&&!(Xe&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:ge+te-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:ge+te-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(oe||yt)&&!ft&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:ge-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>Ce("resize-start"),onMouseLeave:()=>Ce(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"resize-start");}}),jsx(motion.rect,{x:ge+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:re==="resize-start"||L==="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:ge+te-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ve},onMouseEnter:()=>Ce("resize-end"),onMouseLeave:()=>Ce(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"resize-end");}}),jsx(motion.rect,{x:ge+te-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:re==="resize-end"||L==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:oe&&!Re&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Ce("connect"),onMouseLeave:()=>Ce(null),onMouseDown:Z=>{Z.stopPropagation(),fe(Z,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:re==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ft&&xe&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Te/2,x2:xe.x,y2:xe.y,stroke:M?o.statusCompleted:o.accent,strokeWidth:M?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:M?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:xe.x,cy:xe.y,r:M?8:6,fill:M?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),M&&jsx(motion.text,{x:xe.x+15,y:xe.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:xe.x+10},animate:{opacity:1,x:xe.x+15},transition:{duration:.2},children:"Connect"})]}),(oe||Re)&&!ft&&!e.segments&&jsx(motion.rect,{x:ge-1,y:a-1,width:te+2,height:Te+2,rx:Qe+1,fill:"none",stroke:Re?o.accent:Xe?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:Xe?1:2,opacity:Re||Xe?.6:.4,initial:{opacity:0},animate:{opacity:Re||Xe?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),yt&&jsxs(Fragment,{children:[jsx("line",{x1:$,y1:0,x2:$,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:$+F,y1:0,x2:$+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:oe&&!Re&&!e.segments&&!b&&(()=>{let j=a<100,ae=j?a+Te+13:a-82-13,Ne=j?`M ${ge+te/2-6} ${a+Te+3} L ${ge+te/2} ${a+Te+13} L ${ge+te/2+6} ${a+Te+3}`:`M ${ge+te/2-6} ${a-13} L ${ge+te/2} ${a-3} L ${ge+te/2+6} ${a-13}`,Pe=ae+22,Ye=ae+40,Oe=ae+55,Dt=ae+70,gt=j?ae+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:j?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:j?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:ge+te/2-120,y:ae,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:ge+te/2,y:Pe,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:ge+te/2-110,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:ge+te/2-70,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.startDate)}),jsx("text",{x:ge+te/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:ge+te/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.endDate)}),jsx("text",{x:ge+te/2+10,y:Ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:ge+te/2+65,y:Ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt()}),jsx("text",{x:ge+te/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:ge+te/2+65,y:Oe,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:ge+te/2-110,y:Dt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:ge+te/2-50,y:Dt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ut=>Ut.name).join(", ").substring(0,30),e.assignees.map(Ut=>Ut.name).join(", ").length>30?"...":""]})]}),!j&&jsx("text",{x:ge+te/2,y:gt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:lt?"Left: move \u2022 Right: resize":He?"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 ud=260,mn=8,qp=16,nv=-12;function Xp({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:h,mouseX:w,mouseY:y}=e,C=h.effortMinutes!=null||h.timeLoggedMinutes!=null||h.soldEffortMinutes!=null?155:105,D=w+qp,T=y+nv-C;D+ud>window.innerWidth-mn&&(D=w-ud-qp),D<mn&&(D=mn);let L=T<mn;L&&(T=y+20),T+C>window.innerHeight-mn&&(T=window.innerHeight-mn-C),o({left:D,top:T,showBelow:L});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,d={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},c=h=>h.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let h=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${h} d\xEDa${h!==1?"s":""}`:`${h} day${h!==1?"s":""}`},u=h=>{if(h==null||h===0)return "N/A";let w=Math.floor(h/60),y=h%60;return w===0?`${y}m`:y===0?`${w}h`:`${w}h ${y}m`},l=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",x=t.accent||"#3B82F6",b=t.bgSecondary||"#1F2937",v=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:ud,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${v}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(ni,{label:d.start,value:s.startDate?c(s.startDate):"N/A",labelColor:l,valueColor:m}),jsx(ni,{label:d.duration,value:i(),labelColor:l,valueColor:m}),jsx(ni,{label:d.end,value:s.endDate?c(s.endDate):"N/A",labelColor:l,valueColor:m}),jsx(ni,{label:d.progress,value:`${s.progress}%`,labelColor:l,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:l},children:[d.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(h=>h.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:l},children:[d.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:l},children:[d.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:u(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:l},children:[d.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
126
126
  @keyframes gantt-tooltip-fade {
127
127
  from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
128
128
  to { opacity: 1; transform: translateY(0); }
129
129
  }
130
- `})]});return createPortal(f,document.body)}function ni({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 _n({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false,onHoverChange:c,hoverOverlayOnly:i=false}){let[,u]=useState(false),[l,m]=useState(null),g=r-t,x=g>0,b=Math.abs(g)<5,v=20,f=!b&&a<=e,h,w,y=a-e,k=e+y/2;if(w=k,n==="squared")if(b)h=`M ${e} ${t} L ${a} ${r}`;else if(f){let W=e+15,re=a-v,ke=x?t+20:t-20;w=re,h=`M ${e} ${t} L ${W} ${t} L ${W} ${ke} L ${re} ${ke} L ${re} ${r} L ${a} ${r}`;}else w=a-v,h=`M ${e} ${t} L ${w} ${t} L ${w} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;let C=5,D=`M ${a} ${r} L ${a-C} ${r-C*.5} M ${a} ${r} L ${a-C} ${r+C*.5}`,T=o.dependency,L=o.dependencyHover||T,B="#f87171",S="rgba(248, 113, 113, 0.15)",R=w,$=(t+r)/2;if(l)if(n==="squared")if(b)R=Math.max(e+10,Math.min(a-10,l.x)),$=t;else if(f){let M=e+15,W=a-v,re=x?t+20:t-20,ke=[[e,t,M,t],[M,t,M,re],[M,re,W,re],[W,re,W,r],[W,r,a,r]],O=1/0,q={x:R,y:$};for(let J of ke){let pe=de(l.x,l.y,J[0],J[1],J[2],J[3]),Be=Math.hypot(l.x-pe.x,l.y-pe.y);Be<O&&(O=Be,q=pe);}R=q.x,$=q.y;}else {let M=[[e,t,w,t],[w,t,w,r],[w,r,a,r]],W=1/0,re={x:R,y:$};for(let ke of M){let O=de(l.x,l.y,ke[0],ke[1],ke[2],ke[3]),q=Math.hypot(l.x-O.x,l.y-O.y);q<W&&(W=q,re=O);}R=re.x,$=re.y;}else {let M=k,W=t,re=k,ke=r,O=1/0,q=R,J=$;for(let pe=0;pe<=1;pe+=.02){let Be=1-pe,ze=Be*Be*Be*e+3*Be*Be*pe*M+3*Be*pe*pe*re+pe*pe*pe*a,it=Be*Be*Be*t+3*Be*Be*pe*W+3*Be*pe*pe*ke+pe*pe*pe*r,nt=Math.hypot(l.x-ze,l.y-it);nt<O&&(O=nt,q=ze,J=it);}R=q,$=J;}function de(M,W,re,ke,O,q){let J=O-re,pe=q-ke,Be=J*J+pe*pe;if(Be===0)return {x:re,y:ke};let ze=((M-re)*J+(W-ke)*pe)/Be;return ze=Math.max(0,Math.min(1,ze)),{x:re+ze*J,y:ke+ze*pe}}let F=M=>{let W=M.currentTarget.ownerSVGElement;if(!W)return;let re=W.getScreenCTM();if(!re)return;let ke=re.inverse();m({x:ke.a*M.clientX+ke.c*M.clientY+ke.e,y:ke.b*M.clientX+ke.d*M.clientY+ke.f});},X=()=>{u(false),m(null),c?.(false);},xe=()=>{u(true),c?.(true);},_e=M=>s?jsxs(motion.g,{initial:M,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:W=>{W.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:R,cy:$,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:R,cy:$,r:9,fill:S,stroke:B,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:R-3,y1:$-3,x2:R+3,y2:$+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:R+3,y1:$-3,x2:R-3,y2:$+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return d?jsxs("g",{"data-dependency-line":"true",onMouseLeave:X,onMouseMove:F,children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:h,fill:"none",stroke:L,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:h,fill:"none",stroke:L,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:D,fill:"none",stroke:L,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:L,opacity:.9,style:{pointerEvents:"none"}}),_e({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:xe,onMouseLeave:X,onMouseMove:F,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:h,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:h,fill:"none",stroke:L,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:h,fill:"none",stroke:L,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:D,fill:"none",stroke:L,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:L,style:{pointerEvents:"none"}}),_e({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:xe,onMouseLeave:X,onMouseMove:F,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:h,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsx(motion.path,{d:D,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function di({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),d=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:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children: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 Me={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(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,c=i=>{if(!n.has(i)){n.add(i),d.add(i);let u=r.get(i)||[];for(let l of u){if(!n.has(l)&&c(l))return true;if(d.has(l))return true}}return d.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=Me.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Me.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Me.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=Me.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
130
+ `})]});return createPortal(f,document.body)}function ni({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 _n({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false,onHoverChange:c,hoverOverlayOnly:i=false}){let[,u]=useState(false),[l,m]=useState(null),g=r-t,x=g>0,b=Math.abs(g)<5,v=20,f=!b&&a<=e,h,w,y=a-e,k=e+y/2;if(w=k,n==="squared")if(b)h=`M ${e} ${t} L ${a} ${r}`;else if(f){let W=e+15,re=a-v,Ce=x?t+20:t-20;w=re,h=`M ${e} ${t} L ${W} ${t} L ${W} ${Ce} L ${re} ${Ce} L ${re} ${r} L ${a} ${r}`;}else w=a-v,h=`M ${e} ${t} L ${w} ${t} L ${w} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${k} ${t}, ${k} ${r}, ${a} ${r}`;let C=5,D=`M ${a} ${r} L ${a-C} ${r-C*.5} M ${a} ${r} L ${a-C} ${r+C*.5}`,T=o.dependency,L=o.dependencyHover||T,B="#f87171",S="rgba(248, 113, 113, 0.15)",R=w,$=(t+r)/2;if(l)if(n==="squared")if(b)R=Math.max(e+10,Math.min(a-10,l.x)),$=t;else if(f){let M=e+15,W=a-v,re=x?t+20:t-20,Ce=[[e,t,M,t],[M,t,M,re],[M,re,W,re],[W,re,W,r],[W,r,a,r]],O=1/0,q={x:R,y:$};for(let J of Ce){let pe=de(l.x,l.y,J[0],J[1],J[2],J[3]),Be=Math.hypot(l.x-pe.x,l.y-pe.y);Be<O&&(O=Be,q=pe);}R=q.x,$=q.y;}else {let M=[[e,t,w,t],[w,t,w,r],[w,r,a,r]],W=1/0,re={x:R,y:$};for(let Ce of M){let O=de(l.x,l.y,Ce[0],Ce[1],Ce[2],Ce[3]),q=Math.hypot(l.x-O.x,l.y-O.y);q<W&&(W=q,re=O);}R=re.x,$=re.y;}else {let M=k,W=t,re=k,Ce=r,O=1/0,q=R,J=$;for(let pe=0;pe<=1;pe+=.02){let Be=1-pe,ze=Be*Be*Be*e+3*Be*Be*pe*M+3*Be*pe*pe*re+pe*pe*pe*a,it=Be*Be*Be*t+3*Be*Be*pe*W+3*Be*pe*pe*Ce+pe*pe*pe*r,nt=Math.hypot(l.x-ze,l.y-it);nt<O&&(O=nt,q=ze,J=it);}R=q,$=J;}function de(M,W,re,Ce,O,q){let J=O-re,pe=q-Ce,Be=J*J+pe*pe;if(Be===0)return {x:re,y:Ce};let ze=((M-re)*J+(W-Ce)*pe)/Be;return ze=Math.max(0,Math.min(1,ze)),{x:re+ze*J,y:Ce+ze*pe}}let F=M=>{let W=M.currentTarget.ownerSVGElement;if(!W)return;let re=W.getScreenCTM();if(!re)return;let Ce=re.inverse();m({x:Ce.a*M.clientX+Ce.c*M.clientY+Ce.e,y:Ce.b*M.clientX+Ce.d*M.clientY+Ce.f});},X=()=>{u(false),m(null),c?.(false);},xe=()=>{u(true),c?.(true);},_e=M=>s?jsxs(motion.g,{initial:M,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:W=>{W.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:R,cy:$,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:R,cy:$,r:9,fill:S,stroke:B,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:R-3,y1:$-3,x2:R+3,y2:$+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:R+3,y1:$-3,x2:R-3,y2:$+3,stroke:B,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return d?jsxs("g",{"data-dependency-line":"true",onMouseLeave:X,onMouseMove:F,children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:h,fill:"none",stroke:L,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:h,fill:"none",stroke:L,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:D,fill:"none",stroke:L,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:L,opacity:.9,style:{pointerEvents:"none"}}),_e({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:xe,onMouseLeave:X,onMouseMove:F,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:h,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:h,fill:"none",stroke:L,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:h,fill:"none",stroke:L,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:D,fill:"none",stroke:L,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:L,style:{pointerEvents:"none"}}),_e({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:xe,onMouseLeave:X,onMouseMove:F,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:h,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsx(motion.path,{d:D,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function di({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),d=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:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children: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 Me={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(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,c=i=>{if(!n.has(i)){n.add(i),d.add(i);let u=r.get(i)||[];for(let l of u){if(!n.has(l)&&c(l))return true;if(d.has(l))return true}}return d.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=Me.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Me.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Me.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=Me.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
131
131
  `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Me.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=Me.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)=>Me.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Me.findTaskById(e,t);return !a||!a.dependencies?[]:Me.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Me.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Me.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=Me.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=>Me.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=Me.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],d=s.map(c=>{let i=c.startDate&&c.endDate?Me.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Me.formatDate(c.startDate):"N/A",c.endDate?Me.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:d,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t)=>{let a=await import('xlsx'),r=Me.flattenTasks(e),o=new Map,s=(u,l="")=>{[...u].sort((g,x)=>(g.position??0)-(x.position??0)).forEach((g,x)=>{let b=l?`${l}.${x+1}`:`${x+1}`;o.set(g.id,b),g.subtasks?.length&&s(g.subtasks,b);});};s(e);let n=r.map(u=>{let l=u.startDate&&u.endDate?Me.calculateDuration(u.startDate,u.endDate):0,m=u.effortMinutes,g=u.timeLoggedMinutes,x=u.soldEffortMinutes;return {WBS:o.get(u.id)||"","Task Name":u.name,"Start Date":u.startDate?Me.formatDate(u.startDate):"","End Date":u.endDate?Me.formatDate(u.endDate):"","Duration (days)":l>0?l:"","Progress (%)":u.progress,Status:u.status||"",Assignees:u.assignees?.map(b=>b.name).join(", ")||"","Estimated (h)":typeof m=="number"?+(m/60).toFixed(1):"","Logged (h)":typeof g=="number"?+(g/60).toFixed(1):"","Quoted (h)":typeof x=="number"?+(x/60).toFixed(1):"","Is Milestone":u.isMilestone?"Yes":"No"}}),d=a.utils.json_to_sheet(n),c=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},{wch:12}];d["!cols"]=c;let i=a.utils.book_new();if(a.utils.book_append_sheet(i,d,"Gantt Tasks"),!t){let u=new Date,l=g=>String(g).padStart(2,"0");t=`Project_${`${u.getFullYear()}-${l(u.getMonth()+1)}-${l(u.getDate())}_${l(u.getHours())}${l(u.getMinutes())}`}.xlsx`;}a.writeFile(i,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Me.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Me.getEarliestStartDate(e)||new Date,d=Me.getLatestEndDate(e)||new Date,c=r.map((m,g)=>{let x=o.get(m.id),b=m.startDate&&m.endDate?Me.calculateDuration(m.startDate,m.endDate):0,v=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${o.get(f)}</PredecessorUID>
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
358
358
  </Calendars>
359
359
  <Tasks>${c}
360
360
  </Tasks>
361
- </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=Me.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 u=i.startDate&&i.endDate?Me.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let x=t.find(b=>b.id===g);if(x){o(x);let b=r.get(g)?.ef||0;l=Math.max(l,b);}}let m=l+u;r.set(i.id,{es:l,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?Me.calculateDuration(i.startDate,i.endDate):0,l=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),m=s;if(l.length>0)for(let x of l){d(x);let b=n.get(x.id)?.ls||0;m=Math.min(m,b);}let g=m-u;n.set(i.id,{ls:g,lf:m});};a.forEach(d);let c=[];for(let i of a){let u=r.get(i.id),l=n.get(i.id);if(u&&l){let m=l.ls-u.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let a=Me.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Me.calculateCriticalPath(e).includes(t))return 0;let o=Me.getDependentTasks(e,t);if(o.length===0){let d=Me.getLatestEndDate(e);if(!d)return null;let c=Me.calculateDuration(a.endDate,d);return Math.max(0,c)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,c)=>d-c)[0];if(!s)return null;let n=Me.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Me.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Me.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Me.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=Me.calculateDuration(n.startDate,n.endDate),c;a!==void 0?(c=new Date(n.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let i=Me.calculateEndDate(c,d),u=l=>l.map(m=>m.id===n.id?{...m,startDate:c,endDate:i}:m.subtasks?{...m,subtasks:u(m.subtasks)}:m);s=u(s),s=Me.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let c=[],i=o.getTime(),u=1e3*60*60*24,l=Me.findTaskById(e,t);if(!l||!l.endDate)return [];let m=(g,x,b=new Set)=>{if(b.has(g))return;b.add(g);let v=Me.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let h=r.findIndex(S=>S.id===f.id);if(h===-1)continue;let w=f.startDate.getTime(),k=(f.endDate.getTime()-w)/u,D=(w-i)/u*s,T=D+x*s,L=Math.max(k*s,s),B=d+h*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:D,previewX:T,width:L,y:B,rowIndex:h,daysDelta:x,color:f.color}),m(f.id,x,b);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Me.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=u=>u.map(l=>l.id===o.id?{...l,endDate:d,segments:c}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function ui({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:l,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:x,onDependencyCreate:b,onDependencyDelete:v,showBaseline:f,showCriticalPath:h=true,showDependencies:w=true,highlightWeekends:y=true,canEditTask:k}){let D=Nr(),T=useRef(null),[L,B]=useState([]),[S,R]=useState(null),[$,de]=useState(null),[F,X]=useState(null),xe=useRef(false),[_e,M]=useState(new Set),[W,re]=useState(null),ke=useCallback(H=>{if(F&&!xe.current){let se=H.target,N=false;for(;se&&se!==H.currentTarget;){if(se.getAttribute?.("data-dependency-line")==="true"||se.getAttribute?.("data-dependency-hover-overlay")==="true"){N=true;break}se=se.parentElement;}N||X(null);}},[F]),O=useCallback(H=>{de(H);},[]),q=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,pe=q*J*n,Be=H=>{let se=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),N=se.getUTCDay()||7;se.setUTCDate(se.getUTCDate()+4-N);let Y=new Date(Date.UTC(se.getUTCFullYear(),0,1));return Math.ceil(((se.getTime()-Y.getTime())/864e5+1)/7)},ze=H=>{let se=H.getDay();return se===0||se===6},it=useCallback(H=>{let se=Math.round(H/(J*n)),N=new Date(o);return N.setDate(N.getDate()+se),N},[o,J,n]),nt=useCallback((H,se)=>{if(se.startDate&&se.endDate)return;let N=H.currentTarget.ownerSVGElement;if(!N)return;let Y=N.createSVGPoint();Y.x=H.clientX,Y.y=H.clientY;let ie=Y.matrixTransform(N.getScreenCTM()?.inverse()),he=it(ie.x),_=new Date(he);_.setDate(_.getDate()+1),re(null),x?.(se,he,_);},[it,x]),oe=useCallback((H,se,N)=>{let Y=H.currentTarget.ownerSVGElement;if(!Y)return;let ie=Y.createSVGPoint();ie.x=H.clientX,ie.y=H.clientY;let he=ie.matrixTransform(Y.getScreenCTM()?.inverse()),_=it(he.x),Ve=Math.round(he.x/(J*n))*J*n;re({taskId:se.id,x:Ve,y:N*a+a/2,date:_});},[it,J,n,a]),ct=useCallback(()=>{re(null);},[]),Re=useMemo(()=>{let H=ie=>ie.map(he=>{if(he.subtasks&&he.subtasks.length>0){let _=H(he.subtasks),ee=_.filter(Ve=>Ve.startDate&&Ve.endDate);if(ee.length>0){let Ve=ee.map(He=>He.startDate.getTime()),ve=ee.map(He=>He.endDate.getTime()),Ue=new Date(Math.min(...Ve)),Se=new Date(Math.max(...ve));return {...he,subtasks:_,startDate:Ue,endDate:Se}}return {...he,subtasks:_}}return he}),se=(ie,he=[])=>{let _=[...ie].sort((ee,Ve)=>(ee.position??0)-(Ve.position??0));for(let ee of _)he.push(ee),ee.subtasks&&ee.subtasks.length>0&&(ee.isExpanded===void 0||ee.isExpanded)&&se(ee.subtasks,he);return he},N=H(e);return se(N)},[e]),yt=useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let se=H.startDate.getTime(),N=H.endDate.getTime(),Y=o.getTime(),ie=(se-Y)/(1e3*60*60*24),he=(N-se)/(1e3*60*60*24)+1,_=ie*J*n,ee=Math.max(J*n,40),Ve=Math.max(he*J*n,ee);return {x:_,width:Ve}},[o,J,n]),ft=useMemo(()=>Re.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:se,width:N}=yt(H),ie=Re.findIndex(he=>he.id===H.id)*a+(a-18)/2;return {id:H.id,x:se,y:ie,width:N,height:18}}),[Re,yt]),pt=useCallback((H,se,N)=>{if(!N){B([]),R(null);return}if(R({taskId:H,daysDelta:se}),se===0){B([]);return}let Y=Me.calculateCascadePreview(e,H,se,Re,o,J*n,a,48);B(Y);},[e,Re,o,J,n,a,48]),Te=useCallback((H,se)=>{if(!S)return se;let N=J*n,Y=S.daysDelta*N;if(H===S.taskId)return {x:se.x+Y,width:se.width};let ie=L.find(he=>he.taskId===H);return ie?{x:ie.previewX,width:ie.width}:se},[S,L,J,n]),Xe=useMemo(()=>{let H=[],se=new Date(o);for(;se<=s;){let ie=(se.getTime()-o.getTime())/864e5*J*n;if(r==="day")H.push({date:new Date(se),label:se.toLocaleDateString(d,{day:"numeric",month:"short"}),x:ie}),se.setDate(se.getDate()+1);else if(r==="week"){let he=Be(se);H.push({date:new Date(se),label:`${D.labels.week} ${he}`,x:ie}),se.setDate(se.getDate()+7);}else H.push({date:new Date(se),label:se.toLocaleDateString(d,{month:"short",year:"numeric"}),x:ie}),se.setMonth(se.getMonth()+1);}return H},[o,s,r,J,n,d,D.labels.week]),ot=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),Qe=Math.max(Re.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(pe,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(pe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),Xe.map((H,se)=>jsxs("g",{children:[se>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-${se}`)),ot>=0&&ot<=pe&&jsxs("g",{children:[jsx("circle",{cx:ot,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:ot,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${ot-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:D.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:T,width:Math.max(pe,1e3),height:Qe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:ke,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(pe,1e3),height:Qe,fill:t.bgPrimary}),Re.map((H,se)=>jsx("rect",{x:0,y:se*a,width:Math.max(pe,1e3),height:a,fill:se%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),Xe.map((H,se)=>se>0?jsx("line",{x1:H.x,y1:0,x2:H.x,y2:Re.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${se}`):null),y&&Xe.map((H,se)=>{let N=Xe[se+1]?.x||pe;return ze(H.date)?jsxs("g",{children:[jsx("rect",{x:H.x,y:0,width:N-H.x,height:Re.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:N-H.x,height:Re.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${se}`):null}),Re.map((H,se)=>{let N=H.startDate&&H.endDate;return jsx("g",{children:!N&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:se*a,width:pe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>nt(Y,H),onMouseMove:Y=>oe(Y,H,se),onMouseLeave:()=>{ct();}},`clickable-${H.id}`),W&&W.taskId===H.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:W.x,y1:se*a+4,x2:W.x,y2:se*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:W.x,cy:W.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:W.x,cy:W.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${W.x}, ${se*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:W.date.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!W||W.taskId!==H.id)&&jsx("text",{x:ot>0?ot:100,y:se*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),Re.map((H,se)=>{if(!H.startDate||!H.endDate)return null;let{x:N,width:Y}=yt(H),ie=se*a+(a-18)/2,he=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsx(di,{task:H,x:N+Y/2,y:ie+12,theme:t,onClick:l},H.id);if(he){let ee=ie+(a-18)/2+8,Ve=1.5,ve=6,Ue="rgba(255,255,255,0.25)";return jsxs("g",{onClick:()=>l?.(H),onContextMenu:Se=>{Se.preventDefault(),Se.stopPropagation(),g?.(H,Se);},onMouseMove:Se=>{O({task:H,x:N,y:ee,width:Y,height:2,showBelow:ee<100,mouseX:Se.clientX,mouseY:Se.clientY});},onMouseLeave:()=>O(null),style:{cursor:"default"},children:[jsx("rect",{x:N,y:ie,width:Y,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:N,y:ee,width:Y,height:2,fill:Ue}),jsx("rect",{x:N,y:ee,width:Ve,height:2+ve,fill:Ue}),jsx("rect",{x:N+Y-Ve,y:ee,width:Ve,height:2+ve,fill:Ue})]},H.id)}return jsx(oi,{task:H,x:N,y:ie,width:Y,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:l,onDoubleClick:m,onContextMenu:g,onDateChange:x,onDependencyCreate:b,allTaskPositions:ft,onDragMove:pt,onHoverChange:O,showBaseline:f,showTaskBarLabels:u,showCriticalPath:h,readOnly:k?!k(H):false},H.id)}),w&&Re.map((H,se)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(N=>{let Y=Re.find(He=>He.id===N);if(!Y||!Y.startDate||!Y.endDate)return null;let ie=Re.findIndex(He=>He.id===N),he=Te(Y.id,yt(Y)),_=Te(H.id,yt(H)),ee=he.x+he.width,Ve=ie*a+26,ve=_.x,Ue=se*a+26,Se=`dep-${N}-${H.id}`;return _e.has(Se)?null:jsx(_n,{x1:ee,y1:Ve,x2:ve,y2:Ue,theme:t,lineStyle:i,onDelete:()=>v?.(H.id,N),onHoverChange:He=>{xe.current=He,He&&X({key:Se,fromId:N,toId:H.id,exitX:ee,exitY:Ve,enterX:ve,enterY:Ue});}},Se)})),L.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}`)),w&&F&&jsx(_n,{x1:F.exitX,y1:F.exitY,x2:F.enterX,y2:F.enterY,theme:t,lineStyle:i,onDelete:()=>{let H=F.key;X(null),xe.current=false,M(se=>new Set(se).add(H)),v?.(F.toId,F.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{xe.current=H,H||X(null);}},`${F.key}-hover-overlay`),ot>=0&&ot<=pe&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:ot,y1:0,x2:ot,y2:Qe,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:ot,y1:0,x2:ot,y2:Qe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),$&&jsx(Xp,{tooltipData:$,theme:t,locale:d==="es"?"es":"en"})]})}var dv=['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"'],Zp=({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"})}),cv=()=>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"})}),uv=()=>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"})}),pv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),mv=()=>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 gi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:c}){let[i,u]=useState(false),[l,m]=useState(false),[g,x]=useState([]),[b,v]=useState(""),[f,h]=useState(false),[w,y]=useState(true),[k,C]=useState(""),[D,T]=useState(-1),[L,B]=useState(false),[S,R]=useState(0),$=useRef(null),de=useRef(null),F=useRef(null),X=useRef(null),{enabled:xe=true,placeholder:_e='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:W,suggestions:re=dv,maxHistory:ke=50,persistHistory:O,mentionableUsers:q=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",pe=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Be=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",ze=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)",it=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",nt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",oe=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)",Re=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",yt=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ft=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",pt=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)",Te=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",Xe=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",ot=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Qe=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)",se=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",N=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Y=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ie=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",he="rgba(46, 148, 255, 0.04)",_=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",ee=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ve=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",ve=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ue=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Se=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",He=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",lt=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",st="rgba(46, 148, 255, 0.06)",dt=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",mt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",It=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",z=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",fe=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Ce=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Ke=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",qe=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",ge=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",te=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",V=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",me=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Z=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",A=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)",ae=O?.storageKey||"gantt-ai-history",Ne=O?.maxMessages??5,Pe=q.filter(U=>{if(!k)return true;let we=k.toLowerCase();return U.name.toLowerCase().includes(we)||U.email&&U.email.toLowerCase().includes(we)}).slice(0,5),Ye=useCallback(U=>{if(v(U),q.length===0)return;let we=$.current;if(!we)return;let Ot=we.selectionStart||U.length,P=U.slice(0,Ot),ce=P.lastIndexOf("@");if(ce>=0&&((ce>0?P[ce-1]:" ")===" "||ce===0)){let Je=P.slice(ce+1);if(Je.length<=40){C(Je),T(ce),B(true),R(0);return}}B(false),C(""),T(-1);},[q.length]),Oe=useCallback(U=>{let we=b.slice(0,D),Ot=b.slice(D+1+k.length),P=`${we}@${U.name} ${Ot}`;v(P),B(false),C(""),T(-1),setTimeout(()=>$.current?.focus(),0);},[b,D,k]),Dt=useCallback(U=>{if(!L||Pe.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),R(we=>we<Pe.length-1?we+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),R(we=>we>0?we-1:Pe.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let we=Pe[S];return we&&Oe(we),true}return U.key==="Escape"?(B(false),true):false},[L,Pe,S,Oe]);useEffect(()=>{if(O?.enabled)try{let U=localStorage.getItem(ae);if(U){let Ot=JSON.parse(U).map(P=>({...P,timestamp:new Date(P.timestamp)}));x(Ot.slice(-Ne));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[O?.enabled,ae,Ne]),useEffect(()=>{if(O?.enabled&&g.length>0)try{let U=g.filter(we=>!we.isLoading).slice(-Ne);localStorage.setItem(ae,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,O?.enabled,ae,Ne]),useEffect(()=>{de.current&&de.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!l&&$.current&&setTimeout(()=>$.current?.focus(),100);},[i,l]);let gt=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&&d?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&c?.(U.taskId,U.dependencyFrom);break}},[o,s,n,d,c]),Ut=useCallback(async U=>{if(!U.trim()||f)return;let we={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};x(P=>[...P.slice(-(ke-1)),we]),v(""),y(false),h(true);let Ot={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(P=>[...P,Ot]);try{if(W){let P=await W(U,e);x(ce=>{let $e=ce.filter(xt=>!xt.isLoading),Je={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...$e,Je]}),gt(P);}else x(P=>[...P.filter($e=>!$e.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(P){x(ce=>[...ce.filter(Je=>!Je.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[f,ke,W,e,gt]),Ta=U=>{U.preventDefault(),Ut(b);},ya=U=>{v(U),$.current?.focus();};if(useEffect(()=>{let U=we=>{(we.metaKey||we.ctrlKey)&&we.key==="k"&&(we.preventDefault(),u(Ot=>!Ot),i||m(false)),we.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=Ot=>{let P=Ot.target;F.current&&!F.current.contains(P)&&u(false);},we=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(we),document.removeEventListener("mousedown",U);}},[i]),!xe)return null;let Le={"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(At,{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 ${Le[M]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:pe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Be}`,color:"#2E94FF",cursor:"pointer",boxShadow:ze,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${it}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${nt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(Zp,{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:Re,background:oe,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${ct}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
361
+ </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(u),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=Me.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 u=i.startDate&&i.endDate?Me.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let x=t.find(b=>b.id===g);if(x){o(x);let b=r.get(g)?.ef||0;l=Math.max(l,b);}}let m=l+u;r.set(i.id,{es:l,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?Me.calculateDuration(i.startDate,i.endDate):0,l=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),m=s;if(l.length>0)for(let x of l){d(x);let b=n.get(x.id)?.ls||0;m=Math.min(m,b);}let g=m-u;n.set(i.id,{ls:g,lf:m});};a.forEach(d);let c=[];for(let i of a){let u=r.get(i.id),l=n.get(i.id);if(u&&l){let m=l.ls-u.es;Math.abs(m)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let a=Me.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Me.calculateCriticalPath(e).includes(t))return 0;let o=Me.getDependentTasks(e,t);if(o.length===0){let d=Me.getLatestEndDate(e);if(!d)return null;let c=Me.calculateDuration(a.endDate,d);return Math.max(0,c)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,c)=>d-c)[0];if(!s)return null;let n=Me.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Me.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Me.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Me.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=Me.calculateDuration(n.startDate,n.endDate),c;a!==void 0?(c=new Date(n.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let i=Me.calculateEndDate(c,d),u=l=>l.map(m=>m.id===n.id?{...m,startDate:c,endDate:i}:m.subtasks?{...m,subtasks:u(m.subtasks)}:m);s=u(s),s=Me.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let c=[],i=o.getTime(),u=1e3*60*60*24,l=Me.findTaskById(e,t);if(!l||!l.endDate)return [];let m=(g,x,b=new Set)=>{if(b.has(g))return;b.add(g);let v=Me.getDependentTasks(e,g);for(let f of v){if(!f.startDate||!f.endDate)continue;let h=r.findIndex(S=>S.id===f.id);if(h===-1)continue;let w=f.startDate.getTime(),k=(f.endDate.getTime()-w)/u,D=(w-i)/u*s,T=D+x*s,L=Math.max(k*s,s),B=d+h*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:D,previewX:T,width:L,y:B,rowIndex:h,daysDelta:x,color:f.color}),m(f.id,x,b);}};return m(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Me.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=u=>u.map(l=>l.id===o.id?{...l,endDate:d,segments:c}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function ui({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:l,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:x,onDependencyCreate:b,onDependencyDelete:v,showBaseline:f,showCriticalPath:h=true,showDependencies:w=true,highlightWeekends:y=true,canEditTask:k}){let D=Nr(),T=useRef(null),[L,B]=useState([]),[S,R]=useState(null),[$,de]=useState(null),[F,X]=useState(null),xe=useRef(false),[_e,M]=useState(new Set),[W,re]=useState(null),Ce=useCallback(H=>{if(F&&!xe.current){let se=H.target,N=false;for(;se&&se!==H.currentTarget;){if(se.getAttribute?.("data-dependency-line")==="true"||se.getAttribute?.("data-dependency-hover-overlay")==="true"){N=true;break}se=se.parentElement;}N||X(null);}},[F]),O=useCallback(H=>{de(H);},[]),q=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,pe=q*J*n,Be=H=>{let se=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),N=se.getUTCDay()||7;se.setUTCDate(se.getUTCDate()+4-N);let Y=new Date(Date.UTC(se.getUTCFullYear(),0,1));return Math.ceil(((se.getTime()-Y.getTime())/864e5+1)/7)},ze=H=>{let se=H.getDay();return se===0||se===6},it=useCallback(H=>{let se=Math.round(H/(J*n)),N=new Date(o);return N.setDate(N.getDate()+se),N},[o,J,n]),nt=useCallback((H,se)=>{if(se.startDate&&se.endDate)return;let N=H.currentTarget.ownerSVGElement;if(!N)return;let Y=N.createSVGPoint();Y.x=H.clientX,Y.y=H.clientY;let ie=Y.matrixTransform(N.getScreenCTM()?.inverse()),he=it(ie.x),_=new Date(he);_.setDate(_.getDate()+1),re(null),x?.(se,he,_);},[it,x]),oe=useCallback((H,se,N)=>{let Y=H.currentTarget.ownerSVGElement;if(!Y)return;let ie=Y.createSVGPoint();ie.x=H.clientX,ie.y=H.clientY;let he=ie.matrixTransform(Y.getScreenCTM()?.inverse()),_=it(he.x),Ve=Math.round(he.x/(J*n))*J*n;re({taskId:se.id,x:Ve,y:N*a+a/2,date:_});},[it,J,n,a]),ct=useCallback(()=>{re(null);},[]),Re=useMemo(()=>{let H=ie=>ie.map(he=>{if(he.subtasks&&he.subtasks.length>0){let _=H(he.subtasks),ee=_.filter(Ve=>Ve.startDate&&Ve.endDate);if(ee.length>0){let Ve=ee.map(He=>He.startDate.getTime()),ve=ee.map(He=>He.endDate.getTime()),Ue=new Date(Math.min(...Ve)),Se=new Date(Math.max(...ve));return {...he,subtasks:_,startDate:Ue,endDate:Se}}return {...he,subtasks:_}}return he}),se=(ie,he=[])=>{let _=[...ie].sort((ee,Ve)=>(ee.position??0)-(Ve.position??0));for(let ee of _)he.push(ee),ee.subtasks&&ee.subtasks.length>0&&(ee.isExpanded===void 0||ee.isExpanded)&&se(ee.subtasks,he);return he},N=H(e);return se(N)},[e]),yt=useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let se=H.startDate.getTime(),N=H.endDate.getTime(),Y=o.getTime(),ie=(se-Y)/(1e3*60*60*24),he=(N-se)/(1e3*60*60*24)+1,_=ie*J*n,ee=Math.max(J*n,40),Ve=Math.max(he*J*n,ee);return {x:_,width:Ve}},[o,J,n]),ft=useMemo(()=>Re.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:se,width:N}=yt(H),ie=Re.findIndex(he=>he.id===H.id)*a+(a-18)/2;return {id:H.id,x:se,y:ie,width:N,height:18}}),[Re,yt]),pt=useCallback((H,se,N)=>{if(!N){B([]),R(null);return}if(R({taskId:H,daysDelta:se}),se===0){B([]);return}let Y=Me.calculateCascadePreview(e,H,se,Re,o,J*n,a,48);B(Y);},[e,Re,o,J,n,a,48]),Te=useCallback((H,se)=>{if(!S)return se;let N=J*n,Y=S.daysDelta*N;if(H===S.taskId)return {x:se.x+Y,width:se.width};let ie=L.find(he=>he.taskId===H);return ie?{x:ie.previewX,width:ie.width}:se},[S,L,J,n]),Xe=useMemo(()=>{let H=[],se=new Date(o);for(;se<=s;){let ie=(se.getTime()-o.getTime())/864e5*J*n;if(r==="day")H.push({date:new Date(se),label:se.toLocaleDateString(d,{day:"numeric",month:"short"}),x:ie}),se.setDate(se.getDate()+1);else if(r==="week"){let he=Be(se);H.push({date:new Date(se),label:`${D.labels.week} ${he}`,x:ie}),se.setDate(se.getDate()+7);}else H.push({date:new Date(se),label:se.toLocaleDateString(d,{month:"short",year:"numeric"}),x:ie}),se.setMonth(se.getMonth()+1);}return H},[o,s,r,J,n,d,D.labels.week]),ot=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),Qe=Math.max(Re.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(pe,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(pe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),Xe.map((H,se)=>jsxs("g",{children:[se>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-${se}`)),ot>=0&&ot<=pe&&jsxs("g",{children:[jsx("circle",{cx:ot,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:ot,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${ot-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:D.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:T,width:Math.max(pe,1e3),height:Qe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Ce,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(pe,1e3),height:Qe,fill:t.bgPrimary}),Re.map((H,se)=>jsx("rect",{x:0,y:se*a,width:Math.max(pe,1e3),height:a,fill:se%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),Xe.map((H,se)=>se>0?jsx("line",{x1:H.x,y1:0,x2:H.x,y2:Re.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${se}`):null),y&&Xe.map((H,se)=>{let N=Xe[se+1]?.x||pe;return ze(H.date)?jsxs("g",{children:[jsx("rect",{x:H.x,y:0,width:N-H.x,height:Re.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:N-H.x,height:Re.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${se}`):null}),Re.map((H,se)=>{let N=H.startDate&&H.endDate;return jsx("g",{children:!N&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:se*a,width:pe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Y=>nt(Y,H),onMouseMove:Y=>oe(Y,H,se),onMouseLeave:()=>{ct();}},`clickable-${H.id}`),W&&W.taskId===H.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:W.x,y1:se*a+4,x2:W.x,y2:se*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:W.x,cy:W.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:W.x,cy:W.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${W.x}, ${se*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:W.date.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!W||W.taskId!==H.id)&&jsx("text",{x:ot>0?ot:100,y:se*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),Re.map((H,se)=>{if(!H.startDate||!H.endDate)return null;let{x:N,width:Y}=yt(H),ie=se*a+(a-18)/2,he=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsx(di,{task:H,x:N+Y/2,y:ie+12,theme:t,onClick:l},H.id);if(he){let ee=ie+(a-18)/2+8,Ve=1.5,ve=6,Ue="rgba(255,255,255,0.25)";return jsxs("g",{onClick:()=>l?.(H),onContextMenu:Se=>{Se.preventDefault(),Se.stopPropagation(),g?.(H,Se);},onMouseMove:Se=>{O({task:H,x:N,y:ee,width:Y,height:2,showBelow:ee<100,mouseX:Se.clientX,mouseY:Se.clientY});},onMouseLeave:()=>O(null),style:{cursor:"default"},children:[jsx("rect",{x:N,y:ie,width:Y,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:N,y:ee,width:Y,height:2,fill:Ue}),jsx("rect",{x:N,y:ee,width:Ve,height:2+ve,fill:Ue}),jsx("rect",{x:N+Y-Ve,y:ee,width:Ve,height:2+ve,fill:Ue})]},H.id)}return jsx(oi,{task:H,x:N,y:ie,width:Y,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:l,onDoubleClick:m,onContextMenu:g,onDateChange:x,onDependencyCreate:b,allTaskPositions:ft,onDragMove:pt,onHoverChange:O,showBaseline:f,showTaskBarLabels:u,showCriticalPath:h,readOnly:k?!k(H):false},H.id)}),w&&Re.map((H,se)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(N=>{let Y=Re.find(He=>He.id===N);if(!Y||!Y.startDate||!Y.endDate)return null;let ie=Re.findIndex(He=>He.id===N),he=Te(Y.id,yt(Y)),_=Te(H.id,yt(H)),ee=he.x+he.width,Ve=ie*a+26,ve=_.x,Ue=se*a+26,Se=`dep-${N}-${H.id}`;return _e.has(Se)?null:jsx(_n,{x1:ee,y1:Ve,x2:ve,y2:Ue,theme:t,lineStyle:i,onDelete:()=>v?.(H.id,N),onHoverChange:He=>{xe.current=He,He&&X({key:Se,fromId:N,toId:H.id,exitX:ee,exitY:Ve,enterX:ve,enterY:Ue});}},Se)})),L.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}`)),w&&F&&jsx(_n,{x1:F.exitX,y1:F.exitY,x2:F.enterX,y2:F.enterY,theme:t,lineStyle:i,onDelete:()=>{let H=F.key;X(null),xe.current=false,M(se=>new Set(se).add(H)),v?.(F.toId,F.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{xe.current=H,H||X(null);}},`${F.key}-hover-overlay`),ot>=0&&ot<=pe&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:ot,y1:0,x2:ot,y2:Qe,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:ot,y1:0,x2:ot,y2:Qe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),$&&jsx(Xp,{tooltipData:$,theme:t,locale:d==="es"?"es":"en"})]})}var dv=['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"'],Zp=({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"})}),cv=()=>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"})}),uv=()=>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"})}),pv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),mv=()=>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 gi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:c}){let[i,u]=useState(false),[l,m]=useState(false),[g,x]=useState([]),[b,v]=useState(""),[f,h]=useState(false),[w,y]=useState(true),[k,C]=useState(""),[D,T]=useState(-1),[L,B]=useState(false),[S,R]=useState(0),$=useRef(null),de=useRef(null),F=useRef(null),X=useRef(null),{enabled:xe=true,placeholder:_e='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:W,suggestions:re=dv,maxHistory:Ce=50,persistHistory:O,mentionableUsers:q=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",pe=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Be=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",ze=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)",it=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",nt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",oe=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)",Re=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",yt=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ft=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",pt=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)",Te=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",Xe=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",ot=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Qe=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)",se=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",N=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Y=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ie=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",he="rgba(46, 148, 255, 0.04)",_=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",ee=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ve=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",ve=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ue=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Se=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",He=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",lt=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",st="rgba(46, 148, 255, 0.06)",dt=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",mt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",It=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",z=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",fe=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",we=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Ke=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",qe=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",ge=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",te=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",V=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",me=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Z=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",A=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)",ae=O?.storageKey||"gantt-ai-history",Ne=O?.maxMessages??5,Pe=q.filter(U=>{if(!k)return true;let ke=k.toLowerCase();return U.name.toLowerCase().includes(ke)||U.email&&U.email.toLowerCase().includes(ke)}).slice(0,5),Ye=useCallback(U=>{if(v(U),q.length===0)return;let ke=$.current;if(!ke)return;let Ot=ke.selectionStart||U.length,P=U.slice(0,Ot),ce=P.lastIndexOf("@");if(ce>=0&&((ce>0?P[ce-1]:" ")===" "||ce===0)){let Je=P.slice(ce+1);if(Je.length<=40){C(Je),T(ce),B(true),R(0);return}}B(false),C(""),T(-1);},[q.length]),Oe=useCallback(U=>{let ke=b.slice(0,D),Ot=b.slice(D+1+k.length),P=`${ke}@${U.name} ${Ot}`;v(P),B(false),C(""),T(-1),setTimeout(()=>$.current?.focus(),0);},[b,D,k]),Dt=useCallback(U=>{if(!L||Pe.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),R(ke=>ke<Pe.length-1?ke+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),R(ke=>ke>0?ke-1:Pe.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let ke=Pe[S];return ke&&Oe(ke),true}return U.key==="Escape"?(B(false),true):false},[L,Pe,S,Oe]);useEffect(()=>{if(O?.enabled)try{let U=localStorage.getItem(ae);if(U){let Ot=JSON.parse(U).map(P=>({...P,timestamp:new Date(P.timestamp)}));x(Ot.slice(-Ne));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[O?.enabled,ae,Ne]),useEffect(()=>{if(O?.enabled&&g.length>0)try{let U=g.filter(ke=>!ke.isLoading).slice(-Ne);localStorage.setItem(ae,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,O?.enabled,ae,Ne]),useEffect(()=>{de.current&&de.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!l&&$.current&&setTimeout(()=>$.current?.focus(),100);},[i,l]);let gt=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&&d?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&c?.(U.taskId,U.dependencyFrom);break}},[o,s,n,d,c]),Ut=useCallback(async U=>{if(!U.trim()||f)return;let ke={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};x(P=>[...P.slice(-(Ce-1)),ke]),v(""),y(false),h(true);let Ot={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(P=>[...P,Ot]);try{if(W){let P=await W(U,e);x(ce=>{let $e=ce.filter(xt=>!xt.isLoading),Je={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...$e,Je]}),gt(P);}else x(P=>[...P.filter($e=>!$e.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(P){x(ce=>[...ce.filter(Je=>!Je.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[f,Ce,W,e,gt]),Ta=U=>{U.preventDefault(),Ut(b);},ya=U=>{v(U),$.current?.focus();};if(useEffect(()=>{let U=ke=>{(ke.metaKey||ke.ctrlKey)&&ke.key==="k"&&(ke.preventDefault(),u(Ot=>!Ot),i||m(false)),ke.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=Ot=>{let P=Ot.target;F.current&&!F.current.contains(P)&&u(false);},ke=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(ke),document.removeEventListener("mousedown",U);}},[i]),!xe)return null;let Le={"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(At,{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 ${Le[M]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:pe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Be}`,color:"#2E94FF",cursor:"pointer",boxShadow:ze,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${it}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${nt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(Zp,{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:Re,background:oe,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:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Le[M]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:yt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ft}`,boxShadow:pt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Te,borderBottom:`1px solid ${Xe}`},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:ot,border:`1px solid ${Qe}`,color:"#2E94FF"},children:jsx(Zp,{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:se},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=N;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=se;},children:jsx(pv,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=N;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=se;},children:jsx(uv,{})})]})]}),jsx(AnimatePresence,{children:!l&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:ie,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:re.slice(0,4).map((U,we)=>jsx("button",{onClick:()=>ya(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:he,color:ee,border:`1px solid ${_}`},onMouseEnter:Ot=>{Ot.currentTarget.style.borderColor=Ve,Ot.currentTarget.style.color="#2E94FF";},onMouseLeave:Ot=>{Ot.currentTarget.style.borderColor=_,Ot.currentTarget.style.color=ee;},children:U.length>30?U.slice(0,30)+"...":U},we))})]}),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"?ve:Se,color:U.role==="user"?"#2E94FF":lt,border:U.role==="user"?`1px solid ${Ue}`:`1px solid ${He}`},children:[U.isLoading?jsx(mv,{}):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:de})]}),jsxs("form",{onSubmit:U=>{if(L&&Pe.length>0){U.preventDefault();return}Ta(U);},className:"p-3 relative",style:{borderTop:`1px solid ${st}`},children:[jsx(AnimatePresence,{children:L&&Pe.length>0&&jsx(motion.div,{ref:X,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:qe,border:`1px solid ${ge}`,boxShadow:te,backdropFilter:"blur(12px)"},children:Pe.map((U,we)=>jsxs("button",{type:"button",onClick:()=>Oe(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:we===S?V:"transparent",color:me},onMouseEnter:()=>R(we),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:A,border:`1px solid ${j}`,color:"#2E94FF"},children:U.name.split(" ").map(Ot=>Ot[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:Z},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:dt,border:`1px solid ${mt}`},children:[jsx("input",{ref:$,type:"text",value:b,onChange:U=>Ye(U.target.value),onKeyDown:U=>{Dt(U);},placeholder:_e,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:It,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!b.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:b.trim()?z:"transparent",color:b.trim()?"#2E94FF":Ce,border:b.trim()?`1px solid ${fe}`:"1px solid transparent"},children:jsx(cv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Ke,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function em(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,u=true)=>{r(l=>{let m=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:m};if(!u)return {...l,present:m};let g=[...l.past,l.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 u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),d=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),c=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,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 d=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=d?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&c&&n.key==="y"){n.preventDefault(),t();return}if(d&&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(`${Me.formatDate(e.startDate)} - ${Me.formatDate(e.endDate)}`);let a=Me.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=>Me.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function am(e){return {...hv,...e}}var Nv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},nm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:c=true,showExportButton:i=true,projectName:u,availableUsers:l=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:x,persistFilter:b,clearFiltersKey:v,aiAssistant:f,locale:h="en",customTranslations:w,showCreateTaskButton:y=false,createTaskLabel:k,onCreateTask:C,taskFilter:D,onTaskFilterChange:T,toolbarRightContent:L,showBaseline:B,viewMode:S,onViewModeChange:R,projectForecast:$,onThemeChange:de,onTaskClick:F,onTaskDblClick:X,onTaskContextMenu:xe,onTaskUpdate:_e,onProgressChange:M,onTaskEdit:W,onTaskAddSubtask:re,onTaskMarkIncomplete:ke,onTaskSetInProgress:O,onDependencyCreate:q,onDependencyDelete:J,onBeforeTaskAdd:pe,onAfterTaskAdd:Be,onBeforeTaskUpdate:ze,onAfterTaskUpdate:it,onBeforeTaskDelete:nt,onAfterTaskDelete:oe,permissions:ct,onCopySnapshotLink:Re}=a,ft=useContext(js)?.theme,[pt,Te]=useState(ft||s||"dark"),[Xe,ot]=useState(n),[Qe,H]=useState(d),[se,N]=useState(1),[Y,ie]=useState("all"),[he,_]=useState(S||"execution"),ee=S??he,Ve=useCallback(E=>{_(E),R?.(E);},[R]),ve=B??ee==="oracle",[Ue,Se]=useState(a.showCriticalPath!==false),[He,lt]=useState(a.showDependencies!==false),[st,dt]=useState(a.highlightWeekends!==false),mt=useCallback(E=>{Se(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),It=useCallback(E=>{lt(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),z=useCallback(E=>{dt(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(Xe);},[Xe]),useEffect(()=>{a.onZoomChange?.(se);},[se]);let fe=useRef(a.onDateRangeChange);fe.current=a.onDateRangeChange;let Ce=useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Ke,qe]=useState(()=>{if(!b)return "all";try{let E=typeof b=="string"?b:"gantt-filter-state",I=localStorage.getItem(E);if(I){let K=JSON.parse(I);if(K.taskFilter)return K.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),ge=D??Ke,te=T??qe,[V,me]=useState(()=>{if(!b)return false;try{let E=typeof b=="string"?b:"gantt-filter-state",I=localStorage.getItem(E);if(I){let K=JSON.parse(I);if(typeof K.hideCompleted=="boolean")return K.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=Ce();if(E)try{let I={taskFilter:ge,hideCompleted:V};localStorage.setItem(E,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving filter state to localStorage:",I);}},[ge,V,Ce]);let Z=useRef(v);useEffect(()=>{if(Z.current!==v&&v!==void 0){qe("all"),me(false);let E=Ce();if(E)try{localStorage.removeItem(E);}catch(I){console.warn("[GanttBoard] Error clearing filter state from localStorage:",I);}}Z.current=v;},[v,Ce]);let[A,j]=useState(0),[ae,Ne]=useState(false),[Pe,Ye]=useState(null),[Oe,Dt]=useState({isOpen:false,x:0,y:0,task:null}),[gt,Ut]=useState(null),[Ta,ya]=useState(null);useEffect(()=>{ft&&ft!==pt&&Te(ft);},[ft]),useEffect(()=>{s&&s!==pt&&Te(s);},[s]);let Le=useCallback(E=>{Te(E),de?.(E);},[de]),{state:U,setState:we,undo:Ot,redo:P,canUndo:ce,canRedo:$e,clearHistory:Je}=em(t,50),xt=useMemo(()=>{let E=(I,K=0)=>{let Q=K;for(let ye of I)ye.subtasks?.length&&(Q=Math.max(Q,E(ye.subtasks,K+1)));return Q};return E(U)+1},[U]),za=useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),ta=useRef(new Map),rr=useRef(false);if(!rr.current&&x){rr.current=true;let E=typeof x=="string"?x:"gantt-expanded-tasks";try{let I=localStorage.getItem(E);if(I){let K=JSON.parse(I);Array.isArray(K)&&(ta.current=new Map(K));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let na=useCallback(()=>{let E=za();if(E)try{let I=Array.from(ta.current.entries());localStorage.setItem(E,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[za]),sa=useRef(0),Wo=useRef(U);useEffect(()=>{Wo.current=U;},[U]);let Go=useRef(false),Cc=useCallback(E=>{ie(E),sa.current+=1,we(I=>{let K=(ye,Fe=0)=>ye.map(Tt=>{let et=E==="all"||Fe<E-1;return Tt.subtasks?.length&&ta.current.set(Tt.id,et),{...Tt,isExpanded:et,subtasks:Tt.subtasks?K(Tt.subtasks,Fe+1):void 0}}),Q=K(I);return na(),Q});},[we,na]);useEffect(()=>{if(sa.current>0){sa.current-=1;return}let E=K=>{let Q=new Map;for(let ye of K){let Fe=ye.id;Q.get(Fe)||Q.set(Fe,ye);}return Array.from(Q.values())},I=K=>K.map(Q=>{let ye=ta.current.get(Q.id),Fe=ye!==void 0?{...Q,isExpanded:ye}:Q;if(Fe.subtasks?.length){let Tt=E(Fe.subtasks);return {...Fe,subtasks:I(Tt)}}return Fe});if(ta.current.size>0)we(fr(I(t)));else {let K=Q=>Q.map(ye=>ye.subtasks?.length?{...ye,subtasks:E(K(ye.subtasks))}:ye);we(fr(K(t)));}},[t,we]);let cs=useRef(t),Tc=useRef(true);useEffect(()=>{if(Tc.current){Tc.current=false,cs.current=U;return}if(Go.current){Go.current=false,cs.current=U;return}if(!r)return;let E=JSON.stringify(cs.current),I=JSON.stringify(U);E!==I&&(cs.current=U,r(U));},[U,r]);let Ua=useMemo(()=>ed(h,w),[h,w]),I0=useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Vo,Gi]=useState(()=>I0(Ua));useEffect(()=>{Gi(E=>E.map(I=>({...I,label:Ua.columns[I.id==="name"?"taskName":I.id]||I.label})));},[Ua]);let us=useMemo(()=>Vo.filter(I=>I.visible).reduce((I,K)=>I+K.width,0),[Vo]),Nc=useRef(Vo.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=Vo.filter(Q=>Q.visible),I=E.map(Q=>Q.id).join(","),K=Nc.current;if(I!==K){let Q=E.some(Fe=>Fe.id!=="name"),ye=K.includes(",");Q?!ye&&Q&&Ye(null):Ye(null),Nc.current=I;}},[Vo]);let Dc=60,Sc=.6,B0=useMemo(()=>{let I=us+Dc,K=typeof window<"u"?window.innerWidth*Sc:800,Q=Math.max(I,K);return Pe!==null?Math.max(200,Math.min(Pe,Q)):Math.max(200,I)},[Pe,us]),Zr=useRef(null),ps=useRef(null),Ar=useRef(null),Cn=useRef(null),qt=useMemo(()=>Cp(pt),[pt]),R0=useMemo(()=>({theme:qt,themeName:pt}),[qt,pt]),Ec=useMemo(()=>am(m),[m]),Vi=useMemo(()=>{if(!g)return U;let E=Me.calculateCriticalPath(U),I=K=>K.map(Q=>({...Q,isCriticalPath:E.includes(Q.id),subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(U)},[U,g]),Fc=useMemo(()=>{if(ge==="all"&&!V)return Vi;let E=I=>{let K=[];for(let Q of I){let ye=Q.subtasks?.length?E(Q.subtasks):void 0,Fe=false;if(V)Fe=Q.progress<100;else switch(ge){case "all":Fe=true;break;case "incomplete":Fe=Q.progress<100;break;case "in_progress":Fe=Q.progress>0&&Q.progress<100;break;case "completed":Fe=Q.progress===100;break}(Fe||ye&&ye.length>0)&&K.push({...Q,subtasks:ye});}return K};return E(Vi)},[Vi,ge,V]),ms=Nv(Qe);tm({undo:Ot,redo:P,canUndo:ce,canRedo:$e,enabled:true}),useImperativeHandle(o,()=>({getTask:E=>Me.findTaskById(U,E),addTask:(E,I)=>{we(K=>{if(!I)return [...K,{...E,level:0}];let Q=ye=>ye.map(Fe=>Fe.id===I?{...Fe,subtasks:[...Fe.subtasks||[],{...E,parentId:I,level:(Fe.level||0)+1}],isExpanded:true}:Fe.subtasks?{...Fe,subtasks:Q(Fe.subtasks)}:Fe);return Q(K)});},updateTask:(E,I)=>{we(K=>{let Q=ye=>ye.map(Fe=>Fe.id===E?{...Fe,...I}:Fe.subtasks?{...Fe,subtasks:Q(Fe.subtasks)}:Fe);return Q(K)});},deleteTask:E=>{we(I=>{let K=Q=>Q.filter(ye=>ye.id===E?false:(ye.subtasks&&(ye.subtasks=K(ye.subtasks)),true));return K(I)});},deleteTasks:E=>{we(I=>id(I,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let I=Me.findTaskById(U,E);I&&a.onTaskDuplicate(I);}else we(I=>Gn(I,[E]).tasks);},splitTask:(E,I,K=3)=>{we(Q=>Me.splitTask(Q,E,I,K));},calculateEndDate:Me.calculateEndDate,calculateDuration:Me.calculateDuration,validateDependency:(E,I)=>!Me.validateDependencies(U,E,I),getAllTasks:()=>Me.flattenTasks(U),getTasksByStatus:E=>Me.flattenTasks(U).filter(I=>I.status===E),getTasksByParent:E=>E?Me.findTaskById(U,E)?.subtasks||[]:U.filter(K=>!K.parentId),getCriticalPath:()=>Me.flattenTasks(U).filter(E=>E.isCriticalPath),indentTask:E=>{we(I=>fr(od(I,[E])));},outdentTask:E=>{we(I=>fr(nd(I,[E])));},moveTask:(E,I)=>{we(K=>sd(K,[E],I));},createSubtask:async E=>{let{tasks:I,newTask:K}=cd(U,E);if(pe){let Q=pe({...K,parentId:E});if((Q instanceof Promise?await Q:Q)===false)return}we(fr(I)),Be&&Be({...K,parentId:E});},scrollToTask:E=>{let K=Me.flattenTasks(U).findIndex(Q=>Q.id===E);if(K!==-1&&Zr.current){let Q=K*ms;Zr.current.scrollTo({top:Q,behavior:"smooth"}),Ar.current&&Ar.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(E,I=2e3)=>{},expandTask:E=>{we(I=>{let K=Q=>Q.map(ye=>ye.id===E?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye);return K(I)});},collapseTask:E=>{we(I=>{let K=Q=>Q.map(ye=>ye.id===E?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye);return K(I)});},expandAll:()=>{we(E=>{let I=K=>K.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(E)});},collapseAll:()=>{we(E=>{let I=K=>K.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(E)});},collapseToLevel:E=>{Cc(E);},undo:Ot,redo:P,canUndo:()=>ce,canRedo:()=>$e,clearHistory:Je,exportToPNG:async()=>{if(!Cn.current||!Zr.current||!Ar.current)throw new Error("Gantt container not found");let E=Cn.current,I=Zr.current,K=ps.current||I.querySelector(".gantt-grid-scroll"),Q=Ar.current,ye=K?.scrollTop||0,Fe=Q.scrollTop,Tt=E.style.overflow,et=E.style.height,Ea=I.style.overflow;try{let Mt=K?.querySelector(".gantt-taskgrid-content"),Fa=Q.querySelector("svg"),or=Mt?.scrollHeight||K?.scrollHeight||600,wo=Fa?.getBoundingClientRect().height||Q.scrollHeight,Nn=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(or,wo)+20;K&&(K.scrollTop=0),Q.scrollTop=0,E.style.overflow="visible",E.style.height=`${Nn}px`,I.style.overflow="visible",await new Promise(Yo=>setTimeout(Yo,100));let eo=await toPng(E,{backgroundColor:qt.bgPrimary,pixelRatio:2,filter:Yo=>{if(!(Yo instanceof Element))return !0;let bs=window.getComputedStyle(Yo),Dn=parseInt(bs.zIndex,10);return (isNaN(Dn)||Dn<50)&&bs.position!=="fixed"}});return await(await fetch(eo)).blob()}finally{E.style.overflow=Tt,E.style.height=et,I.style.overflow=Ea,K&&(K.scrollTop=ye),Q.scrollTop=Fe;}},exportToPDF:async E=>{await Me.exportToPDF(U,E);},exportToExcel:async E=>{await Me.exportToExcel(U,E);},exportToJSON:()=>Me.exportToJSON(U),exportToCSV:()=>Me.exportToCSV(U),importFromJSON:E=>{let I=Me.importFromJSON(E);we(I);},getTasks:()=>U,refresh:()=>{we(E=>[...E]);},clearAll:()=>{we([]);}}),[U,Ot,P,ce,$e,Je,qt,ms]);let O0=useCallback(E=>{Gi(I=>I.map(K=>K.id===E?{...K,visible:!K.visible}:K));},[]),$0=useCallback((E,I)=>{Gi(K=>K.map(Q=>{if(Q.id!==E)return Q;let ye=Q.minWidth??100,Fe=Q.maxWidth??800,Tt=Math.max(ye,Math.min(Fe,I));return {...Q,width:Tt}}));},[]),H0=useCallback(E=>{we(I=>{let K=dd(I,E),Q=ye=>{for(let Fe of ye){if(Fe.id===E){ta.current.set(E,Fe.isExpanded??true);return}Fe.subtasks?.length&&Q(Fe.subtasks);}};return Q(K),na(),K}),a.onTaskToggleExpand?.(E);},[a,na]),_o=useCallback((E,I)=>{if(ze&&ze(E,I)===false)return;let Q=Me.findTaskById(U,E)?.progress,ye=Tt=>Tt.map(et=>et.id===E?{...et,...I}:et.subtasks?{...et,subtasks:ye(et.subtasks)}:et);we(ye(U));let Fe=Me.findTaskById(ye(U),E);Fe&&(_e?.(Fe),it?.(Fe),I.progress!==void 0&&Q!==void 0&&I.progress!==Q&&M?.(E,Q,I.progress));},[U,_e,ze,it,M]),z0=useCallback(E=>{E.length!==0&&(sa.current+=1,Go.current=true,we(I=>fr(od(I,E))),a.onTaskIndent?.(E[0]));},[a]),U0=useCallback(E=>{E.length!==0&&(sa.current+=1,Go.current=true,we(I=>fr(nd(I,E))),a.onTaskOutdent?.(E[0]));},[a]),W0=useCallback((E,I,K)=>{sa.current+=1,Go.current=true,we(Q=>fr(Up(Q,E,I,K))),a.onTaskReparent?.(E,I,K);},[a]),G0=useCallback((E,I)=>{E.length!==0&&(sa.current+=1,Go.current=true,we(K=>sd(K,E,I)),a.onTaskMove?.(E[0],I));},[a]),_i=useCallback(async E=>{let I=[];for(let K of E)nt&&await Promise.resolve(nt(K))===false||I.push(K);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(we(K=>fr(id(K,I))),I.forEach(K=>a.onTaskDelete?.(K))),oe&&I.forEach(K=>oe(K)));},[a,nt,oe]),V0=useCallback(E=>{a.onTaskDuplicate?E.forEach(I=>{let K=Me.findTaskById(U,I);K&&a.onTaskDuplicate(K);}):we(I=>Gn(I,E).tasks);},[a,U]),_0=useCallback((E,I)=>{we(K=>{let{tasks:Q,newTask:ye}=zp(K,E,I);return pe&&pe(ye)===false?K:(a.onTaskCreate?.(ye.parentId,ye.position||0),Be?.(ye),Q)});},[a,pe,Be]),j0=useCallback((E,I)=>{we(K=>ld(K,E,I)),a.onTaskRename?.(E,I);},[a]),ji=useCallback(E=>{let{onTaskAddSubtask:I}=a;if(I){let K=Zs(U,E);if(K){I(K);return}}we(K=>{let{tasks:Q}=cd(K,E);return a.onTaskCreate?.(E,0),Q});},[a,U]),K0=useCallback((E,I,K)=>{let Q=!E.startDate&&!E.endDate,ye=E.startDate?Math.round((I.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,Fe=Ea=>Ea.map(Mt=>Mt.id===E.id?{...Mt,startDate:I,endDate:K,...E.segments&&{segments:E.segments}}:Mt.subtasks?{...Mt,subtasks:Fe(Mt.subtasks)}:Mt),Tt=Fe(U);Tt=Me.autoScheduleDependents(Tt,E.id,ye),Tt=fr(Tt),we(Tt);let et={...E,startDate:I,endDate:K};Q&&a?.onTaskDateChange?a.onTaskDateChange(E,I,K):_e?.(et);},[U,_e,a]),Y0=useCallback((E,I)=>{xe?.(E,I),Dt({isOpen:true,x:I.clientX,y:I.clientY,task:E});},[xe]),q0=useCallback((E,I)=>{let K=Me.splitTask(U,E.id,I);we(K),Dt({isOpen:false,x:0,y:0,task:null});},[U]),Pc=useCallback(E=>{let I=Me.findTaskById(U,E.id)||E;X?.(I),W||Ut(I);},[U,X,W]),Mc=useCallback((E,I,K)=>{let Q=new Map,ye=Mt=>{Mt.forEach(Fa=>{Fa.dependencies&&Q.set(Fa.id,Fa.dependencies),Fa.subtasks&&ye(Fa.subtasks);});};ye(K);let Fe=Q.get(I)||[];Q.set(I,[...Fe,E]);let Tt=new Set,et=new Set,Ea=Mt=>{if(!Tt.has(Mt)){Tt.add(Mt),et.add(Mt);let Fa=Q.get(Mt)||[];for(let or of Fa){if(!Tt.has(or)&&Ea(or))return true;if(et.has(or))return true}}return et.delete(Mt),false};return Ea(I)},[]),Ac=useCallback((E,I)=>{if(Mc(E.id,I,Wo.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:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Le[M]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:yt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ft}`,boxShadow:pt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Te,borderBottom:`1px solid ${Xe}`},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:ot,border:`1px solid ${Qe}`,color:"#2E94FF"},children:jsx(Zp,{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:se},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=N;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=se;},children:jsx(pv,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:se},onMouseEnter:U=>{U.currentTarget.style.background=Y,U.currentTarget.style.color=N;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=se;},children:jsx(uv,{})})]})]}),jsx(AnimatePresence,{children:!l&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:ie,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:re.slice(0,4).map((U,ke)=>jsx("button",{onClick:()=>ya(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:he,color:ee,border:`1px solid ${_}`},onMouseEnter:Ot=>{Ot.currentTarget.style.borderColor=Ve,Ot.currentTarget.style.color="#2E94FF";},onMouseLeave:Ot=>{Ot.currentTarget.style.borderColor=_,Ot.currentTarget.style.color=ee;},children:U.length>30?U.slice(0,30)+"...":U},ke))})]}),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"?ve:Se,color:U.role==="user"?"#2E94FF":lt,border:U.role==="user"?`1px solid ${Ue}`:`1px solid ${He}`},children:[U.isLoading?jsx(mv,{}):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:de})]}),jsxs("form",{onSubmit:U=>{if(L&&Pe.length>0){U.preventDefault();return}Ta(U);},className:"p-3 relative",style:{borderTop:`1px solid ${st}`},children:[jsx(AnimatePresence,{children:L&&Pe.length>0&&jsx(motion.div,{ref:X,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:qe,border:`1px solid ${ge}`,boxShadow:te,backdropFilter:"blur(12px)"},children:Pe.map((U,ke)=>jsxs("button",{type:"button",onClick:()=>Oe(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ke===S?V:"transparent",color:me},onMouseEnter:()=>R(ke),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:A,border:`1px solid ${j}`,color:"#2E94FF"},children:U.name.split(" ").map(Ot=>Ot[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:Z},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:dt,border:`1px solid ${mt}`},children:[jsx("input",{ref:$,type:"text",value:b,onChange:U=>Ye(U.target.value),onKeyDown:U=>{Dt(U);},placeholder:_e,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:It,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!b.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:b.trim()?z:"transparent",color:b.trim()?"#2E94FF":we,border:b.trim()?`1px solid ${fe}`:"1px solid transparent"},children:jsx(cv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Ke,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function em(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,u=true)=>{r(l=>{let m=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:m};if(!u)return {...l,present:m};let g=[...l.past,l.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 u=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:u,future:[i.present,...i.future]}});},[]),d=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:l}});},[]),c=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,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 d=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=d?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&c&&n.key==="y"){n.preventDefault(),t();return}if(d&&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(`${Me.formatDate(e.startDate)} - ${Me.formatDate(e.endDate)}`);let a=Me.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=>Me.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function am(e){return {...hv,...e}}var Nv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},nm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:c=true,showExportButton:i=true,projectName:u,availableUsers:l=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:x,persistFilter:b,clearFiltersKey:v,aiAssistant:f,locale:h="en",customTranslations:w,showCreateTaskButton:y=false,createTaskLabel:k,onCreateTask:C,taskFilter:D,onTaskFilterChange:T,toolbarRightContent:L,showBaseline:B,viewMode:S,onViewModeChange:R,projectForecast:$,onThemeChange:de,onTaskClick:F,onTaskDblClick:X,onTaskContextMenu:xe,onTaskUpdate:_e,onProgressChange:M,onTaskEdit:W,onTaskAddSubtask:re,onTaskMarkIncomplete:Ce,onTaskSetInProgress:O,onDependencyCreate:q,onDependencyDelete:J,onBeforeTaskAdd:pe,onAfterTaskAdd:Be,onBeforeTaskUpdate:ze,onAfterTaskUpdate:it,onBeforeTaskDelete:nt,onAfterTaskDelete:oe,permissions:ct,onCopySnapshotLink:Re}=a,ft=useContext(js)?.theme,[pt,Te]=useState(ft||s||"dark"),[Xe,ot]=useState(n),[Qe,H]=useState(d),[se,N]=useState(1),[Y,ie]=useState("all"),[he,_]=useState(S||"execution"),ee=S??he,Ve=useCallback(E=>{_(E),R?.(E);},[R]),ve=B??ee==="oracle",[Ue,Se]=useState(a.showCriticalPath!==false),[He,lt]=useState(a.showDependencies!==false),[st,dt]=useState(a.highlightWeekends!==false),mt=useCallback(E=>{Se(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),It=useCallback(E=>{lt(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),z=useCallback(E=>{dt(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(Xe);},[Xe]),useEffect(()=>{a.onZoomChange?.(se);},[se]);let fe=useRef(a.onDateRangeChange);fe.current=a.onDateRangeChange;let we=useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Ke,qe]=useState(()=>{if(!b)return "all";try{let E=typeof b=="string"?b:"gantt-filter-state",I=localStorage.getItem(E);if(I){let K=JSON.parse(I);if(K.taskFilter)return K.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),ge=D??Ke,te=T??qe,[V,me]=useState(()=>{if(!b)return false;try{let E=typeof b=="string"?b:"gantt-filter-state",I=localStorage.getItem(E);if(I){let K=JSON.parse(I);if(typeof K.hideCompleted=="boolean")return K.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=we();if(E)try{let I={taskFilter:ge,hideCompleted:V};localStorage.setItem(E,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving filter state to localStorage:",I);}},[ge,V,we]);let Z=useRef(v);useEffect(()=>{if(Z.current!==v&&v!==void 0){qe("all"),me(false);let E=we();if(E)try{localStorage.removeItem(E);}catch(I){console.warn("[GanttBoard] Error clearing filter state from localStorage:",I);}}Z.current=v;},[v,we]);let[A,j]=useState(0),[ae,Ne]=useState(false),[Pe,Ye]=useState(null),[Oe,Dt]=useState({isOpen:false,x:0,y:0,task:null}),[gt,Ut]=useState(null),[Ta,ya]=useState(null);useEffect(()=>{ft&&ft!==pt&&Te(ft);},[ft]),useEffect(()=>{s&&s!==pt&&Te(s);},[s]);let Le=useCallback(E=>{Te(E),de?.(E);},[de]),{state:U,setState:ke,undo:Ot,redo:P,canUndo:ce,canRedo:$e,clearHistory:Je}=em(t,50),xt=useMemo(()=>{let E=(I,K=0)=>{let Q=K;for(let ye of I)ye.subtasks?.length&&(Q=Math.max(Q,E(ye.subtasks,K+1)));return Q};return E(U)+1},[U]),za=useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),ta=useRef(new Map),rr=useRef(false);if(!rr.current&&x){rr.current=true;let E=typeof x=="string"?x:"gantt-expanded-tasks";try{let I=localStorage.getItem(E);if(I){let K=JSON.parse(I);Array.isArray(K)&&(ta.current=new Map(K));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let na=useCallback(()=>{let E=za();if(E)try{let I=Array.from(ta.current.entries());localStorage.setItem(E,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[za]),sa=useRef(0),Wo=useRef(U);useEffect(()=>{Wo.current=U;},[U]);let Go=useRef(false),Cc=useCallback(E=>{ie(E),sa.current+=1,ke(I=>{let K=(ye,Fe=0)=>ye.map(Tt=>{let et=E==="all"||Fe<E-1;return Tt.subtasks?.length&&ta.current.set(Tt.id,et),{...Tt,isExpanded:et,subtasks:Tt.subtasks?K(Tt.subtasks,Fe+1):void 0}}),Q=K(I);return na(),Q});},[ke,na]);useEffect(()=>{if(sa.current>0){sa.current-=1;return}let E=K=>{let Q=new Map;for(let ye of K){let Fe=ye.id;Q.get(Fe)||Q.set(Fe,ye);}return Array.from(Q.values())},I=K=>K.map(Q=>{let ye=ta.current.get(Q.id),Fe=ye!==void 0?{...Q,isExpanded:ye}:Q;if(Fe.subtasks?.length){let Tt=E(Fe.subtasks);return {...Fe,subtasks:I(Tt)}}return Fe});if(ta.current.size>0)ke(fr(I(t)));else {let K=Q=>Q.map(ye=>ye.subtasks?.length?{...ye,subtasks:E(K(ye.subtasks))}:ye);ke(fr(K(t)));}},[t,ke]);let cs=useRef(t),Tc=useRef(true);useEffect(()=>{if(Tc.current){Tc.current=false,cs.current=U;return}if(Go.current){Go.current=false,cs.current=U;return}if(!r)return;let E=JSON.stringify(cs.current),I=JSON.stringify(U);E!==I&&(cs.current=U,r(U));},[U,r]);let Ua=useMemo(()=>ed(h,w),[h,w]),I0=useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Vo,Gi]=useState(()=>I0(Ua));useEffect(()=>{Gi(E=>E.map(I=>({...I,label:Ua.columns[I.id==="name"?"taskName":I.id]||I.label})));},[Ua]);let us=useMemo(()=>Vo.filter(I=>I.visible).reduce((I,K)=>I+K.width,0),[Vo]),Nc=useRef(Vo.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=Vo.filter(Q=>Q.visible),I=E.map(Q=>Q.id).join(","),K=Nc.current;if(I!==K){let Q=E.some(Fe=>Fe.id!=="name"),ye=K.includes(",");Q?!ye&&Q&&Ye(null):Ye(null),Nc.current=I;}},[Vo]);let Dc=60,Sc=.6,B0=useMemo(()=>{let I=us+Dc,K=typeof window<"u"?window.innerWidth*Sc:800,Q=Math.max(I,K);return Pe!==null?Math.max(200,Math.min(Pe,Q)):Math.max(200,I)},[Pe,us]),Zr=useRef(null),ps=useRef(null),Ar=useRef(null),Cn=useRef(null),qt=useMemo(()=>Cp(pt),[pt]),R0=useMemo(()=>({theme:qt,themeName:pt}),[qt,pt]),Ec=useMemo(()=>am(m),[m]),Vi=useMemo(()=>{if(!g)return U;let E=Me.calculateCriticalPath(U),I=K=>K.map(Q=>({...Q,isCriticalPath:E.includes(Q.id),subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(U)},[U,g]),Fc=useMemo(()=>{if(ge==="all"&&!V)return Vi;let E=I=>{let K=[];for(let Q of I){let ye=Q.subtasks?.length?E(Q.subtasks):void 0,Fe=false;if(V)Fe=Q.progress<100;else switch(ge){case "all":Fe=true;break;case "incomplete":Fe=Q.progress<100;break;case "in_progress":Fe=Q.progress>0&&Q.progress<100;break;case "completed":Fe=Q.progress===100;break}(Fe||ye&&ye.length>0)&&K.push({...Q,subtasks:ye});}return K};return E(Vi)},[Vi,ge,V]),ms=Nv(Qe);tm({undo:Ot,redo:P,canUndo:ce,canRedo:$e,enabled:true}),useImperativeHandle(o,()=>({getTask:E=>Me.findTaskById(U,E),addTask:(E,I)=>{ke(K=>{if(!I)return [...K,{...E,level:0}];let Q=ye=>ye.map(Fe=>Fe.id===I?{...Fe,subtasks:[...Fe.subtasks||[],{...E,parentId:I,level:(Fe.level||0)+1}],isExpanded:true}:Fe.subtasks?{...Fe,subtasks:Q(Fe.subtasks)}:Fe);return Q(K)});},updateTask:(E,I)=>{ke(K=>{let Q=ye=>ye.map(Fe=>Fe.id===E?{...Fe,...I}:Fe.subtasks?{...Fe,subtasks:Q(Fe.subtasks)}:Fe);return Q(K)});},deleteTask:E=>{ke(I=>{let K=Q=>Q.filter(ye=>ye.id===E?false:(ye.subtasks&&(ye.subtasks=K(ye.subtasks)),true));return K(I)});},deleteTasks:E=>{ke(I=>id(I,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let I=Me.findTaskById(U,E);I&&a.onTaskDuplicate(I);}else ke(I=>Gn(I,[E]).tasks);},splitTask:(E,I,K=3)=>{ke(Q=>Me.splitTask(Q,E,I,K));},calculateEndDate:Me.calculateEndDate,calculateDuration:Me.calculateDuration,validateDependency:(E,I)=>!Me.validateDependencies(U,E,I),getAllTasks:()=>Me.flattenTasks(U),getTasksByStatus:E=>Me.flattenTasks(U).filter(I=>I.status===E),getTasksByParent:E=>E?Me.findTaskById(U,E)?.subtasks||[]:U.filter(K=>!K.parentId),getCriticalPath:()=>Me.flattenTasks(U).filter(E=>E.isCriticalPath),indentTask:E=>{ke(I=>fr(od(I,[E])));},outdentTask:E=>{ke(I=>fr(nd(I,[E])));},moveTask:(E,I)=>{ke(K=>sd(K,[E],I));},createSubtask:async E=>{let{tasks:I,newTask:K}=cd(U,E);if(pe){let Q=pe({...K,parentId:E});if((Q instanceof Promise?await Q:Q)===false)return}ke(fr(I)),Be&&Be({...K,parentId:E});},scrollToTask:E=>{let K=Me.flattenTasks(U).findIndex(Q=>Q.id===E);if(K!==-1&&Zr.current){let Q=K*ms;Zr.current.scrollTo({top:Q,behavior:"smooth"}),Ar.current&&Ar.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(E,I=2e3)=>{},expandTask:E=>{ke(I=>{let K=Q=>Q.map(ye=>ye.id===E?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye);return K(I)});},collapseTask:E=>{ke(I=>{let K=Q=>Q.map(ye=>ye.id===E?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye);return K(I)});},expandAll:()=>{ke(E=>{let I=K=>K.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(E)});},collapseAll:()=>{ke(E=>{let I=K=>K.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(E)});},collapseToLevel:E=>{Cc(E);},undo:Ot,redo:P,canUndo:()=>ce,canRedo:()=>$e,clearHistory:Je,exportToPNG:async()=>{if(!Cn.current||!Zr.current||!Ar.current)throw new Error("Gantt container not found");let E=Cn.current,I=Zr.current,K=ps.current||I.querySelector(".gantt-grid-scroll"),Q=Ar.current,ye=K?.scrollTop||0,Fe=Q.scrollTop,Tt=E.style.overflow,et=E.style.height,Ea=I.style.overflow;try{let Mt=K?.querySelector(".gantt-taskgrid-content"),Fa=Q.querySelector("svg"),or=Mt?.scrollHeight||K?.scrollHeight||600,wo=Fa?.getBoundingClientRect().height||Q.scrollHeight,Nn=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(or,wo)+20;K&&(K.scrollTop=0),Q.scrollTop=0,E.style.overflow="visible",E.style.height=`${Nn}px`,I.style.overflow="visible",await new Promise(Yo=>setTimeout(Yo,100));let eo=await toPng(E,{backgroundColor:qt.bgPrimary,pixelRatio:2,filter:Yo=>{if(!(Yo instanceof Element))return !0;let bs=window.getComputedStyle(Yo),Dn=parseInt(bs.zIndex,10);return (isNaN(Dn)||Dn<50)&&bs.position!=="fixed"}});return await(await fetch(eo)).blob()}finally{E.style.overflow=Tt,E.style.height=et,I.style.overflow=Ea,K&&(K.scrollTop=ye),Q.scrollTop=Fe;}},exportToPDF:async E=>{await Me.exportToPDF(U,E);},exportToExcel:async E=>{await Me.exportToExcel(U,E);},exportToJSON:()=>Me.exportToJSON(U),exportToCSV:()=>Me.exportToCSV(U),importFromJSON:E=>{let I=Me.importFromJSON(E);ke(I);},getTasks:()=>U,refresh:()=>{ke(E=>[...E]);},clearAll:()=>{ke([]);}}),[U,Ot,P,ce,$e,Je,qt,ms]);let O0=useCallback(E=>{Gi(I=>I.map(K=>K.id===E?{...K,visible:!K.visible}:K));},[]),$0=useCallback((E,I)=>{Gi(K=>K.map(Q=>{if(Q.id!==E)return Q;let ye=Q.minWidth??100,Fe=Q.maxWidth??800,Tt=Math.max(ye,Math.min(Fe,I));return {...Q,width:Tt}}));},[]),H0=useCallback(E=>{ke(I=>{let K=dd(I,E),Q=ye=>{for(let Fe of ye){if(Fe.id===E){ta.current.set(E,Fe.isExpanded??true);return}Fe.subtasks?.length&&Q(Fe.subtasks);}};return Q(K),na(),K}),a.onTaskToggleExpand?.(E);},[a,na]),_o=useCallback((E,I)=>{if(ze&&ze(E,I)===false)return;let Q=Me.findTaskById(U,E)?.progress,ye=Tt=>Tt.map(et=>et.id===E?{...et,...I}:et.subtasks?{...et,subtasks:ye(et.subtasks)}:et);ke(ye(U));let Fe=Me.findTaskById(ye(U),E);Fe&&(_e?.(Fe),it?.(Fe),I.progress!==void 0&&Q!==void 0&&I.progress!==Q&&M?.(E,Q,I.progress));},[U,_e,ze,it,M]),z0=useCallback(E=>{E.length!==0&&(sa.current+=1,Go.current=true,ke(I=>fr(od(I,E))),a.onTaskIndent?.(E[0]));},[a]),U0=useCallback(E=>{E.length!==0&&(sa.current+=1,Go.current=true,ke(I=>fr(nd(I,E))),a.onTaskOutdent?.(E[0]));},[a]),W0=useCallback((E,I,K)=>{sa.current+=1,Go.current=true,ke(Q=>fr(Up(Q,E,I,K))),a.onTaskReparent?.(E,I,K);},[a]),G0=useCallback((E,I)=>{E.length!==0&&(sa.current+=1,Go.current=true,ke(K=>sd(K,E,I)),a.onTaskMove?.(E[0],I));},[a]),_i=useCallback(async E=>{let I=[];for(let K of E)nt&&await Promise.resolve(nt(K))===false||I.push(K);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(ke(K=>fr(id(K,I))),I.forEach(K=>a.onTaskDelete?.(K))),oe&&I.forEach(K=>oe(K)));},[a,nt,oe]),V0=useCallback(E=>{a.onTaskDuplicate?E.forEach(I=>{let K=Me.findTaskById(U,I);K&&a.onTaskDuplicate(K);}):ke(I=>Gn(I,E).tasks);},[a,U]),_0=useCallback((E,I)=>{ke(K=>{let{tasks:Q,newTask:ye}=zp(K,E,I);return pe&&pe(ye)===false?K:(a.onTaskCreate?.(ye.parentId,ye.position||0),Be?.(ye),Q)});},[a,pe,Be]),j0=useCallback((E,I)=>{ke(K=>ld(K,E,I)),a.onTaskRename?.(E,I);},[a]),ji=useCallback(E=>{let{onTaskAddSubtask:I}=a;if(I){let K=Zs(U,E);if(K){I(K);return}}ke(K=>{let{tasks:Q}=cd(K,E);return a.onTaskCreate?.(E,0),Q});},[a,U]),K0=useCallback((E,I,K)=>{let Q=!E.startDate&&!E.endDate,ye=E.startDate?Math.round((I.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,Fe=Ea=>Ea.map(Mt=>Mt.id===E.id?{...Mt,startDate:I,endDate:K,...E.segments&&{segments:E.segments}}:Mt.subtasks?{...Mt,subtasks:Fe(Mt.subtasks)}:Mt),Tt=Fe(U);Tt=Me.autoScheduleDependents(Tt,E.id,ye),Tt=fr(Tt),ke(Tt);let et={...E,startDate:I,endDate:K};Q&&a?.onTaskDateChange?a.onTaskDateChange(E,I,K):_e?.(et);},[U,_e,a]),Y0=useCallback((E,I)=>{xe?.(E,I),Dt({isOpen:true,x:I.clientX,y:I.clientY,task:E});},[xe]),q0=useCallback((E,I)=>{let K=Me.splitTask(U,E.id,I);ke(K),Dt({isOpen:false,x:0,y:0,task:null});},[U]),Pc=useCallback(E=>{let I=Me.findTaskById(U,E.id)||E;X?.(I),W||Ut(I);},[U,X,W]),Mc=useCallback((E,I,K)=>{let Q=new Map,ye=Mt=>{Mt.forEach(Fa=>{Fa.dependencies&&Q.set(Fa.id,Fa.dependencies),Fa.subtasks&&ye(Fa.subtasks);});};ye(K);let Fe=Q.get(I)||[];Q.set(I,[...Fe,E]);let Tt=new Set,et=new Set,Ea=Mt=>{if(!Tt.has(Mt)){Tt.add(Mt),et.add(Mt);let Fa=Q.get(Mt)||[];for(let or of Fa){if(!Tt.has(or)&&Ea(or))return true;if(et.has(or))return true}}return et.delete(Mt),false};return Ea(I)},[]),Ac=useCallback((E,I)=>{if(Mc(E.id,I,Wo.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 K=Q=>Q.map(ye=>{if(ye.id===I){let Fe=ye.dependencies||[];if(!Fe.includes(E.id))return {...ye,dependencies:[...Fe,E.id]}}return ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye});sa.current+=1,we(Q=>K(Q)),q?.(E.id,I);},[q,Mc]),Lc=useCallback((E,I)=>{let K=Q=>Q.map(ye=>{if(ye.id===E&&ye.dependencies){let Fe=ye.dependencies.filter(Tt=>Tt!==I);return {...ye,dependencies:Fe}}return ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye});sa.current+=1,we(Q=>K(Q)),J?.(E,I);},[J]),{startDate:jo,endDate:Ki}=useMemo(()=>{let E=U.filter(Fe=>Fe.startDate&&Fe.endDate);if(E.length===0){let Fe=new Date,Tt=new Date(Fe);Tt.setDate(Tt.getDate()-30);let et=new Date(Fe);return et.setDate(et.getDate()+60),{startDate:Tt,endDate:et}}let I=E.flatMap(Fe=>[Fe.startDate,Fe.endDate]).filter(Fe=>Fe!==void 0),K=new Date(Math.min(...I.map(Fe=>Fe.getTime()))),Q=new Date(Math.max(...I.map(Fe=>Fe.getTime()))),ye=Xe==="day"?7:Xe==="week"?14:30;return K.setDate(K.getDate()-ye),Q.setDate(Q.getDate()+ye),{startDate:K,endDate:Q}},[U,Xe]);useEffect(()=>{fe.current?.(jo,Ki);},[jo,Ki]);let X0=useCallback(async()=>{if(!Cn.current||!Zr.current||!Ar.current)return;await new Promise(Nn=>setTimeout(Nn,200));let E=Cn.current,I=Zr.current,K=ps.current||I.querySelector(".gantt-grid-scroll"),Q=Ar.current,ye=K?.scrollTop||0,Fe=K?.scrollLeft||0,Tt=Q.scrollTop,et=Q.scrollLeft,Ea=E.style.overflow,Mt=E.style.height,Fa=K?.style.overflow||"",or=Q.style.overflow,wo=I.style.overflow,gs=E.style.width,fs=Q.style.width;try{let Nn=K?.querySelector(".gantt-taskgrid-content"),eo=Q.querySelector("svg"),qi=eo?.getAttribute("height")?parseInt(eo.getAttribute("height"),10):eo?.getBoundingClientRect().height||0,Yo=Nn?.scrollHeight||K?.scrollHeight||600,bs=Math.max(qi,Q.scrollHeight),Dn=eo?.getAttribute("width")?parseInt(eo.getAttribute("width"),10):eo?.getBoundingClientRect().width||Q.scrollWidth,of=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Xi=Math.max(Yo,bs,qi),Rc=of+Xi+50,Oc=(K?.offsetWidth||I.offsetWidth||300)+Dn+10;K&&(K.scrollTop=0,K.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Rc}px`,E.style.width=`${Oc}px`,I.style.overflow="visible",K&&(K.style.overflow="visible",K.style.height=`${Xi+50}px`),Q.style.overflow="visible",Q.style.height=`${Xi+50}px`,Q.style.width=`${Dn+10}px`,await new Promise(hs=>setTimeout(hs,150));let nf=await toPng(E,{backgroundColor:qt.bgPrimary,pixelRatio:2,width:Oc,height:Rc,skipFonts:!1,filter:hs=>{if(!(hs instanceof Element))return !0;let $c=window.getComputedStyle(hs),Hc=parseInt($c.zIndex,10);return !(!isNaN(Hc)&&Hc>=50||$c.position==="fixed")}}),Ji=document.createElement("a");Ji.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Ji.href=nf,Ji.click();}finally{E.style.overflow=Ea,E.style.height=Mt,E.style.width=gs,I.style.overflow=wo,K&&(K.style.overflow=Fa,K.style.height="",K.scrollTop=ye,K.scrollLeft=Fe),Q.style.overflow=or,Q.style.height="",Q.style.width=fs,Q.scrollTop=Tt,Q.scrollLeft=et;}},[qt]),J0=useCallback(async()=>{await Me.exportToPDF(U);},[U]),Q0=useCallback(async()=>{let E=new Date,I=ye=>String(ye).padStart(2,"0"),K=`${E.getFullYear()}-${I(E.getMonth()+1)}-${I(E.getDate())}_${I(E.getHours())}${I(E.getMinutes())}`,Q=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Me.exportToExcel(U,`${Q}_${K}.xlsx`);},[U,u]),Z0=useCallback(()=>{let E=Me.exportToCSV(U),I=new Blob([E],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(I),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[U]),ef=useCallback(()=>{let E=Me.exportToJSON(U),I=new Blob([E],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(I),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[U]),tf=useCallback(()=>{Me.exportToMSProject(U,"Gantt Project","project.xml");},[U]),af=E=>{E.preventDefault(),Ne(true);},Ko=useRef(false),[Yi,Ic]=useState(false),Tn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=Ar.current,I=Zr.current?.querySelector(".gantt-grid-scroll");if(!E||!I)return;let K=()=>{if(Ko.current)return;Ko.current=true;let et=E.scrollTop;j(et),I.scrollTop=et,requestAnimationFrame(()=>{Ko.current=false;});},Q=()=>{if(Ko.current)return;Ko.current=true;let et=I.scrollTop;j(et),E.scrollTop=et,requestAnimationFrame(()=>{Ko.current=false;});},ye=et=>{if(ae&&I){let Mt=I.parentElement?.getBoundingClientRect()?.left||0,Fa=et.clientX-Mt,or=200,wo=us+Dc,gs=window.innerWidth*Sc,fs=Math.max(wo,gs);Fa>=or&&Fa<=fs&&Ye(Fa);}if(Yi&&E){let Ea=et.clientX-Tn.current.x,Mt=et.clientY-Tn.current.y;E.scrollLeft=Tn.current.scrollLeft-Ea,E.scrollTop=Tn.current.scrollTop-Mt;}},Fe=()=>{Ne(false),Ic(false);},Tt=et=>{if(et.button!==0)return;let Ea=et.target;Ea.closest("[data-task-bar]")||Ea.closest("[data-dependency-line]")||Ea.closest("button")||Ea.closest('[role="button"]')||Ea.tagName==="rect"&&Ea.getAttribute("data-clickable")==="true"||(Ic(true),Tn.current={x:et.clientX,y:et.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},et.preventDefault());};return E.addEventListener("scroll",K),I.addEventListener("scroll",Q),E.addEventListener("mousedown",Tt),document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Fe),()=>{E.removeEventListener("scroll",K),I.removeEventListener("scroll",Q),E.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Fe);}},[ae,Yi,us]);let Bc=useRef(false),rf=useRef(null);return useLayoutEffect(()=>{if(Bc.current||U.length===0||!Ar.current)return;Bc.current=true,rf.current=jo;let E=Ar.current,I=new Date,K=Xe==="day"?60:Xe==="week"?20:8,Q=(I.getTime()-jo.getTime())/(1e3*60*60*24),ye=E.clientWidth,Tt=Q*K*se-ye/2;Q>=0&&ye>0&&(E.scrollLeft=Math.max(0,Tt));},[U.length,jo,Xe,se]),jsx(ln.Provider,{value:Ua,children:jsx(al.Provider,{value:R0,children:jsxs("div",{ref:Cn,className:"flex flex-col h-full w-full",style:{backgroundColor:qt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...qt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${qt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Js,{theme:qt,timeScale:Xe,onTimeScaleChange:ot,zoom:se,onZoomChange:N,currentTheme:pt,onThemeChange:Le,rowDensity:Qe,onRowDensityChange:H,showThemeSelector:c,showCreateTaskButton:y&&ct?.canCreateTask!==false&&!ct?.canCreateSubtaskOnly,createTaskLabel:k,onCreateTask:C,taskFilter:ge,onTaskFilterChange:te,hideCompleted:V,onHideCompletedChange:me,toolbarRightContent:L,wbsLevel:Y,onWbsLevelChange:Cc,maxWbsDepth:xt,viewMode:ee,onViewModeChange:Ve,projectForecast:$,onExportPNG:i?X0:void 0,onExportPDF:i?J0:void 0,onExportExcel:i?Q0:void 0,onExportCSV:i?Z0:void 0,onExportJSON:i?ef:void 0,onExportMSProject:i?tf:void 0,showCriticalPath:Ue,onShowCriticalPathChange:mt,showDependencies:He,onShowDependenciesChange:It,highlightWeekends:st,onHighlightWeekendsChange:z,showBaseline:ve,onShowBaselineChange:E=>{E&&ee!=="oracle"&&Ve("oracle"),!E&&ee==="oracle"&&Ve("execution");},onCopySnapshotLink:Re})}),jsxs("div",{ref:Zr,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:ps,className:"gantt-grid-scroll flex-shrink-0",style:{width:B0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(ti,{tasks:Fc,theme:qt,rowHeight:ms,availableUsers:l,templates:Ec,onTaskClick:F,onTaskDblClick:Pc,onTaskContextMenu:xe,onTaskToggle:H0,scrollTop:A,columns:Vo,onToggleColumn:O0,onColumnResize:$0,onTaskUpdate:_o,onTaskIndent:z0,onTaskOutdent:U0,onTaskMove:G0,onMultiTaskDelete:_i,onTaskDuplicate:V0,onTaskCreate:_0,onTaskRename:j0,onCreateSubtask:ji,onOpenTaskModal:F?E=>F(E):void 0,onDeleteRequest:(E,I)=>ya({taskId:E,taskName:I}),onTaskReparent:W0,scrollContainerRef:ps})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:qt.border,zIndex:15},onMouseDown:af}),jsx("div",{ref:Ar,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Yi?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(ui,{tasks:Fc,theme:qt,rowHeight:ms,timeScale:Xe,startDate:jo,endDate:Ki,zoom:se,locale:h,templates:Ec,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Pc,onTaskContextMenu:Y0,onTaskDateChange:K0,onDependencyCreate:Ac,onDependencyDelete:Lc,showBaseline:ve,showCriticalPath:Ue,showDependencies:He,highlightWeekends:st,canEditTask:ct?.canEditTask})})]}),Oe.task&&jsx(un,{isOpen:Oe.isOpen,x:Oe.x,y:Oe.y,theme:qt,onClose:()=>Dt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Oe.task;if(!E)return [];let I=Me.findTaskById(U,E.id)||E,K=I.subtasks&&I.subtasks.length>0,Q=ct?.canCreateTask!==false,ye=ct?.canDeleteTask!==false;if(K){let Mt=[],Fa=ct?.canDuplicateTask!==false;return Q&&Mt.push({id:"addSubtask",label:Ua.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{re?re(I):ji(I.id);}}),Fa&&Mt.push({id:"duplicate",label:Ua.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(I):we(or=>Gn(or,[I.id]).tasks),Dt({isOpen:false,x:0,y:0,task:null});}}),ye&&(Mt.length>0&&Mt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Mt.push({id:"delete",label:Ua.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{ya({taskId:I.id,taskName:I.name});}})),Mt}let Fe=ct?.canUpdateTask!==false,Tt=ct?.canDuplicateTask!==false,et=[];return Fe&&et.push({id:"edit",label:Ua.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{W?W(I):Ut(I);}}),Q&&et.push({id:"addSubtask",label:Ua.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{re?re(I):ji(I.id);}}),et.length>0&&Fe&&et.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Fe&&(et.push({id:"markIncomplete",label:Ua.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{ke?ke(I):_o(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"}),et.push({id:"setInProgress",label:Ua.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{O?O(I):_o(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"}),et.push({id:"markComplete",label:Ua.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{_o(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"})),(Tt||Fe&&I.startDate&&I.endDate)&&et.length>0&&et.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Tt&&et.push({id:"duplicate",label:Ua.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(I):we(Mt=>Gn(Mt,[I.id]).tasks),Dt({isOpen:false,x:0,y:0,task:null});}}),Fe&&I.startDate&&I.endDate&&et.push({id:"split",label:Ua.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{let Mt=I.startDate.getTime(),Fa=I.endDate.getTime(),or=Mt+(Fa-Mt)/2,wo=new Date(or);q0(I,wo);}}),ye&&(et.length>0&&et.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),et.push({id:"delete",label:Ua.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{ya({taskId:I.id,taskName:I.name});}})),et})()}),jsx(jr,{task:gt,isOpen:!!gt,onClose:()=>Ut(null),onTaskUpdate:E=>{gt&&(_o(gt.id,E),Ut(null));},theme:pt==="light"?"light":"dark",locale:h==="es"?"es":"en",availableUsers:l,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:()=>ya(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:qt.bgSecondary,border:`1px solid ${qt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${qt.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:qt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ua.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:qt.textSecondary,fontFamily:"Inter, sans-serif"},children:h==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:qt.textSecondary,fontFamily:"Inter, sans-serif"},children:[h==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:qt.textPrimary},children:['"',Ta.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:qt.bgPrimary,borderTop:`1px solid ${qt.border}`},children:[jsx("button",{onClick:()=>ya(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:qt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=qt.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:h==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{_i([Ta.taskId]),ya(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),h==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(gi,{tasks:U,theme:qt,config:f,onTasksUpdate:we,onTaskUpdate:_o,onTaskCreate:E=>{we(I=>[...I,E]);},onTaskDelete:E=>{_i([E]);},onDependencyCreate:(E,I)=>{let K=Me.findTaskById(U,E);K&&Ac(K,I);},onDependencyDelete:Lc})]})})})});function Rv(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 Ov(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),c=parseInt(a[2],10);return d*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 md=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],gd=[{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 dm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:l,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:x,defaultStatus:b}){let v=[...md,...i.filter(N=>!md.some(Y=>Y.id===N.id))],f=tt[c]||tt.dark,[h,w]=useState(false),[y,k]=useState(false),[C,D]=useState(false),[T,L]=useState(false),[B,S]=useState({top:0,left:0}),[R,$]=useState(null),[de,F]=useState(new Date),[X$1,xe]=useState({top:0,left:0}),[_e,M]=useState(false),[W,re]=useState([]),[ke,O]=useState(false),[q,J]=useState(""),pe=useRef(null),Be=useRef(null),ze=useRef(null),it=useRef(null),nt=useRef(null),[oe,ct]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[Re,yt]=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||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&M(true)):(ct({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),M(false),re([]));},[a,e,b]),useEffect(()=>{let N=Y=>{pe.current&&!pe.current.contains(Y.target)&&w(false),Be.current&&!Be.current.contains(Y.target)&&k(false),ze.current&&!ze.current.contains(Y.target)&&D(false),it.current&&!it.current.contains(Y.target)&&L(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);let ft=()=>{let N={};return oe.name.trim()||(N.name="El nombre es requerido"),oe.startDate&&oe.endDate&&oe.startDate>oe.endDate&&(N.endDate="La fecha de fin debe ser posterior a la de inicio"),yt(N),Object.keys(N).length===0},pt=async N=>{if(N.preventDefault(),!!ft())try{let Y=d==="create"&&W.length>0?{...oe,pendingFiles:W}:oe;await s(Y),re([]),t();}catch(Y){console.error("Error submitting task:",Y);}},Te=(N,Y)=>{ct(ie=>{let he={...ie,[N]:Y};if(N==="status"){let _=Y;_==="todo"?he.progress=0:_==="in-progress"?(ie.progress===0||ie.progress===100)&&(he.progress=50):_==="completed"||_==="closed"?he.progress=100:(_==="in-review"||_==="review")&&(he.progress=75);}if(N==="progress"){let _=typeof Y=="number"?Y:parseInt(Y,10);_===100&&ie.status!=="completed"?he.status="completed":_>0&&_<100&&ie.status==="todo"?he.status="in-progress":_===0&&ie.status!=="todo"&&(he.status="todo");}return he}),Re[N]&&yt(ie=>{let he={...ie};return delete he[N],he});},Xe=v.find(N=>N.id===oe.status)??md[0],ot=gd.find(N=>N.id===oe.priority)??gd[1],Qe=So.find(N=>N.value===oe.color)??So[0],H=c==="dark",se={backgroundColor:H?"rgba(255, 255, 255, 0.04)":f.bgSecondary,border:`1px solid ${H?"rgba(255, 255, 255, 0.08)":f.borderLight}`,color:f.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:H?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:H?"rgba(10, 10, 10, 0.97)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Xe.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=f.hoverBg,N.currentTarget.style.color=f.textPrimary;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:pt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:oe.name,onChange:N=>Te("name",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:oe.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Re.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Re.name]})]}),jsx("div",{children:jsx("textarea",{value:oe.description||"",onChange:N=>Te("description",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:pe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...se,borderColor:Xe.color,backgroundColor:`${Xe.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Xe.color}}),jsx("span",{style:{color:Xe.color},children:Xe.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Xe.color}})]}),jsx(AnimatePresence,{children:h&&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?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(N=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("status",N.id),w(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:N.color}}),N.title,oe.status===N.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ot.color}}),jsx("span",{children:ot.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:gd.map(N=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("priority",N.id),k(false);},children:[jsx("span",{children:N.icon}),N.label,oe.priority===N.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),o.length>0&&jsxs("div",{ref:ze,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&D(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[oe.assignees&&oe.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:oe.assignees.slice(0,3).map((N,Y)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:N.color||f.accent,borderColor:f.bgSecondary},children:N.initials},Y))}),oe.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",oe.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":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(N=>{let Y=oe.assignees?.some(ie=>ie.name===N.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=Y?(oe.assignees||[]).filter(he=>he.name!==N.name):[...oe.assignees||[],{name:N.name,avatar:N.avatar,initials:N.name.split(" ").map(he=>he[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Te("assignees",ie);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:N.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:N.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:Y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},N.id)})})})]}),jsxs("div",{ref:it,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)L(false);else {if(it.current){let N=it.current.getBoundingClientRect(),Y=window.innerHeight,ie=120,_=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;S({top:_,left:N.left});}L(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:oe.color}}),jsx("span",{children:Qe.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(At,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>L(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:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:N=>N.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:So.slice(0,18).map(N=>{let Y=oe.color===N.value;return jsx("button",{type:"button",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),Te("color",N.value),L(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:N.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:N.value,outline:Y?`2px solid ${N.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},N.value)})})})})]})})]}),u.length>0||l?jsx(oo,{selectedTags:oe.tags||[],availableTags:u,onChange:N=>Te("tags",N),onCreateTag:l,theme:f,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{ref:nt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!oe.isMilestone)if(R==="start")$(null);else {if(nt.current){let N=nt.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,_=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;xe({top:_,left:N.left});}$("start"),F(oe.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:oe.isMilestone?.5:1,cursor:oe.isMilestone?"not-allowed":"pointer"},disabled:n||oe.isMilestone,children:oe.startDate?oe.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!oe.isMilestone)if(R==="end")$(null);else {if(nt.current){let N=nt.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,_=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;xe({top:_,left:N.left});}$("end"),F(oe.endDate||oe.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:oe.isMilestone?.5:1,cursor:oe.isMilestone?"not-allowed":"pointer"},disabled:n||oe.isMilestone,children:oe.endDate?oe.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:R&&jsxs(At,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(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:`${X$1.top}px`,left:`${X$1.left}px`,zIndex:99999,backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`},children:[(()=>{let N=new Date,Y=new Date(N);Y.setDate(N.getDate()+1);let ie=new Date(N);ie.setDate(N.getDate()+7);let he=new Date(N);return he.setDate(N.getDate()+14),[{label:"Hoy",date:N},{label:"Ma\xF1ana",date:Y},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:he}].map((ee,Ve)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:ve=>ve.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ve=>ve.currentTarget.style.backgroundColor="transparent",onClick:()=>{R==="start"?(Te("startDate",ee.date),(!oe.endDate||ee.date>oe.endDate)&&Te("endDate",ee.date),$("end")):(Te("endDate",ee.date),(!oe.startDate||ee.date<oe.startDate)&&Te("startDate",ee.date),$(null));},children:ee.label},Ve))})(),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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("startDate",void 0),Te("endDate",void 0),$(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(de.getFullYear(),de.getMonth()-1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.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:de.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>F(new Date(de.getFullYear(),de.getMonth()+1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.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((N,Y)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:N},Y))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let N=de.getFullYear(),Y=de.getMonth(),ie=new Date(N,Y,1).getDay(),he=new Date(N,Y+1,0).getDate(),_=new Date,ee=[];for(let ve=ie-1;ve>=0;ve--)ee.push({day:new Date(N,Y,-ve).getDate(),date:new Date(N,Y-1,new Date(N,Y,-ve).getDate()),isCurrentMonth:false});for(let ve=1;ve<=he;ve++)ee.push({day:ve,date:new Date(N,Y,ve),isCurrentMonth:true});let Ve=42-ee.length;for(let ve=1;ve<=Ve;ve++)ee.push({day:ve,date:new Date(N,Y+1,ve),isCurrentMonth:false});return ee.map((ve,Ue)=>{let Se=ve.date.toDateString()===_.toDateString(),He=oe.startDate?.toDateString()===ve.date.toDateString(),lt=oe.endDate?.toDateString()===ve.date.toDateString(),st=oe.startDate&&oe.endDate&&ve.date>=oe.startDate&&ve.date<=oe.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ve.isCurrentMonth?He||lt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:He?f.accent:lt?"#7C3AED":st?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Se&&!He&&!lt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{R==="start"?(Te("startDate",ve.date),oe.endDate&&ve.date>oe.endDate&&Te("endDate",ve.date),$("end")):(Te("endDate",ve.date),oe.startDate&&ve.date<oe.startDate&&Te("startDate",ve.date),$(null));},children:ve.day},Ue)})})()})]})]})]})})]}),Re.endDate&&jsx("span",{className:"text-xs text-red-400",children:Re.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:oe.progress,onChange:N=>Te("progress",parseInt(N.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:oe.progress<30?"#EF4444":oe.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${oe.progress<30?"#EF4444":oe.progress<70?"#F59E0B":"#10B981"}20`,color:oe.progress<30?"#EF4444":oe.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[oe.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>M(!_e),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${_e?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:_e&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:oe.effortMinutes?Rv(oe.effortMinutes):"",onChange:N=>{let Y=Ov(N.target.value);Te("effortMinutes",Y);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||d==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",d==="create"?W.length>0&&`(${W.length})`:m.length>0&&`(${m.length})`]})]}),d==="create"?jsx(Or,{cardId:"pending",attachments:W.map((N,Y)=>({id:`pending-${Y}`,cardId:"pending",name:N.name,size:N.size,type:N.type,url:URL.createObjectURL(N),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:N=>re(Y=>[...Y,...N]),onDelete:N=>{let Y=parseInt(N.replace("pending-",""),10);re(ie=>ie.filter((he,_)=>_!==Y));},maxSizeMB:10,maxFiles:20}):jsx(Or,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?N=>g(a.id,N):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),d==="create"&&W.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[W.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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:oe.isMilestone,onChange:N=>Te("isMilestone",N.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"]}),oe.dependencies&&oe.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:oe.dependencies.map(N=>{let Y=r.find(ie=>ie.id===N);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[Y?.name||N.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ie=(oe.dependencies||[]).filter(he=>he!==N);Te("dependencies",ie);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},N)})}),jsxs("button",{type:"button",onClick:()=>{O(!ke),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:ke&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(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?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":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:q,onChange:N=>J(N.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(N=>N.id!==a?.id).filter(N=>q===""||N.name.toLowerCase().includes(q.toLowerCase())).map(N=>{let Y=oe.dependencies?.includes(N.id);return jsxs("button",{type:"button",onClick:()=>{let ie=oe.dependencies||[],he;Y?he=ie.filter(_=>_!==N.id):he=[...ie,N.id],Te("dependencies",he);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Y?`${f.accent}10`:"transparent"},onMouseEnter:ie=>{Y||(ie.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor=Y?`${f.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:Y?f.accent:"transparent",borderColor:Y?f.accent:f.borderLight},children:Y&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:N.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:N.id.slice(0,8)})]})]},N.id)}),r.filter(N=>N.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:N=>!n&&(N.currentTarget.style.opacity="0.9"),onMouseLeave:N=>!n&&(N.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var cm=`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 K=Q=>Q.map(ye=>{if(ye.id===I){let Fe=ye.dependencies||[];if(!Fe.includes(E.id))return {...ye,dependencies:[...Fe,E.id]}}return ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye});sa.current+=1,ke(Q=>K(Q)),q?.(E.id,I);},[q,Mc]),Lc=useCallback((E,I)=>{let K=Q=>Q.map(ye=>{if(ye.id===E&&ye.dependencies){let Fe=ye.dependencies.filter(Tt=>Tt!==I);return {...ye,dependencies:Fe}}return ye.subtasks?{...ye,subtasks:K(ye.subtasks)}:ye});sa.current+=1,ke(Q=>K(Q)),J?.(E,I);},[J]),{startDate:jo,endDate:Ki}=useMemo(()=>{let E=U.filter(Fe=>Fe.startDate&&Fe.endDate);if(E.length===0){let Fe=new Date,Tt=new Date(Fe);Tt.setDate(Tt.getDate()-30);let et=new Date(Fe);return et.setDate(et.getDate()+60),{startDate:Tt,endDate:et}}let I=E.flatMap(Fe=>[Fe.startDate,Fe.endDate]).filter(Fe=>Fe!==void 0),K=new Date(Math.min(...I.map(Fe=>Fe.getTime()))),Q=new Date(Math.max(...I.map(Fe=>Fe.getTime()))),ye=Xe==="day"?7:Xe==="week"?14:30;return K.setDate(K.getDate()-ye),Q.setDate(Q.getDate()+ye),{startDate:K,endDate:Q}},[U,Xe]);useEffect(()=>{fe.current?.(jo,Ki);},[jo,Ki]);let X0=useCallback(async()=>{if(!Cn.current||!Zr.current||!Ar.current)return;await new Promise(Nn=>setTimeout(Nn,200));let E=Cn.current,I=Zr.current,K=ps.current||I.querySelector(".gantt-grid-scroll"),Q=Ar.current,ye=K?.scrollTop||0,Fe=K?.scrollLeft||0,Tt=Q.scrollTop,et=Q.scrollLeft,Ea=E.style.overflow,Mt=E.style.height,Fa=K?.style.overflow||"",or=Q.style.overflow,wo=I.style.overflow,gs=E.style.width,fs=Q.style.width;try{let Nn=K?.querySelector(".gantt-taskgrid-content"),eo=Q.querySelector("svg"),qi=eo?.getAttribute("height")?parseInt(eo.getAttribute("height"),10):eo?.getBoundingClientRect().height||0,Yo=Nn?.scrollHeight||K?.scrollHeight||600,bs=Math.max(qi,Q.scrollHeight),Dn=eo?.getAttribute("width")?parseInt(eo.getAttribute("width"),10):eo?.getBoundingClientRect().width||Q.scrollWidth,of=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Xi=Math.max(Yo,bs,qi),Rc=of+Xi+50,Oc=(K?.offsetWidth||I.offsetWidth||300)+Dn+10;K&&(K.scrollTop=0,K.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Rc}px`,E.style.width=`${Oc}px`,I.style.overflow="visible",K&&(K.style.overflow="visible",K.style.height=`${Xi+50}px`),Q.style.overflow="visible",Q.style.height=`${Xi+50}px`,Q.style.width=`${Dn+10}px`,await new Promise(hs=>setTimeout(hs,150));let nf=await toPng(E,{backgroundColor:qt.bgPrimary,pixelRatio:2,width:Oc,height:Rc,skipFonts:!1,filter:hs=>{if(!(hs instanceof Element))return !0;let $c=window.getComputedStyle(hs),Hc=parseInt($c.zIndex,10);return !(!isNaN(Hc)&&Hc>=50||$c.position==="fixed")}}),Ji=document.createElement("a");Ji.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Ji.href=nf,Ji.click();}finally{E.style.overflow=Ea,E.style.height=Mt,E.style.width=gs,I.style.overflow=wo,K&&(K.style.overflow=Fa,K.style.height="",K.scrollTop=ye,K.scrollLeft=Fe),Q.style.overflow=or,Q.style.height="",Q.style.width=fs,Q.scrollTop=Tt,Q.scrollLeft=et;}},[qt]),J0=useCallback(async()=>{await Me.exportToPDF(U);},[U]),Q0=useCallback(async()=>{let E=new Date,I=ye=>String(ye).padStart(2,"0"),K=`${E.getFullYear()}-${I(E.getMonth()+1)}-${I(E.getDate())}_${I(E.getHours())}${I(E.getMinutes())}`,Q=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Me.exportToExcel(U,`${Q}_${K}.xlsx`);},[U,u]),Z0=useCallback(()=>{let E=Me.exportToCSV(U),I=new Blob([E],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(I),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[U]),ef=useCallback(()=>{let E=Me.exportToJSON(U),I=new Blob([E],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(I),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[U]),tf=useCallback(()=>{Me.exportToMSProject(U,"Gantt Project","project.xml");},[U]),af=E=>{E.preventDefault(),Ne(true);},Ko=useRef(false),[Yi,Ic]=useState(false),Tn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=Ar.current,I=Zr.current?.querySelector(".gantt-grid-scroll");if(!E||!I)return;let K=()=>{if(Ko.current)return;Ko.current=true;let et=E.scrollTop;j(et),I.scrollTop=et,requestAnimationFrame(()=>{Ko.current=false;});},Q=()=>{if(Ko.current)return;Ko.current=true;let et=I.scrollTop;j(et),E.scrollTop=et,requestAnimationFrame(()=>{Ko.current=false;});},ye=et=>{if(ae&&I){let Mt=I.parentElement?.getBoundingClientRect()?.left||0,Fa=et.clientX-Mt,or=200,wo=us+Dc,gs=window.innerWidth*Sc,fs=Math.max(wo,gs);Fa>=or&&Fa<=fs&&Ye(Fa);}if(Yi&&E){let Ea=et.clientX-Tn.current.x,Mt=et.clientY-Tn.current.y;E.scrollLeft=Tn.current.scrollLeft-Ea,E.scrollTop=Tn.current.scrollTop-Mt;}},Fe=()=>{Ne(false),Ic(false);},Tt=et=>{if(et.button!==0)return;let Ea=et.target;Ea.closest("[data-task-bar]")||Ea.closest("[data-dependency-line]")||Ea.closest("button")||Ea.closest('[role="button"]')||Ea.tagName==="rect"&&Ea.getAttribute("data-clickable")==="true"||(Ic(true),Tn.current={x:et.clientX,y:et.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},et.preventDefault());};return E.addEventListener("scroll",K),I.addEventListener("scroll",Q),E.addEventListener("mousedown",Tt),document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Fe),()=>{E.removeEventListener("scroll",K),I.removeEventListener("scroll",Q),E.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Fe);}},[ae,Yi,us]);let Bc=useRef(false),rf=useRef(null);return useLayoutEffect(()=>{if(Bc.current||U.length===0||!Ar.current)return;Bc.current=true,rf.current=jo;let E=Ar.current,I=new Date,K=Xe==="day"?60:Xe==="week"?20:8,Q=(I.getTime()-jo.getTime())/(1e3*60*60*24),ye=E.clientWidth,Tt=Q*K*se-ye/2;Q>=0&&ye>0&&(E.scrollLeft=Math.max(0,Tt));},[U.length,jo,Xe,se]),jsx(ln.Provider,{value:Ua,children:jsx(al.Provider,{value:R0,children:jsxs("div",{ref:Cn,className:"flex flex-col h-full w-full",style:{backgroundColor:qt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...qt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${qt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Js,{theme:qt,timeScale:Xe,onTimeScaleChange:ot,zoom:se,onZoomChange:N,currentTheme:pt,onThemeChange:Le,rowDensity:Qe,onRowDensityChange:H,showThemeSelector:c,showCreateTaskButton:y&&ct?.canCreateTask!==false&&!ct?.canCreateSubtaskOnly,createTaskLabel:k,onCreateTask:C,taskFilter:ge,onTaskFilterChange:te,hideCompleted:V,onHideCompletedChange:me,toolbarRightContent:L,wbsLevel:Y,onWbsLevelChange:Cc,maxWbsDepth:xt,viewMode:ee,onViewModeChange:Ve,projectForecast:$,onExportPNG:i?X0:void 0,onExportPDF:i?J0:void 0,onExportExcel:i?Q0:void 0,onExportCSV:i?Z0:void 0,onExportJSON:i?ef:void 0,onExportMSProject:i?tf:void 0,showCriticalPath:Ue,onShowCriticalPathChange:mt,showDependencies:He,onShowDependenciesChange:It,highlightWeekends:st,onHighlightWeekendsChange:z,showBaseline:ve,onShowBaselineChange:E=>{E&&ee!=="oracle"&&Ve("oracle"),!E&&ee==="oracle"&&Ve("execution");},onCopySnapshotLink:Re})}),jsxs("div",{ref:Zr,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:ps,className:"gantt-grid-scroll flex-shrink-0",style:{width:B0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(ti,{tasks:Fc,theme:qt,rowHeight:ms,availableUsers:l,templates:Ec,onTaskClick:F,onTaskDblClick:Pc,onTaskContextMenu:xe,onTaskToggle:H0,scrollTop:A,columns:Vo,onToggleColumn:O0,onColumnResize:$0,onTaskUpdate:_o,onTaskIndent:z0,onTaskOutdent:U0,onTaskMove:G0,onMultiTaskDelete:_i,onTaskDuplicate:V0,onTaskCreate:_0,onTaskRename:j0,onCreateSubtask:ji,onOpenTaskModal:F?E=>F(E):void 0,onDeleteRequest:(E,I)=>ya({taskId:E,taskName:I}),onTaskReparent:W0,scrollContainerRef:ps})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:qt.border,zIndex:15},onMouseDown:af}),jsx("div",{ref:Ar,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Yi?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(ui,{tasks:Fc,theme:qt,rowHeight:ms,timeScale:Xe,startDate:jo,endDate:Ki,zoom:se,locale:h,templates:Ec,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Pc,onTaskContextMenu:Y0,onTaskDateChange:K0,onDependencyCreate:Ac,onDependencyDelete:Lc,showBaseline:ve,showCriticalPath:Ue,showDependencies:He,highlightWeekends:st,canEditTask:ct?.canEditTask})})]}),Oe.task&&jsx(un,{isOpen:Oe.isOpen,x:Oe.x,y:Oe.y,theme:qt,onClose:()=>Dt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Oe.task;if(!E)return [];let I=Me.findTaskById(U,E.id)||E,K=I.subtasks&&I.subtasks.length>0,Q=ct?.canCreateTask!==false,ye=ct?.canDeleteTask!==false;if(K){let Mt=[],Fa=ct?.canDuplicateTask!==false;return Q&&Mt.push({id:"addSubtask",label:Ua.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{re?re(I):ji(I.id);}}),Fa&&Mt.push({id:"duplicate",label:Ua.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(I):ke(or=>Gn(or,[I.id]).tasks),Dt({isOpen:false,x:0,y:0,task:null});}}),ye&&(Mt.length>0&&Mt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Mt.push({id:"delete",label:Ua.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{ya({taskId:I.id,taskName:I.name});}})),Mt}let Fe=ct?.canUpdateTask!==false,Tt=ct?.canDuplicateTask!==false,et=[];return Fe&&et.push({id:"edit",label:Ua.contextMenu?.editTask||"Edit Task",icon:Vt.Pencil,onClick:()=>{W?W(I):Ut(I);}}),Q&&et.push({id:"addSubtask",label:Ua.contextMenu?.addSubtask||"Add Subtask",icon:Vt.Add,onClick:()=>{re?re(I):ji(I.id);}}),et.length>0&&Fe&&et.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Fe&&(et.push({id:"markIncomplete",label:Ua.contextMenu?.markIncomplete||"Mark Incomplete",icon:Vt.MarkIncomplete,onClick:()=>{Ce?Ce(I):_o(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"}),et.push({id:"setInProgress",label:Ua.contextMenu?.setInProgress||"Set In Progress",icon:Vt.SetInProgress,onClick:()=>{O?O(I):_o(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"}),et.push({id:"markComplete",label:Ua.contextMenu?.markComplete||"Mark Complete",icon:Vt.MarkComplete,onClick:()=>{_o(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"})),(Tt||Fe&&I.startDate&&I.endDate)&&et.length>0&&et.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Tt&&et.push({id:"duplicate",label:Ua.contextMenu?.duplicateTask||"Duplicate Task",icon:Vt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(I):ke(Mt=>Gn(Mt,[I.id]).tasks),Dt({isOpen:false,x:0,y:0,task:null});}}),Fe&&I.startDate&&I.endDate&&et.push({id:"split",label:Ua.contextMenu?.splitTask||"Split Task",icon:Vt.Split,onClick:()=>{let Mt=I.startDate.getTime(),Fa=I.endDate.getTime(),or=Mt+(Fa-Mt)/2,wo=new Date(or);q0(I,wo);}}),ye&&(et.length>0&&et.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),et.push({id:"delete",label:Ua.contextMenu?.deleteTask||"Delete Task",icon:Vt.Delete,onClick:()=>{ya({taskId:I.id,taskName:I.name});}})),et})()}),jsx(jr,{task:gt,isOpen:!!gt,onClose:()=>Ut(null),onTaskUpdate:E=>{gt&&(_o(gt.id,E),Ut(null));},theme:pt==="light"?"light":"dark",locale:h==="es"?"es":"en",availableUsers:l,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:()=>ya(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:qt.bgSecondary,border:`1px solid ${qt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${qt.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:qt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ua.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:qt.textSecondary,fontFamily:"Inter, sans-serif"},children:h==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:qt.textSecondary,fontFamily:"Inter, sans-serif"},children:[h==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:qt.textPrimary},children:['"',Ta.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:qt.bgPrimary,borderTop:`1px solid ${qt.border}`},children:[jsx("button",{onClick:()=>ya(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:qt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=qt.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:h==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{_i([Ta.taskId]),ya(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),h==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(gi,{tasks:U,theme:qt,config:f,onTasksUpdate:ke,onTaskUpdate:_o,onTaskCreate:E=>{ke(I=>[...I,E]);},onTaskDelete:E=>{_i([E]);},onDependencyCreate:(E,I)=>{let K=Me.findTaskById(U,E);K&&Ac(K,I);},onDependencyDelete:Lc})]})})})});function Rv(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 Ov(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),c=parseInt(a[2],10);return d*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 md=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],gd=[{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 dm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:l,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:x,defaultStatus:b}){let v=[...md,...i.filter(N=>!md.some(Y=>Y.id===N.id))],f=tt[c]||tt.dark,[h,w]=useState(false),[y,k]=useState(false),[C,D]=useState(false),[T,L]=useState(false),[B,S]=useState({top:0,left:0}),[R,$]=useState(null),[de,F]=useState(new Date),[X$1,xe]=useState({top:0,left:0}),[_e,M]=useState(false),[W,re]=useState([]),[Ce,O]=useState(false),[q,J]=useState(""),pe=useRef(null),Be=useRef(null),ze=useRef(null),it=useRef(null),nt=useRef(null),[oe,ct]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[Re,yt]=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||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&M(true)):(ct({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),M(false),re([]));},[a,e,b]),useEffect(()=>{let N=Y=>{pe.current&&!pe.current.contains(Y.target)&&w(false),Be.current&&!Be.current.contains(Y.target)&&k(false),ze.current&&!ze.current.contains(Y.target)&&D(false),it.current&&!it.current.contains(Y.target)&&L(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);let ft=()=>{let N={};return oe.name.trim()||(N.name="El nombre es requerido"),oe.startDate&&oe.endDate&&oe.startDate>oe.endDate&&(N.endDate="La fecha de fin debe ser posterior a la de inicio"),yt(N),Object.keys(N).length===0},pt=async N=>{if(N.preventDefault(),!!ft())try{let Y=d==="create"&&W.length>0?{...oe,pendingFiles:W}:oe;await s(Y),re([]),t();}catch(Y){console.error("Error submitting task:",Y);}},Te=(N,Y)=>{ct(ie=>{let he={...ie,[N]:Y};if(N==="status"){let _=Y;_==="todo"?he.progress=0:_==="in-progress"?(ie.progress===0||ie.progress===100)&&(he.progress=50):_==="completed"||_==="closed"?he.progress=100:(_==="in-review"||_==="review")&&(he.progress=75);}if(N==="progress"){let _=typeof Y=="number"?Y:parseInt(Y,10);_===100&&ie.status!=="completed"?he.status="completed":_>0&&_<100&&ie.status==="todo"?he.status="in-progress":_===0&&ie.status!=="todo"&&(he.status="todo");}return he}),Re[N]&&yt(ie=>{let he={...ie};return delete he[N],he});},Xe=v.find(N=>N.id===oe.status)??md[0],ot=gd.find(N=>N.id===oe.priority)??gd[1],Qe=So.find(N=>N.value===oe.color)??So[0],H=c==="dark",se={backgroundColor:H?"rgba(255, 255, 255, 0.04)":f.bgSecondary,border:`1px solid ${H?"rgba(255, 255, 255, 0.08)":f.borderLight}`,color:f.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50",style:{backgroundColor:H?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:H?"rgba(10, 10, 10, 0.97)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Xe.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=f.hoverBg,N.currentTarget.style.color=f.textPrimary;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:pt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:oe.name,onChange:N=>Te("name",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:oe.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Re.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Re.name]})]}),jsx("div",{children:jsx("textarea",{value:oe.description||"",onChange:N=>Te("description",N.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:pe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...se,borderColor:Xe.color,backgroundColor:`${Xe.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Xe.color}}),jsx("span",{style:{color:Xe.color},children:Xe.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Xe.color}})]}),jsx(AnimatePresence,{children:h&&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?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:v.map(N=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("status",N.id),w(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:N.color}}),N.title,oe.status===N.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ot.color}}),jsx("span",{children:ot.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:gd.map(N=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("priority",N.id),k(false);},children:[jsx("span",{children:N.icon}),N.label,oe.priority===N.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},N.id))})})]}),o.length>0&&jsxs("div",{ref:ze,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&D(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[oe.assignees&&oe.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:oe.assignees.slice(0,3).map((N,Y)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:N.color||f.accent,borderColor:f.bgSecondary},children:N.initials},Y))}),oe.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",oe.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":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(N=>{let Y=oe.assignees?.some(ie=>ie.name===N.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=Y?(oe.assignees||[]).filter(he=>he.name!==N.name):[...oe.assignees||[],{name:N.name,avatar:N.avatar,initials:N.name.split(" ").map(he=>he[0]).join("").toUpperCase().slice(0,2),color:f.accent}];Te("assignees",ie);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:N.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:N.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:Y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},N.id)})})})]}),jsxs("div",{ref:it,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)L(false);else {if(it.current){let N=it.current.getBoundingClientRect(),Y=window.innerHeight,ie=120,_=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;S({top:_,left:N.left});}L(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:se,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:oe.color}}),jsx("span",{children:Qe.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(At,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>L(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:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:N=>N.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:So.slice(0,18).map(N=>{let Y=oe.color===N.value;return jsx("button",{type:"button",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),Te("color",N.value),L(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:N.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:N.value,outline:Y?`2px solid ${N.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},N.value)})})})})]})})]}),u.length>0||l?jsx(oo,{selectedTags:oe.tags||[],availableTags:u,onChange:N=>Te("tags",N),onCreateTag:l,theme:f,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{ref:nt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!oe.isMilestone)if(R==="start")$(null);else {if(nt.current){let N=nt.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,_=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;xe({top:_,left:N.left});}$("start"),F(oe.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:oe.isMilestone?.5:1,cursor:oe.isMilestone?"not-allowed":"pointer"},disabled:n||oe.isMilestone,children:oe.startDate?oe.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!oe.isMilestone)if(R==="end")$(null);else {if(nt.current){let N=nt.current.getBoundingClientRect(),Y=window.innerHeight,ie=320,_=Y-N.bottom<ie?N.top-ie-8:N.bottom+8;xe({top:_,left:N.left});}$("end"),F(oe.endDate||oe.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...se,opacity:oe.isMilestone?.5:1,cursor:oe.isMilestone?"not-allowed":"pointer"},disabled:n||oe.isMilestone,children:oe.endDate?oe.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:R&&jsxs(At,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(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:`${X$1.top}px`,left:`${X$1.left}px`,zIndex:99999,backgroundColor:H?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"rgba(255, 255, 255, 0.10)":f.border}`},children:[(()=>{let N=new Date,Y=new Date(N);Y.setDate(N.getDate()+1);let ie=new Date(N);ie.setDate(N.getDate()+7);let he=new Date(N);return he.setDate(N.getDate()+14),[{label:"Hoy",date:N},{label:"Ma\xF1ana",date:Y},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:he}].map((ee,Ve)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:ve=>ve.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ve=>ve.currentTarget.style.backgroundColor="transparent",onClick:()=>{R==="start"?(Te("startDate",ee.date),(!oe.endDate||ee.date>oe.endDate)&&Te("endDate",ee.date),$("end")):(Te("endDate",ee.date),(!oe.startDate||ee.date<oe.startDate)&&Te("startDate",ee.date),$(null));},children:ee.label},Ve))})(),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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",onClick:()=>{Te("startDate",void 0),Te("endDate",void 0),$(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(de.getFullYear(),de.getMonth()-1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.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:de.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>F(new Date(de.getFullYear(),de.getMonth()+1)),className:"p-1 rounded",onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.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((N,Y)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:N},Y))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let N=de.getFullYear(),Y=de.getMonth(),ie=new Date(N,Y,1).getDay(),he=new Date(N,Y+1,0).getDate(),_=new Date,ee=[];for(let ve=ie-1;ve>=0;ve--)ee.push({day:new Date(N,Y,-ve).getDate(),date:new Date(N,Y-1,new Date(N,Y,-ve).getDate()),isCurrentMonth:false});for(let ve=1;ve<=he;ve++)ee.push({day:ve,date:new Date(N,Y,ve),isCurrentMonth:true});let Ve=42-ee.length;for(let ve=1;ve<=Ve;ve++)ee.push({day:ve,date:new Date(N,Y+1,ve),isCurrentMonth:false});return ee.map((ve,Ue)=>{let Se=ve.date.toDateString()===_.toDateString(),He=oe.startDate?.toDateString()===ve.date.toDateString(),lt=oe.endDate?.toDateString()===ve.date.toDateString(),st=oe.startDate&&oe.endDate&&ve.date>=oe.startDate&&ve.date<=oe.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ve.isCurrentMonth?He||lt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:He?f.accent:lt?"#7C3AED":st?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Se&&!He&&!lt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{R==="start"?(Te("startDate",ve.date),oe.endDate&&ve.date>oe.endDate&&Te("endDate",ve.date),$("end")):(Te("endDate",ve.date),oe.startDate&&ve.date<oe.startDate&&Te("startDate",ve.date),$(null));},children:ve.day},Ue)})})()})]})]})]})})]}),Re.endDate&&jsx("span",{className:"text-xs text-red-400",children:Re.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:oe.progress,onChange:N=>Te("progress",parseInt(N.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:oe.progress<30?"#EF4444":oe.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${oe.progress<30?"#EF4444":oe.progress<70?"#F59E0B":"#10B981"}20`,color:oe.progress<30?"#EF4444":oe.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[oe.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>M(!_e),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${_e?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:_e&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:oe.effortMinutes?Rv(oe.effortMinutes):"",onChange:N=>{let Y=Ov(N.target.value);Te("effortMinutes",Y);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||d==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",d==="create"?W.length>0&&`(${W.length})`:m.length>0&&`(${m.length})`]})]}),d==="create"?jsx(Or,{cardId:"pending",attachments:W.map((N,Y)=>({id:`pending-${Y}`,cardId:"pending",name:N.name,size:N.size,type:N.type,url:URL.createObjectURL(N),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:N=>re(Y=>[...Y,...N]),onDelete:N=>{let Y=parseInt(N.replace("pending-",""),10);re(ie=>ie.filter((he,_)=>_!==Y));},maxSizeMB:10,maxFiles:20}):jsx(Or,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?N=>g(a.id,N):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),d==="create"&&W.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[W.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:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:oe.isMilestone,onChange:N=>Te("isMilestone",N.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"]}),oe.dependencies&&oe.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:oe.dependencies.map(N=>{let Y=r.find(ie=>ie.id===N);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[Y?.name||N.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ie=(oe.dependencies||[]).filter(he=>he!==N);Te("dependencies",ie);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},N)})}),jsxs("button",{type:"button",onClick:()=>{O(!Ce),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:Ce&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{O(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?"rgba(17, 17, 17, 0.98)":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"rgba(255, 255, 255, 0.10)":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:q,onChange:N=>J(N.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(N=>N.id!==a?.id).filter(N=>q===""||N.name.toLowerCase().includes(q.toLowerCase())).map(N=>{let Y=oe.dependencies?.includes(N.id);return jsxs("button",{type:"button",onClick:()=>{let ie=oe.dependencies||[],he;Y?he=ie.filter(_=>_!==N.id):he=[...ie,N.id],Te("dependencies",he);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Y?`${f.accent}10`:"transparent"},onMouseEnter:ie=>{Y||(ie.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor=Y?`${f.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:Y?f.accent:"transparent",borderColor:Y?f.accent:f.borderLight},children:Y&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:N.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:N.id.slice(0,8)})]})]},N.id)}),r.filter(N=>N.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:N=>N.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:N=>N.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:N=>!n&&(N.currentTarget.style.opacity="0.9"),onMouseLeave:N=>!n&&(N.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var cm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
369
369
 
370
370
  AVAILABLE COMMANDS:
371
371
  1. move_task - Move a task to a different date
@@ -410,7 +410,7 @@ If ambiguous, ask for clarification in the message field.`;function um(e){return
410
410
  ${pm(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 pm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Qr(e,t){let a=pm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let c=d.name.toLowerCase();return n.every(i=>c.includes(i))})}function fd(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 x=new Date(r),b=x.getDay(),v=g-b;return v<=0&&(v+=7),x.setDate(x.getDate()+v),x}}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(),x=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?x.setDate(x.getDate()+m):g==="week"||g==="semana"||g==="semanas"?x.setDate(x.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&x.setMonth(x.getMonth()+m),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let m=parseInt(d[1],10),g=parseInt(d[2],10)-1,x=parseInt(d[3],10);return new Date(x,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()],x=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(x,g,m)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=u[l[1].toLowerCase()],g=parseInt(l[2],10),x=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(x,m,g)}return null}function bd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),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 mm(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 gm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),l=Qr(t,i),m=fd(u);if(!l)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:l.id,taskName:l.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(m);return x.setDate(x.getDate()+g),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:m,endDate:x},message:`Moved "${l.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(),u=o[2].trim(),l=Qr(t,i),m=bd(u);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(l.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:g},message:`Extended "${l.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(),u=s[2].trim(),l=Qr(t,i),m=hd(u);return l?m===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:m},message:`Set "${l.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(),u=n[2].trim(),l=Qr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:u},message:`Renamed "${l.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),u=d[2].trim(),l=Qr(t,i),m=Qr(t,u);return l?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:l.id,dependencyTo:m.id,message:`Linked "${l.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Qr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function fm(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 $v(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 Hv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function hi(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let l=a.find(m=>m.id===u);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>hi(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},d=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||d&&c&&Math.abs(c.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:c,progress:e.progress||0,status:$v(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 bm(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:Hv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function hm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>hi(r,e,t))}var yd={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:"Time Spent",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},xd={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:"Tiempo",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},yi={en:yd,es:xd};function vd(e){return yi[e]||yi.en}function xi(e,t){let a=vd(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-[#007BFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#32D74B]"}];function ym(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 xm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=ym(e),i=wd[0],u=wd.find(g=>g.value===c)??i,l=u.icon,m=g=>{switch(ym(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(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsx(ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:p("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 x=g.icon;return jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:p("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(x,{className:p("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var kd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#007BFF]",bg:"bg-[#007BFF]"},{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),d=useRef(null);useEffect(()=>{let u=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let c=kd.find(u=>u.value===e)??kd[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:p("w-4 h-4",c.color)}),jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:p("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:p("w-4 h-4",c.color)}),jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsx(ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:p("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:kd.map(u=>jsxs("button",{onClick:l=>{l.stopPropagation(),t(u.value),n(false);},className:p("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===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:p("w-2 h-2 rounded-full",u.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function qn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Cd(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 Nm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=useState(false),[c,i]=useState(""),u=useRef(null),l=useRef(null);useEffect(()=>{let b=v=>{u.current&&!u.current.contains(v.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),useEffect(()=>{n&&l.current&&l.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),g=b=>e.some(v=>v.name===b),x=b=>{if(a){if(g(b.name))a(e.filter(v=>v.name!==b.name));else {let v={name:b.name,initials:qn(b.name),color:b.color||Cd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,v]);}d(false),i("");}};return s||!a?e.length===0?jsx("span",{className:p("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,v)=>jsx("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)},`${b.name}-${v}`)),e.length>3&&jsxs("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:b=>{b.stopPropagation(),d(!n);},className:p("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:p("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:p("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,v)=>jsx("div",{className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)},`${b.name}-${v}`)),e.length>2&&jsxs("span",{className:p("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:l,type:"text",value:c,onChange:b=>i(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,v)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(h=>h.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${b.name}-${v}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let v=g(b.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),x(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):qn(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),v&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function Em({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:c}){let[i,u]=useState(false),[l,m]=useState(o),[g,x]=useState(()=>{let D=o==="start"?e:t;if(D){let T=D instanceof Date?D:new Date(D);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let D=T=>{b.current&&!b.current.contains(T.target)&&u(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let h=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let D=g.getFullYear(),T=g.getMonth(),L=new Date(D,T,1),S=new Date(D,T+1,0).getDate(),R=L.getDay(),$=[],F=new Date(D,T,0).getDate();for(let xe=R-1;xe>=0;xe--)$.push({date:new Date(D,T-1,F-xe),isCurrentMonth:false});for(let xe=1;xe<=S;xe++)$.push({date:new Date(D,T,xe),isCurrentMonth:true});let X=42-$.length;for(let xe=1;xe<=X;xe++)$.push({date:new Date(D,T+1,xe),isCurrentMonth:false});return $},[g]),y=D=>{if(r)o==="start"?a(D,f||void 0):a(v||void 0,D),u(false);else if(l==="start"){let T=f&&D>f?D:f;a(D,T||void 0),m("end");}else {let T=v&&D<v?D:v;a(T||void 0,D),u(false);}},k=()=>{let D=new Date,T=new Date(D);T.setDate(D.getDate()+1);let L=new Date(D);L.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let B=new Date(D);B.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let S=new Date(D);S.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let R=new Date(D);R.setDate(D.getDate()+14);let $=new Date(D);return $.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:L,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:B,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:R,display:R.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:$,display:$.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let D=r&&o==="start"?v:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:h(D)})]})}let C=r&&o==="start"?v:f;return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{onClick:D=>{D.stopPropagation(),u(!i);let T=o==="start"?v:f;T&&x(new Date(T.getFullYear(),T.getMonth(),1));},className:p("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:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:h(C)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(false)}),jsxs("div",{className:p("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:D=>D.stopPropagation(),children:[jsxs("div",{className:p("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[k().map((D,T)=>jsxs("button",{className:p("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:()=>y(D.date),children:[jsx("span",{children:D.label}),jsx("span",{className:p("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},T)),jsx("div",{className:p("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),u(false);},className:p("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:p("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:l==="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:p("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:()=>x(new Date),className:p("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:()=>x(new Date(g.getFullYear(),g.getMonth()-1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>x(new Date(g.getFullYear(),g.getMonth()+1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:p("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(D=>jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,T)=>{let L=D.date.toDateString()===new Date().toDateString(),B=v?.toDateString()===D.date.toDateString(),S=f?.toDateString()===D.date.toDateString(),R=B||S,$=!r&&v&&f&&D.date>=v&&D.date<=f;return jsx("button",{onClick:()=>y(new Date(D.date)),className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),L&&"ring-2 ring-[#007BFF]",B&&"bg-[#007BFF] text-white",S&&!B&&"bg-[#7C3AED] text-white",$&&!R&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!R&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},T)})})]})]})]})]})}function ki({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Em,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:d||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function yn(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 Ci(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[d,c]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let l=i.current??0,m=e,g=m-l,x=r/o;c(true);for(let b=1;b<=o;b++){let v=setTimeout(()=>{let f=b/o,h=1-Math.pow(1-f,3),w=Math.round(l+g*h);n(w),b===o&&(c(false),n(m));},x*b);u.current.push(v);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function Fm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,d]=useState(0),c=useRef(null),i=useRef(null),u=useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),d(0);let x=Date.now();i.current=setInterval(()=>{let b=Date.now()-x,v=Math.min(b/a*100,100);d(v);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),d(0);},a);},[a,e]),l=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),d(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:u,cancelChange:l}}function Am({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=yn(),{displayValue:c,isAnimating:i}=Ci(e,{enabled:o,duration:300,steps:6}),u=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),x=m.clientX-g.left,b=Math.round(x/g.width*100),v=Math.max(0,Math.min(100,b));v!==e&&(t(v),s&&d());},l=c??e;return jsxs("div",{className:p("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#32D74B]/30":"bg-[#32D74B]/20")),children:[jsx("div",{onClick:u,className:p("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:p("h-full rounded-full transition-[width]",l===100?"bg-[#32D74B]":"bg-[#007BFF]",i&&"transition-none"),style:{width:`${l}%`}})}),jsxs("span",{className:p("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[l,"%"]})]})}function Bm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[d,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{d!==e&&t?.(d),n(false);},l=m=>{m.key==="Enter"?u():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:p("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:d,onChange:m=>c(m.target.value),onBlur:u,onKeyDown:l,onClick:m=>m.stopPropagation(),className:p("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:p("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 $m({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:c=true}){let[i,u]=useState(false),[l,m]=useState(e?.toString()||""),g=useRef(null),{isFlashing:x,triggerFlash:b}=yn(),{displayValue:v,isAnimating:f}=Ci(e,{enabled:d&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{m(e?.toString()||"");},[e]);let h=()=>{let y=parseFloat(l);if(!isNaN(y)){let k=y;o!==void 0&&(k=Math.max(o,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&b());}u(false);},w=y=>{y.key==="Enter"?h():y.key==="Escape"&&(m(e?.toString()||""),u(false));};return n||!t?jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsx("input",{ref:g,type:"number",value:l,onChange:y=>m(y.target.value),onBlur:h,onKeyDown:w,onClick:y=>y.stopPropagation(),min:o,max:s,className:p("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:y=>{y.stopPropagation(),u(true);},className:p("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),x&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Hm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=useState(false),c=useRef(null);return useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:p("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(),d(!n);},className:p("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:p("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:p("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:p("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:p("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),d(false);},className:p("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 Um({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:c,startChange:i,cancelChange:u}=Fm(t,{delay:s}),l=g=>{g.stopPropagation(),!r&&t&&(o?d?u():i(!e):t(!e));},m=d?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:l,disabled:r||!t,className:p("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&m&&"ring-green-500/50",d&&!m&&"ring-red-500/50",d&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[d&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),d?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),d&&jsx("button",{onClick:g=>{g.stopPropagation(),u();},className:p("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 Vm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:p("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:p("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 w2(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 k2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),c=parseInt(a[2],10);return d*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(d*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 Ro({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false,lens:c="hours",hourlyRate:i=0}){let[u,l]=useState(false),[m,g]=useState(""),x=useRef(null),{isFlashing:b,triggerFlash:v}=yn(),f=c==="financial"&&i>0,h=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:w2(e,r);useEffect(()=>{u&&x.current&&(x.current.focus(),x.current.select());},[u]),useEffect(()=>{if(e){let C=Math.floor(e/60),D=e%60;C>0&&D>0?g(`${C}h ${D}m`):C>0?g(`${C}h`):g(`${D}m`);}else g("");},[e,u]);let w=()=>{let C=k2(m);C!==e&&(t?.(C),n&&v()),l(false);},y=C=>{C.key==="Enter"?w():C.key==="Escape"&&l(false);};if(d)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:p("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 k=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(k,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:h})]}):u?jsx("input",{ref:x,type:"text",value:m,onChange:C=>g(C.target.value),onBlur:w,onKeyDown:y,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:C=>{C.stopPropagation(),l(true);},className:p("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(k,{className:p("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:h})]})}function Ym({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsx("span",{className:p("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let d=o==="es";return a===0?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#007BFF"},children:d?"En Tiempo":"On Track"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#32D74B"},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF453A"},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:p("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function qm({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:d,lens:c="hours",hourlyRate:i=0}){let u=a==="es",l=c==="financial"&&i>0,m=M=>l?`$${Math.round(M*i).toLocaleString("en-US")}`:`${M}h`,[g,x]=useState(false),[b,v]=useState(false),[f,h]=useState(null),w=useRef(null),y=e.timeLoggedMinutes||0,k=e.effortMinutes||0,C=e.soldEffortMinutes||0,D=Math.round(y/60*10)/10,T=Math.round(k/60*10)/10,L=Math.round(C/60*10)/10,B=k>0?y/k*100:0,S=B>100?Math.round((y-k)/60*10)/10:0,R=B>100?"#FF453A":B>=80?"#FFD60A":"#32D74B";useEffect(()=>{if(!b&&!f)return;let M=W=>{w.current&&!w.current.contains(W.target)&&(v(false),h(null));};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[b,f]);let $=M=>{if(M.stopPropagation(),r&&!o&&!s){h("log");return}if(r||o||s){v(W=>!W),h(null);return}d&&d(e);},de=M=>{v(false),h(M);},F=async(M,W)=>{f==="log"&&r&&M?r(e,M,W):f==="estimate"&&o?o(e,M):f==="quoted"&&s&&s(e,M),h(null);},X=r||o||s||d,xe=[{mode:"log",icon:Clock,label:u?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:u?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:u?"T. Ofertado":"Quoted time",show:!!s}].filter(M=>M.show),_e=f==="estimate"?k:f==="quoted"?C:void 0;return k===0&&y===0&&C===0?jsxs("div",{ref:w,className:"relative flex items-center gap-2",onClick:M=>M.stopPropagation(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),children:[jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&X&&jsx("button",{onClick:$,className:"px-2 py-0.5 rounded-full text-[9px] font-mono uppercase bg-[#007BFF]/15 text-[#007BFF] hover:bg-[#007BFF]/25 transition-colors",children:u?"Tiempo":"Time"}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:xe.map(M=>jsxs("button",{onClick:W=>{W.stopPropagation(),de(M.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.mode))})}),jsx(AnimatePresence,{children:f&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:_e||void 0,onSave:F,onClose:()=>h(null)})})})})]}):jsxs("div",{ref:w,className:"relative flex items-center gap-2 w-full",onClick:M=>M.stopPropagation(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:m(D)}),k>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),S>0&&jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF453A"},children:["+",m(S)," ",u?"Exceso":"Over"]})]}),k>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(B,100)}%`,backgroundColor:R,borderRadius:2,transition:"width 0.3s"}})}),C>0&&(s||n)&&jsxs("div",{className:"flex items-center gap-1",style:{marginTop:1},children:[jsxs("span",{className:"font-mono",style:{fontSize:9,color:t?"rgba(255,255,255,0.25)":"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:[u?"Ofertado":"Quoted",":"]}),jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(L)})]})]}),X&&jsxs("button",{onClick:$,className:"flex-shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors",style:{border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB",color:t?"rgba(255,255,255,0.7)":"#374151"},children:[jsx(Plus,{className:"w-3 h-3"}),u?"Tiempo":"Time"]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:xe.map(M=>jsxs("button",{onClick:W=>{W.stopPropagation(),de(M.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.mode))})}),jsx(AnimatePresence,{children:f&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:_e||void 0,onSave:F,onClose:()=>h(null)})})})})]})}function Xm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF453A]/15 text-[#FF453A]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#32D74B]/15 text-[#32D74B]";return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsx("img",{src:a.avatar,alt:a.name,className:p("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsx("div",{className:p("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsx("span",{className:p("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var F2={critical:"bg-[#FF453A]/15 text-[#FF453A]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#007BFF]/15 text-[#007BFF]"};function Qm({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:p("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:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",F2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function K2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Y2(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 ag({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:l,onReportBlocker:m,onCopyTaskLink:g}){let x=useRef(null),b=r==="es"?eg.es:eg.en;if(useEffect(()=>{let y=C=>{x.current&&!x.current.contains(C.target)&&t();},k=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),d&&(y.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),u.length>0&&y.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:k.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],T=C.some(L=>L.name===k.name)?C.filter(L=>L.name!==k.name):[...C,{name:k.name,initials:K2(k.name),color:k.color||Y2(k.name),avatar:k.avatarUrl}];d({...e.task,assignees:T}),t();}}))})),l&&y.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{l(e.task),t();}}),m&&y.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&y.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},f=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.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"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),y},h=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:x,style:w,className:p("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:h.map(y=>y.separator?jsx("div",{className:p("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},y.id):y.submenu?jsx(q2,{item:y,isDark:a},y.id):jsxs("button",{onClick:y.onClick,className:p("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",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:p(y.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function q2({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:p("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:p("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:p("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxs("button",{onClick:d.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var eg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var cg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},p1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function pg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[c,i]=useState(""),[u,l]=useState(null),m=useRef(null),g=d==="es"?ug.es:ug.en;if(useLayoutEffect(()=>{if(!e||!m.current)return;let y=()=>{if(!m.current)return;let k=m.current.getBoundingClientRect(),D=window.innerHeight-k.top-20;l(Math.max(300,D));};return requestAnimationFrame(y),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[e]),useEffect(()=>{if(!e)return;let y=setTimeout(()=>{let k=D=>{m.current&&!m.current.contains(D.target)&&t();},C=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",C),m._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(y),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let x=y=>g.columns[y]||y,b=y=>{if(y==="name")return;let k=a.map(C=>C.id===y?{...C,visible:!C.visible}:C);o(k);},v=(y,k)=>{let C=a.find(T=>T.type===y&&(!k||T.customFieldId===k));if(C){b(C.id);return}let D={id:k||y,type:y,label:k?r.find(T=>T.id===k)?.name||y:x(y),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};o([...a,D]);},f=p1.filter(y=>x(y).toLowerCase().includes(c.toLowerCase())),h=r.filter(y=>y.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:m,style:{...u?{maxHeight:`${u}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",y.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent",y.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:y=>i(y.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:y=>{y&&y.style.setProperty("--focus-border",w);},onFocus:y=>{y.currentTarget.style.borderColor=w,y.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:y=>{y.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",y.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:y=>y.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(y=>{let k=a.find(T=>T.type===y&&!T.customFieldId),C=k?.visible??false,D=y==="name";return jsxs("button",{onClick:()=>{D||(k?b(k.id):v(y));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:T=>{D||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cg[y]}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:x(y)})]},y)})})]}),h.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:h.map(y=>{let C=a.find(D=>D.customFieldId===y.id)?.visible??false;return jsxs("button",{onClick:()=>v(y.type,y.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cg[y.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y.name})]},y.id)})})]})]})]})}var ug={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var w1=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function fg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[d,c]=useState("text"),[i,u]=useState([""]),l=o==="es"?gg.es:gg.en;useEffect(()=>{e&&(n(""),c("text"),u([""]));},[e]),useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:d};d==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{u([...i,""]);},x=(v,f)=>{let h=[...i];h[v]=f,u(h);},b=v=>{i.length>1&&u(i.filter((f,h)=>h!==v));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:p("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:p("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:p("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsx("button",{onClick:t,className:p("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:p("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:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:l.fieldNamePlaceholder,className:p("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:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:w1.map(v=>jsxs("button",{onClick:()=>c(v.type),className:p("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsx("span",{className:p("text-xs",d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:l.types[v.type]})]},v.type))})]}),d==="dropdown"&&jsxs("div",{children:[jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:v,onChange:h=>x(f,h.target.value),placeholder:`${l.option} ${f+1}`,className:p("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:()=>b(f),className:p("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:p("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"}),l.addOption]})]})]})]}),jsxs("div",{className:p("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:p("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:l.cancel}),jsx("button",{onClick:m,disabled:!s.trim(),className:p("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:l.create})]})]})]}):null}var gg={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 yg={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 xg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=useState(false),c=useRef(null),i=useRef(0),u=s==="es"?yg.es:yg.en;useEffect(()=>{if(!n)return;let g=b=>{Date.now()-i.current<100||c.current&&!c.current.contains(b.target)&&d(false);},x=b=>{b.key==="Escape"&&d(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",x);}},[n]);let l=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:u.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()),d(x=>!x);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-[#222] hover:bg-white/[0.05] text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#007BFF]/20 border-[#007BFF]/50 text-[#007BFF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,m&&jsx("span",{className:p("w-2 h-2 rounded-full",o?"bg-[#007BFF]":"bg-blue-500")})]}),n&&jsxs("div",{className:p("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:p("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:p("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:l.map(g=>{let x=e===g.value&&!t,b=()=>g.value==="all"?x?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),d(false);},className:p("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",x&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:p(x?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),x&&jsx(Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:p("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),d(false);},className:p("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:p("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:p("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 wg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxs("div",{className:p("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:p("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:p("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:p("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,d=n>0?Math.min(Math.round(s/n*100),100):0,c=s>n&&n>0,i=c?"#FF453A":d>=80?"#FFD60A":"#32D74B";return jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:p("text-[11px] font-mono font-bold",c?"text-[#FF453A]":t?"text-white/80":"text-gray-800"),children:vg(s)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:p("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:vg(n)})]}),n>0&&jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:p("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF453A]/15 text-[#FF453A]":"bg-[#32D74B]/15 text-[#32D74B]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:p("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#32D74B]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,d=s<0,c=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:p("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#32D74B]/15 text-[#32D74B]",d&&"bg-[#FF453A]/15 text-[#FF453A]",!n&&!d&&"bg-[#007BFF]/15 text-[#007BFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let d=s.utilizationPercent>=100?"#FF453A":s.utilizationPercent>=80?"#FFD60A":s.color||"#32D74B";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxs("span",{className:p("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${s.name}-${n}`)})})]})]})}var R1=[{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 Dg(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(...Dg(r.subtasks,t+1));return a}function O1(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 u=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(u<=0)continue;let l=(s.progress||0)/u;r+=l,o++;}return o>0?r/o:null}function $1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function $d(e){if(!e.subtasks?.length)return {spent:0,allocated:0};let t=0,a=0;for(let r of e.subtasks)if(t+=r.timeLoggedMinutes??0,a+=r.effortMinutes??0,r.subtasks?.length){let o=$d(r);t+=o.spent,a+=o.allocated;}return {spent:t,allocated:a}}function Fi(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 Sg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:c=[],toolbarRightContent:i}){let{theme:u="dark",locale:l="en",customTranslations:m,showSearch:g=true,showHierarchy:x=true,tableColumns:b,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:h=true,showCreateTaskButton:w=false,onCreateTask:y,persistFilter:k=false,financialBlur:C,healthSidebar:D,lens:T="hours",hourlyRate:L=0,aggregateParentHours:B=false}=t,S=xi(l,m),R=u==="dark",$=useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let z=localStorage.getItem(k);if(z){let fe=JSON.parse(z);return {statusFilter:fe.statusFilter||"all",hideCompleted:fe.hideCompleted||!1}}}catch(z){console.error("Error loading persisted filter:",z);}return {statusFilter:"all",hideCompleted:false}},[k]),de=useMemo(()=>{function z(fe){let Ce=0,Ke=0;for(let qe of fe)if(qe.subtasks&&qe.subtasks.length>0){let ge=z(qe.subtasks);Ce+=ge.spent,Ke+=ge.allocated;}else Ce+=qe.timeLoggedMinutes??0,Ke+=qe.effortMinutes??0;return {spent:Ce,allocated:Ke}}return z(e)},[e]),F=useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:de.spent,totalHoursAllocatedMinutes:de.allocated}},[D,de]),[X,xe]=useState(true),[_e,M]=useState("startDate"),[W,re]=useState("asc"),[ke,O]=useState(""),[q,J]=useState(()=>$().statusFilter),[pe,Be]=useState(()=>$().hideCompleted),[ze,it]=useState(b||R1),[nt,oe]=useState(false),[ct,Re]=useState(false),[yt,ft]=useState({isOpen:false,x:0,y:0,type:"task"}),[pt,Te]=useState(null),[Xe,ot]=useState(0),[Qe,H]=useState(0),se=useRef(null);useEffect(()=>{b&&it(b);},[b]),useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:q,hideCompleted:pe}));}catch(z){console.error("Error persisting filter state:",z);}},[k,q,pe]);let N=useMemo(()=>{let z=new Set;function fe(Ce){for(let Ke of Ce)Ke.subtasks?.length&&(Ke.isExpanded!==false&&z.add(Ke.id),fe(Ke.subtasks));}return fe(e),z},[e]),Y=useMemo(()=>ze.filter(z=>z.visible),[ze]),ie=useCallback(z=>{a.onTaskToggleExpand?.(z);},[a]),he=useCallback(z=>{_e===z?re(fe=>fe==="asc"?"desc":"asc"):(M(z),re("asc")),a.onSortChange?.({column:z,direction:W==="asc"?"desc":"asc"});},[_e,W,a]),_=useCallback(z=>{it(z),a.onColumnsChange?.(z);},[a]),ee=useCallback(z=>{let fe=ze.map(Ce=>Ce.id===z?{...Ce,visible:false}:Ce);_(fe);},[ze,_]),Ve=useCallback((z,fe)=>{M(z),re(fe);},[]),ve=useCallback((z,fe,Ce)=>{h&&(z.preventDefault(),ft({isOpen:true,x:z.clientX,y:z.clientY,type:fe?"task":"header",task:fe,columnId:Ce}));},[h]),Ue=useCallback(()=>{ft(z=>({...z,isOpen:false}));},[]),Se=useCallback((z,fe)=>{if(!f)return;z.preventDefault(),z.stopPropagation();let Ce=ze.find(Ke=>Ke.id===fe);Ce&&(Te(fe),ot(z.clientX),H(Ce.width));},[ze,f]);useEffect(()=>{if(!pt)return;let z=Ce=>{let Ke=Ce.clientX-Xe,qe=Math.max(50,Qe+Ke),ge=ze.map(te=>te.id===pt?{...te,width:qe}:te);it(ge);},fe=()=>{pt&&a.onColumnsChange?.(ze),Te(null);};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",fe),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",fe);}},[pt,Xe,Qe,ze,a]);let He=useCallback(async z=>{if(a.onCreateCustomField){let fe={...z,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(fe);}Re(false);},[a]),lt=useCallback(z=>z.progress===100||z.status==="completed"?"completed":z.progress&&z.progress>0||z.status==="in-progress"?"in-progress":"todo",[]),st=useMemo(()=>{let z=Dg(e);if(ke.trim()){let fe=ke.toLowerCase();z=z.filter(Ce=>Ce.name.toLowerCase().includes(fe));}return q!=="all"&&(z=z.filter(fe=>lt(fe)===q)),pe&&(z=z.filter(fe=>lt(fe)!=="completed")),z.sort((fe,Ce)=>{let Ke,qe;switch(_e){case "name":Ke=fe.name.toLowerCase(),qe=Ce.name.toLowerCase();break;case "startDate":Ke=fe.startDate?.getTime()||0,qe=Ce.startDate?.getTime()||0;break;case "endDate":Ke=fe.endDate?.getTime()||0,qe=Ce.endDate?.getTime()||0;break;case "progress":Ke=fe.progress||0,qe=Ce.progress||0;break;case "status":Ke=fe.status||"todo",qe=Ce.status||"todo";break;case "priority":let ge={urgent:0,high:1,medium:2,low:3,none:4};Ke=ge[fe.priority]??4,qe=ge[Ce.priority]??4;break;default:return 0}return Ke<qe?W==="asc"?-1:1:Ke>qe?W==="asc"?1:-1:0}),z},[e,ke,q,pe,_e,W,lt]),dt=useCallback((z,fe)=>{let Ce=ge=>{a.onTaskUpdate?.({...z,...ge});},Ke=ge=>ge?z.customFields?.find(V=>V.fieldId===ge)?.value:void 0,qe=(ge,te)=>{if(!ge)return;let me=[...z.customFields||[]],Z=me.findIndex(A=>A.fieldId===ge);Z>=0?me[Z]={fieldId:ge,value:te}:me.push({fieldId:ge,value:te}),Ce({customFields:me});};switch(fe.type){case "name":return null;case "status":return jsx(xm,{value:z.status||(z.progress===100?"completed":z.progress&&z.progress>0?"in-progress":"todo"),onChange:te=>{Ce({status:te,progress:te==="completed"?100:te==="in-progress"?50:0});},isDark:R,locale:l,translations:S.status});case "priority":return jsx(wm,{value:z.priority,onChange:te=>Ce({priority:te}),isDark:R,locale:l});case "assignees":return jsx(Nm,{value:z.assignees||[],availableUsers:d,onChange:te=>Ce({assignees:te}),isDark:R,locale:l});case "startDate":return jsx(ki,{value:z.startDate,onChange:te=>Ce({startDate:te}),isDark:R,locale:l,dateField:"start",startDate:z.startDate,endDate:z.endDate});case "endDate":return jsx(ki,{value:z.endDate,onChange:te=>Ce({endDate:te}),isDark:R,locale:l,dateField:"end",startDate:z.startDate,endDate:z.endDate});case "progress":return jsx(Am,{value:z.progress||0,onChange:te=>{let V=te===100?"completed":te>0?"in-progress":"todo";Ce({progress:te,status:V});},isDark:R});case "tags":return jsx(Vm,{value:z.tags||[],isDark:R});case "text":return jsx(Bm,{value:Ke(fe.customFieldId)||"",onChange:te=>qe(fe.customFieldId,te),isDark:R});case "number":return jsx($m,{value:Ke(fe.customFieldId)||0,onChange:te=>qe(fe.customFieldId,te),isDark:R});case "date":let ge=Ke(fe.customFieldId);return jsx(ki,{value:ge?new Date(ge):void 0,onChange:te=>qe(fe.customFieldId,te),isDark:R,locale:l});case "dropdown":return jsx(Hm,{value:Ke(fe.customFieldId)||"",options:fe.options||[],onChange:te=>qe(fe.customFieldId,te),isDark:R});case "checkbox":return jsx(Um,{value:Ke(fe.customFieldId)||false,onChange:te=>qe(fe.customFieldId,te),isDark:R});case "estimatedTime":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.estimatedTime,onChange:V=>Ce({estimatedTime:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:L})}case "quotedTime":{let te=z.status==="completed"||z.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsx(Ro,{value:z.quotedTime,onChange:me=>Ce({quotedTime:me}),isDark:R,locale:l,disabled:te,isBlurred:V,lens:T,hourlyRate:L})}case "elapsedTime":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.elapsedTime,onChange:V=>Ce({elapsedTime:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:L})}case "effortMinutes":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.effortMinutes,onChange:V=>Ce({effortMinutes:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:L})}case "timeLoggedMinutes":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.timeLoggedMinutes,onChange:a.onLogTime?V=>{a.onLogTime?.(z,V);}:void 0,isDark:R,locale:l,placeholder:l==="es"?"Agregar":"Add",disabled:te,lens:T,hourlyRate:L})}case "soldEffortMinutes":{let te=z.status==="completed"||z.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsx(Ro,{value:z.soldEffortMinutes,onChange:me=>Ce({soldEffortMinutes:me}),isDark:R,locale:l,disabled:te,isBlurred:V,lens:T,hourlyRate:L})}case "scheduleVariance":return jsx(Ym,{startDate:z.startDate,endDate:z.endDate,scheduleVariance:z.scheduleVariance,isDark:R,locale:l});case "hoursBar":{if(B&&z.hasChildren){let{spent:te,allocated:V}=$d(z),me=te>V&&V>0;return jsxs("span",{className:p("text-[11px] font-mono",R?"text-white/50":"text-gray-500"),children:[jsx("span",{className:p("font-bold",me?"text-[#FF453A]":R?"text-white/80":"text-gray-800"),children:Fi(te)})," / ",jsx("span",{className:R?"text-white/60":"text-gray-600",children:Fi(V)})]})}return jsx(qm,{task:z,isDark:R,locale:l,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:L})}case "teamLoad":return jsx(Xm,{task:z,isDark:R});case "blockers":return jsx(Qm,{blockers:z.blockers,isDark:R,locale:l});default:return jsx("span",{className:p("text-sm",R?"text-white/60":"text-gray-500"),children:"-"})}},[a,R,l,d,S,B]),mt=useCallback(z=>{let Ce={name:S.columns.name,status:S.columns.status,priority:S.columns.priority,assignees:S.columns.assignees,startDate:S.columns.startDate,endDate:S.columns.endDate,progress:S.columns.progress,tags:S.columns.tags||(l==="es"?"Etiquetas":"Tags"),estimatedTime:S.columns.estimatedTime||(l==="es"?"Estimado":"Estimated"),quotedTime:S.columns.quotedTime||(l==="es"?"Ofertado":"Quoted"),elapsedTime:S.columns.elapsedTime||(l==="es"?"Tiempo":"Time Spent"),effortMinutes:S.columns.effortMinutes||(l==="es"?"Estimado":"Estimated"),timeLoggedMinutes:S.columns.timeLoggedMinutes||(l==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:S.columns.soldEffortMinutes||(l==="es"?"Ofertado":"Quoted"),scheduleVariance:S.columns.scheduleVariance||(l==="es"?"Prog / Var":"Sched / Var"),hoursBar:S.columns.hoursBar||(l==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:S.columns.teamLoad||(l==="es"?"Carga Equipo":"Team Load"),blockers:S.columns.blockers||(l==="es"?"Bloqueantes":"Blockers")}[z.type]||z.label;return typeof Ce=="string"?Ce:String(Ce||z.type)},[S,l]),It=useMemo(()=>{let Ce=Y.reduce((qe,ge)=>qe+ge.width,0)+(v?48:0),Ke={};for(let qe of Y)Ke[qe.id]=`${qe.width/Ce*100}%`;return Ke},[Y,v]);return r?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"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:p("text-sm",R?"text-white/60":"text-gray-600"),children:[S.empty.noTasks,"..."]})]})}):o?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"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:p("text-lg font-semibold mb-2",R?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"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:p("text-lg font-semibold mb-2",R?"text-white":"text-gray-900"),children:S.empty.noTasks}),jsx("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:S.empty.addFirstTask})]})}):jsxs("div",{ref:se,className:p(R?"bg-[#0D0D0D]":"bg-white",pt&&"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:p("flex-shrink-0 px-6 py-4 border-b",R?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(xg,{value:q,hideCompleted:pe,onChange:J,onHideCompletedChange:Be,isDark:R,locale:l}),jsxs("div",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:[st.length," ",S.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:p("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",R?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:ke,onChange:z=>O(z.target.value),placeholder:S.toolbar.searchPlaceholder,className:p("w-full h-9 pl-10 pr-4 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 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}),F?.enabled&&F.data&&!X&&jsx("button",{onClick:()=>xe(true),className:p("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",R?"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:l==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),w&&y&&jsxs(motion.button,{onClick:y,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:S.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:p("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",R?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Y.map(z=>jsxs("div",{className:p("relative flex items-center gap-2 px-4 py-2",R?"text-white/60":"text-gray-500"),style:{width:It[z.id],minWidth:z.minWidth},onContextMenu:fe=>ve(fe,void 0,z.id),children:[z.sortable?jsxs("button",{onClick:()=>he(z.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[mt(z),jsx(ArrowUpDown,{className:p("w-3 h-3",_e===z.id&&"text-[#007BFF]")})]}):jsx("span",{children:mt(z)}),f&&z.resizable&&jsx("div",{className:p("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",pt===z.id&&"bg-[#007BFF]"),onMouseDown:fe=>Se(fe,z.id)})]},z.id)),v&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:z=>{z.stopPropagation(),oe(fe=>!fe);},className:p("p-0.5 rounded transition-colors",R?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",nt&&(R?"bg-white/[0.05]":"bg-gray-200")),title:l==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(pg,{isOpen:nt,onClose:()=>oe(false),columns:ze,customFields:c,onColumnsChange:_,onCreateCustomField:()=>{oe(false),Re(true);},isDark:R,locale:l})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:st.map((z,fe)=>{let Ce=N.has(z.id),Ke=Math.min(fe*.01,.2),qe=z.hasChildren&&z.level===0,ge=z.subtasks?.length||0;return qe?jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ke},className:p("flex items-center border-y cursor-pointer",R?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>ie(z.id),children:jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 w-full",children:[jsx("button",{onClick:te=>{te.stopPropagation(),ie(z.id);},className:p("p-0.5 rounded flex-shrink-0",R?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsx(ChevronDown,{className:p("w-4 h-4",R?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:p("w-4 h-4",R?"text-white/40":"text-gray-500")})}),Ce?jsx(FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"}}),z.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"},children:z.wbsCode}),jsx("span",{className:p("text-[10px] font-semibold font-mono uppercase tracking-wide truncate",R?"text-gray-200":"text-gray-800"),children:z.name}),jsxs("span",{className:p("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",R?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ge," ",l==="es"?ge===1?"Tarea":"Tareas":ge===1?"Item":"Items",")"]}),jsx("div",{className:"flex-1"}),(()=>{let te=O1(z),V=$1(z),{spent:me,allocated:Z}=$d(z),A=me>0||Z>0,j=me>Z&&Z>0;return jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[A&&jsxs("span",{className:p("text-[10px] font-mono",R?"text-white/50":"text-gray-500"),children:["Total:"," ",jsx("span",{className:p("font-bold",j?"text-[#FF453A]":R?"text-white/80":"text-gray-800"),children:Fi(me)})," / ",jsx("span",{className:R?"text-white/60":"text-gray-600",children:Fi(Z)})]}),te!==null&&jsxs("span",{className:p("text-[10px] font-mono",te>=1?"text-[#32D74B]":te>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",te.toFixed(2)]}),V>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A]",children:[l==="es"?"Conflicto Recurso":"Resource Conflict",": ",V]}),z.progress!=null&&z.progress>0&&jsxs("span",{className:p("text-[10px] font-mono",z.progress===100?"text-[#32D74B]":"text-[#007BFF]"),children:[z.progress,"%"]})]})})()]})},z.id):jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ke},className:p("flex items-center border-b transition-colors",R?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(z),onDoubleClick:()=>a.onTaskDoubleClick?.(z),onContextMenu:te=>ve(te,z),children:[Y.map(te=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:It[te.id],minWidth:te.minWidth},children:te.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[x&&z.level>0&&jsx("div",{style:{width:`${z.level*24}px`},className:"flex-shrink-0"}),x&&z.hasChildren&&jsx("button",{onClick:V=>{V.stopPropagation(),ie(z.id);},className:p("p-0.5 rounded flex-shrink-0",R?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsx(ChevronDown,{className:p("w-4 h-4",R?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:p("w-4 h-4",R?"text-white/60":"text-gray-400")})}),x&&!z.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(z.wbsCode||z.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[z.wbsCode&&jsx("span",{className:p("text-[10px] font-mono",R?"text-[#007BFF]":"text-blue-600"),children:z.wbsCode}),z.taskCode&&jsx("span",{className:p("text-[10px] font-mono",R?"text-white/40":"text-gray-400"),children:z.taskCode})]}),jsx("span",{className:p("truncate font-bold text-[13px]",R?"text-white":"text-gray-900",z.progress===100&&(R?"line-through text-white/30":"line-through text-gray-400")),children:z.name}),z.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${z.tags[0].color}20`,color:z.tags[0].color},children:z.tags[0].name})]})]}):dt(z,te)},te.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},z.id)})}),st.length===0&&ke&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:p("w-12 h-12 mx-auto mb-4",R?"text-white/30":"text-gray-400")}),jsx("p",{className:p(R?"text-white/60":"text-gray-600"),children:S.empty.noResults})]})})]})}),F?.enabled&&F.data&&X&&jsx(wg,{data:F.data,isDark:R,locale:l,onClose:()=>xe(false)})]}),jsx(ag,{state:yt,onClose:Ue,isDark:R,locale:l,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ee,onColumnSort:Ve,availableUsers:d,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(fg,{isOpen:ct,onClose:()=>Re(false),onSave:He,isDark:R,locale:l})]})}var Eg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",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}],Fg=[{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"}],Pg=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var Hd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF453A",neonGreen:"#32D74B",neonAmber:"#FFD60A",neonBlue:"#0A84FF"},zd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Ud={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Pi={dark:Hd,light:zd,neutral:Ud};function Mg(e){return Pi[e]||Pi.dark}var Wd={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Gd={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Mi={en:Wd,es:Gd};function Zn(e){return Mi[e]||Mi.en}function Ai(e,t){let a=Zn(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 Ag(e){let t=Zn(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 Lg(e,t=0,a=true){let r=Zn(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 ts(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function _d(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function Rg({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:p("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Hg=26,j1=22,K1=10;function Og(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function jd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function zg(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 $g(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 Y1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:d=0}){let{task:c,spanCols:i,lane:u,isStart:l,isEnd:m}=e,g=c.progress===100||c.status==="completed",x=c.isCriticalPath,b=l&&m?"rounded":l?"rounded-l":m?"rounded-r":"",v=m?jd(c.effortMinutes,n,d):null,f=m?zg(c,n,d):null,h=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:p("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":x?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:`${u*Hg}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${j1}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:x?{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:l?"3px":void 0,borderLeftColor:l?x?"#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:[x&&l&&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&&(v||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:p(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),h&&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,": ",h.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Ug({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:c=[],onCreateTag:i,attachmentsByTask:u,comments:l,onAddComment:m,currentUser:g,mentionableUsers:x,onUploadCommentAttachments:b,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:h,timeEntries:w,timerState:y,onLogTime:k,onUpdateEstimate:C,onUpdateSoldEffort:D,onStartTimer:T,onStopTimer:L,onDiscardTimer:B,blurFinancials:S=false,suppressDetailModal:R=false,lens:$="hours",hourlyRate:de=0}){let{theme:F="dark",locale:X$1="en",customTranslations:xe,showBacklog:_e=true}=t,M=Ai(X$1,xe),W=F==="dark"||F==="neutral",[re,ke]=useState(r||new Date),[O,q]=useState(null),[J,pe]=useState(null),[Be,ze]=useState(null),[it,nt]=useState({}),oe=3,ct=3,Re=useCallback(_=>{pe(_.id),R||q(_),v?.(_.id);},[R,v]),[yt,ft]=useState(null),pt=useCallback(()=>{ke(new Date(re.getFullYear(),re.getMonth()-1,1));},[re]),Te=useCallback(()=>{ke(new Date(re.getFullYear(),re.getMonth()+1,1));},[re]),Xe=useCallback(()=>{ke(new Date);},[]),ot=useMemo(()=>{let _=re.getFullYear(),ee=re.getMonth(),Ve=new Date(_,ee,1),ve=new Date(_,ee+1,0),Ue=Ve.getDay(),Se=ve.getDate(),He=ts(e),lt=new Date;lt.setHours(0,0,0,0);let st=[],dt=Ue,mt=new Date(_,ee,0).getDate();for(let z=dt-1;z>=0;z--){let fe=new Date(_,ee-1,mt-z);st.push({date:fe,isCurrentMonth:false,isToday:false,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ce=>_d(fe,Ce)).map(Ce=>({id:Ce.id,title:Ce.name,start:Ce.startDate,end:Ce.endDate,task:Ce}))});}for(let z=1;z<=Se;z++){let fe=new Date(_,ee,z),Ce=fe.getTime()===lt.getTime();st.push({date:fe,isCurrentMonth:true,isToday:Ce,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ke=>_d(fe,Ke)).map(Ke=>({id:Ke.id,title:Ke.name,start:Ke.startDate,end:Ke.endDate,task:Ke}))});}let It=42-st.length;for(let z=1;z<=It;z++){let fe=new Date(_,ee+1,z);st.push({date:fe,isCurrentMonth:false,isToday:false,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ce=>_d(fe,Ce)).map(Ce=>({id:Ce.id,title:Ce.name,start:Ce.startDate,end:Ce.endDate,task:Ce}))});}return st},[re,e]),Qe=useMemo(()=>ts(e).filter(_=>!_.startDate||!_.endDate),[e]),H=useMemo(()=>{let _=ts(e),ee=0,Ve=0,ve=0,Ue=0,Se=0;_.forEach(mt=>{mt.effortMinutes&&(ee+=mt.effortMinutes),mt.soldEffortMinutes&&(Ve+=mt.soldEffortMinutes),mt.scheduleVariance!=null&&(ve+=mt.scheduleVariance,Ue++),mt.soldEffortMinutes&&mt.effortMinutes&&(Se+=mt.soldEffortMinutes-mt.effortMinutes);});let He=Ve>0?Math.min(100,Math.round(ee/Ve*100)):0,lt=Ue>0?Math.round(ve/Ue):0,dt=`${Se<0?"-":"+"}${$g(Se,$,de)}`;return {budgetUtil:He,avgVariance:lt,costDisplay:dt,hasCostData:Ve>0}},[e,$,de]),se=useMemo(()=>{let _=[0,0,0,0,0,0];return ot.forEach((ee,Ve)=>{let ve=Math.floor(Ve/7);ee.events.forEach(Ue=>{if(Ue.task.startDate&&Ue.task.soldEffortMinutes){let Se=new Date(Ue.task.startDate),He=ee.date;Se.getFullYear()===He.getFullYear()&&Se.getMonth()===He.getMonth()&&Se.getDate()===He.getDate()&&ve<_.length&&(_[ve]-=Ue.task.soldEffortMinutes);}});}),_},[ot]),N=useMemo(()=>{let _=ts(e),ee=new Map,Ve=new Set,ve=[0,0,0,0,0,0];if(ot.length===0)return {segmentsByCell:ee,multiDayTaskIds:Ve,maxLanesPerRow:ve};let Ue=dt=>new Date(dt.getFullYear(),dt.getMonth(),dt.getDate()),Se=Ue(ot[0].date),He=Ue(ot[ot.length-1].date),lt=[];for(let dt of _){if(!dt.startDate||!dt.endDate)continue;let mt=Ue(dt.startDate),It=Ue(dt.endDate);if(mt.getTime()===It.getTime()||It<Se||mt>He)continue;let z=mt<Se?Se:mt,fe=It>He?He:It,Ce=Og(z,Se),Ke=Og(fe,Se);Ce<0||Ce>41||Ke<0||Ke>41||Ce!==Ke&&(Ve.add(dt.id),lt.push({task:dt,startIdx:Ce,endIdx:Ke}));}lt.sort((dt,mt)=>dt.startIdx!==mt.startIdx?dt.startIdx-mt.startIdx:mt.endIdx-mt.startIdx-(dt.endIdx-dt.startIdx));let st=[[],[],[],[],[],[]];for(let{task:dt,startIdx:mt,endIdx:It}of lt){let z=Math.floor(mt/7),fe=Math.floor(It/7),Ce=Ue(dt.startDate),Ke=Ue(dt.endDate),qe=false;for(let ge=z;ge<=fe;ge++){let te=ge===z?mt%7:0,V=ge===fe?It%7:6,me=V-te+1,Z=0,A=st[ge]??[];for(st[ge]||(st[ge]=A);Z<A.length&&(A[Z]??-1)>=te;)Z++;if(Z>=K1){qe=true;break}Z>=A.length?A.push(V):A[Z]=V,ve[ge]=Math.max(ve[ge]??0,Z+1);let j=ge===z&&Ce>=Se,ae=ge===fe&&Ke<=He,Ne=ge*7+te,Pe={taskId:dt.id,task:dt,rowIndex:ge,startCol:te,endCol:V,spanCols:me,lane:Z,isStart:j,isEnd:ae};ee.has(Ne)||ee.set(Ne,[]),ee.get(Ne).push(Pe);}qe&&(Ve.delete(dt.id),ee.forEach((ge,te)=>{let V=ge.filter(me=>me.taskId!==dt.id);V.length===0?ee.delete(te):ee.set(te,V);}));}return {segmentsByCell:ee,multiDayTaskIds:Ve,maxLanesPerRow:ve}},[ot,e]),Y=X$1==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=re.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),he=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:p("text-sm font-mono",W?"text-white/30":"text-gray-600"),children:[M.labels.noEvents,"..."]})]})}):s?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:p("w-12 h-12 rounded-full flex items-center justify-center",W?"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:p("text-lg font-semibold mb-2",W?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:p("text-sm",W?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:p("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",W?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:p("w-8 h-8",W?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:p("text-lg font-semibold mb-2",W?"text-white/90":"text-gray-900"),children:M.labels.noEvents}),jsx("p",{className:p("text-sm",W?"text-white/30":"text-gray-600"),children:M.labels.newTask})]})}):jsxs("div",{className:p("flex-1 flex flex-col w-full h-full overflow-hidden",W?"bg-[#050505]":"bg-white",n),style:d,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:p("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",W?"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:p("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",W?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:p("w-3.5 h-3.5",W?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:p("font-medium",W?"text-white":"text-gray-900"),children:X$1==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:p("h-4 w-px",W?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:pt,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",W?"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:p("text-sm font-semibold tracking-tight min-w-[150px] text-center",W?"text-white":"text-gray-900"),children:he}),jsx("button",{onClick:Te,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",W?"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:p("h-4 w-px",W?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:Xe,className:p("px-2.5 py-1 text-xs rounded-md transition-all font-medium",W?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:M.navigation.today})]})]}),jsx("div",{className:p("grid grid-cols-7 sticky top-0 z-10",W?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(_=>jsx("div",{className:p("py-2 text-center text-[10px] font-bold uppercase tracking-widest",W?"text-white/60 font-mono":"text-gray-500"),children:_},_))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:p("grid grid-cols-7 min-h-[800px]",W?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>pe(null),children:ot.map((_,ee)=>{let Ve=ee%7===6,ve=ee>=35;return jsxs("div",{className:p("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ve&&(W?"border-r border-[#222]":"border-r border-gray-200"),!ve&&(W?"border-b border-[#222]":"border-b border-gray-200"),W?_.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":_.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",_.isToday&&W&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",_.isToday&&!W&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:p("text-xs font-mono select-none relative z-20",_.isToday?W?"text-[#007FFF] font-bold":"text-blue-600 font-bold":_.isCurrentMonth?W?"text-white/60":"text-gray-900":W?"text-white/20":"text-gray-400"),children:String(_.date.getDate()).padStart(2,"0")}),(()=>{let Ue=Math.floor(ee/7),Se=(N.maxLanesPerRow[Ue]??0)*Hg,He=N.segmentsByCell.get(ee);return Se===0&&!He?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Se}px`,zIndex:5},children:He?.map(lt=>jsx(Y1,{segment:lt,isDark:W,blurFinancials:S,isSelected:J===lt.taskId,t:M,lens:$,hourlyRate:de,onClick:()=>{Re(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let Ue=_.events.filter(Se=>Se.task.isMilestone&&!N.multiDayTaskIds.has(Se.id));return Ue.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ue.slice(0,4).map(Se=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Se.title,onClick:He=>{He.stopPropagation(),Re(Se.task);}},Se.id)),Ue.length>4&&jsxs("span",{className:p("text-[8px] font-mono",W?"text-white/30":"text-gray-400"),children:["+",Ue.length-4]})]})})(),(()=>{let Ue=[];_.events.forEach(He=>{He.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&Ue.push({taskId:He.id,type:lt.type,severity:lt.severity,variance:He.task.scheduleVariance});});});let Se=Ue[0];return Se?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:p("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Se.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[M.labels.risk,": ",Se.type,Se.variance?` (+${Math.abs(Se.variance)}d ${M.labels.delay})`:""]})]})}):null})(),(()=>{let Ue=_.events.filter(st=>!N.multiDayTaskIds.has(st.id)),Se=it[ee]||oe,He=Ue.slice(0,Se),lt=Ue.length-Se;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[He.map(st=>jsxs(motion.button,{onClick:()=>{Re(st.task),a.onEventClick?.(st);},whileHover:{scale:1.01},className:p("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",st.task.progress===100||st.task.status==="completed"?W?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":W?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:W?st.task.progress===100||st.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:st.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:p("flex-shrink-0 text-[9px]",st.task.isMilestone?W?"text-amber-400":"text-amber-600":st.task.isCriticalPath?"text-red-400":W?"text-[#1264FF]":"text-gray-400"),children:st.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:st.title})]},st.id)),lt>0&&jsxs("button",{onClick:st=>{st.stopPropagation(),nt(dt=>({...dt,[ee]:Se+ct}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",W?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",X$1==="es"?"m\xE1s":"more"]}),Se>oe&&Ue.length>oe&&jsx("button",{onClick:st=>{st.stopPropagation(),nt(dt=>({...dt,[ee]:oe}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",W?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:X$1==="es"?"menos":"less"})]})})(),_.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ue=ee>=28,Se=ee%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:He=>{He.stopPropagation(),ft(yt===ee?null:ee);},className:p("w-5 h-5 rounded flex items-center justify-center transition-all",yt===ee?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",W?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:p("w-3.5 h-3.5 transition-transform",yt===ee&&"rotate-45")})}),jsx(AnimatePresence,{children:yt===ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ft(null)}),jsx(motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:p("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",Se?"right-0":"left-0",W?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Eo,{onSubmit:He=>{a.onTaskCreate?.({name:He.name,startDate:He.startDate||_.date,endDate:He.endDate||_.date,priority:He.priority,assignees:He.assignee?[He.assignee]:void 0}),ft(null);},onCancel:()=>ft(null),availableUsers:t.availableUsers,isDark:W,locale:X$1==="es"?"es":"en",defaultDate:_.date,dropdownDirection:Ue?"up":"down"})})]})})]})})()}),ee%7===6&&(()=>{let Ue=Math.floor(ee/7),Se=se[Ue];if(!Se||Se===0)return null;let He=$g(Se,$,de);return jsxs("div",{className:p("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Se<0?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:[M.labels.cashOut,": ",Se<0?"-":"+",He]})})()]},ee)})})})]}),_e&&jsxs("aside",{className:p("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",W?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:p("flex-shrink-0 h-14 flex items-center justify-between px-4",W?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",W?"text-white/40":"text-gray-500"),children:M.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:p("text-[10px] font-mono tabular-nums",W?"text-white/20":"text-gray-400"),children:Qe.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Qe.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:p("w-10 h-10 rounded-xl flex items-center justify-center mb-3",W?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:p("w-5 h-5",W?"text-white/20":"text-gray-400")})}),jsx("p",{className:p("text-xs font-mono",W?"text-white/20":"text-gray-400"),children:X$1==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Qe.map(_=>jsxs("button",{onClick:()=>{Re(_);},className:p("w-full text-left rounded-md p-3 transition-all group/card",W?"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:p("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",W?"bg-white/20":"bg-gray-300")}),jsx("span",{className:p("text-sm font-medium leading-snug line-clamp-2",W?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:_.name})]}),_.tags&&_.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[_.tags.slice(0,3).map(ee=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ee.color}15`,color:ee.color,border:`1px solid ${ee.color}30`},children:ee.name},ee.id)),_.tags.length>3&&jsxs("span",{className:p("text-[9px] font-mono px-1 py-0.5",W?"text-white/20":"text-gray-400"),children:["+",_.tags.length-3]})]}),(_.effortMinutes||_.soldEffortMinutes)&&jsxs("div",{className:p("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",W?"text-white/25":"text-gray-400",S&&"blur-sm select-none"),children:[jd(_.effortMinutes,$,de)&&jsxs("span",{children:[M.labels.estimate,": ",jd(_.effortMinutes,$,de)]}),(()=>{let ee=zg(_,$,de);return ee?jsx("span",{className:ee.isNegative?"text-red-400":"text-emerald-400",children:ee.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[_.priority&&jsx(Flag,{className:p("w-3 h-3",_.priority==="urgent"||_.priority==="high"?"text-red-400":_.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(Rg,{task:_,isDark:W})]}),_.assignees&&_.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:_.assignees.slice(0,2).map((ee,Ve)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:ee.color||"#007FFF"},title:ee.name,children:ee.initials||ee.name?.slice(0,2).toUpperCase()},Ve))})]})]},_.id))}),a.onTaskCreate&&jsx("div",{className:p("flex-shrink-0 px-3 py-2.5 border-t",W?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:M.labels.typeToAdd,className:p("w-full text-[11px] font-mono bg-transparent outline-none",W?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:_=>{_.key==="Enter"&&_.target.value.trim()&&(a.onTaskCreate?.({name:_.target.value.trim()}),_.target.value="");}})}),H.hasCostData&&jsxs("div",{className:p("flex-shrink-0 px-4 py-3 border-t space-y-2.5",W?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",W?"text-white/40":"text-gray-500"),children:["\u25C8 ",M.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:p("text-[10px] font-mono",W?"text-white/40":"text-gray-500"),children:M.labels.budgetUtil}),jsxs("span",{className:p("text-[10px] font-mono font-bold tabular-nums",W?"text-white/60":"text-gray-700",S&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:p("h-1.5 rounded-full overflow-hidden",W?"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:p("rounded-md px-2 py-1.5 text-center",W?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",W?"text-white/25":"text-gray-400"),children:M.labels.variance}),jsxs("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":W?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",M.labels.days]})]}),jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",W?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",W?"text-white/25":"text-gray-400"),children:M.labels.cost}),jsx("div",{className:p("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})]})]})]})]})]}),!R&&jsx(jr,{task:O,isOpen:!!O,onClose:()=>q(null),onTaskUpdate:_=>{a.onTaskUpdate?.(_),q(_);},theme:F==="dark"?"dark":"light",locale:X$1,availableUsers:t.availableUsers?.map(_=>({id:_.id,name:_.name,avatar:_.avatar,initials:_.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:O?u?.get(O.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ts(e).filter(_=>_.id!==O?.id),comments:l?.filter(_=>_.taskId===O?.id).map(_=>({..._,createdAt:_.createdAt instanceof Date?_.createdAt:new Date(_.createdAt),updatedAt:_.updatedAt instanceof Date?_.updatedAt:_.updatedAt?new Date(_.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:x,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:h,timeEntries:w,isTimerRunning:y?.isRunning,timerElapsedSeconds:y?.elapsedSeconds,onTimeLog:k,onEstimateUpdate:C,onSoldEffortUpdate:D,onTimerStart:T,onTimerStop:L,onTimerDiscard:B,blurFinancials:S}),jsx(AnimatePresence,{children:Be&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>ze(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:p("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",W?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between",W?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:p("font-medium text-sm",W?"text-white/90":"text-gray-900"),children:Be.date.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>ze(null),className:p("p-1 rounded",W?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Be.events.map(_=>jsxs("button",{onClick:()=>{ze(null),Re(_.task);},className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",W?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(Rg,{task:_.task,isDark:W}),jsx("span",{className:p("text-sm truncate flex-1",W?"text-white/80":"text-gray-900"),children:_.title}),(_.task.priority==="high"||_.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},_.id))})]})]})})]})}var Kd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Yd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},qd={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Bi={dark:Kd,light:Yd,neutral:qd};function Wg(e){return Bi[e]||Bi.dark}function X1({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[c,i]=useState(false),u=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),l=useMemo(()=>{let g=u.length,x=new Set(u.flatMap(f=>f.assignedUserIds||[])).size,b=u.map(f=>f.priority).filter(Boolean),v=new Set(u.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:x,priorities:b,labels:v}},[u]),m=()=>{o?.(e.id);};return jsxs("div",{className:p("card-stack",!e.isExpanded&&"card-stack-collapsed",d),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:p("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:l.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:[l.uniqueAssignees," assignees"]})]}),l.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:[l.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(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:x=>{x.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 Vg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rs(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 os(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 _g(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 jg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let c=useMemo(()=>({...Vg,...n}),[n]),[i,u]=useState(new Set),l=useRef(null),m=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(w=>{let y=w.timestamp.toISOString().split("T")[0],k=h.get(y);k?k.push(w):h.set(y,[w]);}),Array.from(h.entries()).sort((w,y)=>y[0].localeCompare(w[0])).map(([w,y])=>({date:new Date(w),events:y.sort((k,C)=>C.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:x}=useMemo(()=>{let h=new Set,w=new Set;return e.forEach(y=>{h.add(y.userId),w.add(y.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(w)}},[e]),b=h=>{u(w=>{let y=new Set(w);return y.has(h)?y.delete(h):y.add(h),y});},v=h=>{let y=new Date().getTime()-h.getTime(),k=Math.floor(y/6e4),C=Math.floor(y/36e5),D=Math.floor(y/864e5);return k<1?"just now":k<60?`${k}m ago`:C<24?`${C}h ago`:D<7?`${D}d ago`:h.toLocaleDateString()},f=useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:p("history-timeline-empty",d),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:p("history-timeline",c.compact&&"compact",d),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let w=h.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),x.map(h=>jsxs("option",{value:h,children:[os(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let w=h.target.value;a({...t,users:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:l,children:m.map(h=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((w,y)=>{let k=i.has(w.id),C=s===w.id,D=_g(w.type);return jsxs("div",{"data-event-id":w.id,className:p("history-timeline-event",k&&"expanded",C&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:os(w.type)})}),y<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:rs(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(w.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,L])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},T)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([T,L])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},T))]})]})]})]},w.id)})})]},h.date?.toISOString()||"all"))})]})}function Yg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],l=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:p("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:p("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:l&&os(l.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:l&&rs(l)}),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:l&&l.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>d(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,x)=>jsx("div",{className:p("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>d(x),title:rs(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:u.map(g=>jsxs("button",{className:p("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:l&&l.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:p("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 Xd(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function Jd(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function qg(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function Xg(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function a5(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})),d=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(u=>{let l=a/2,m=r/2;u.vx+=(l-u.x)*o.centerForce*i,u.vy+=(m-u.y)*o.centerForce*i,n.forEach(g=>{if(u.id===g.id)return;let x=u.x-g.x,b=u.y-g.y,v=Math.sqrt(x*x+b*b)||1,f=o.chargeStrength*i/(v*v);u.vx+=x/v*f,u.vy+=b/v*f;});}),t.forEach(u=>{let l=d.get(typeof u.source=="string"?u.source:u.source.id),m=d.get(typeof u.target=="string"?u.target:u.target.id);if(!l||!m)return;let g=m.x-l.x,x=m.y-l.y,b=Math.sqrt(g*g+x*x)||1,v=(b-o.linkDistance)/b*o.forceStrength*i;l.vx+=g*v,l.vy+=x*v,m.vx-=g*v,m.vy-=x*v;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function Jg({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:c}){let i=useRef(null),[u,l]=useState([]),[m,g]=useState(null),[x,b]=useState(null),[v,f]=useState(null),[h,w]=useState(1),[y,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let $=a5(e,t,a.width,a.height,a,150);l($);},[e,t,a]);let C=useCallback(($,de)=>{a.enableDragging&&(de.stopPropagation(),g($));},[a.enableDragging]),D=useCallback($=>{if(!m||!i.current)return;let F=i.current.getBoundingClientRect(),X=($.clientX-F.left-y.x)/h,xe=($.clientY-F.top-y.y)/h;l(_e=>_e.map(M=>M.id===m?{...M,x:X,y:xe,fx:X,fy:xe}:M));},[m,h,y]),T=useCallback(()=>{g(null);},[]),L=useCallback(($,de)=>{de.stopPropagation(),d?.({type:"node-click",node:$,position:{x:de.clientX,y:de.clientY}});},[d]),B=useCallback(($,de)=>{de.stopPropagation(),d?.({type:"edge-click",edge:$,position:{x:de.clientX,y:de.clientY}});},[d]),S=useCallback($=>{let de=u.find(F=>F.id===$);return de?{x:de.x,y:de.y}:{x:0,y:0}},[u]),R=useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let de=$.card.priority;return de==="URGENT"?"#ef4444":de==="HIGH"?"#f59e0b":de==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:p("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:p("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w($=>Math.min($+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w($=>Math.max($-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Xd($)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[qg($)," ",Jd($)]})]},$))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let de=S(typeof $.source=="string"?$.source:$.source.id),F=S(typeof $.target=="string"?$.target:$.target.id),X=Xg($.type),xe=v===$.id,_e=$.onCriticalPath;return jsxs("g",{className:p("relationships-graph-edge",xe&&"hovered",_e&&"critical"),onMouseEnter:()=>f($.id),onMouseLeave:()=>f(null),onClick:M=>B($,M),children:[jsx("line",{x1:de.x,y1:de.y,x2:F.x,y2:F.y,stroke:Xd($.type),strokeWidth:_e?a.edgeWidth*2:a.edgeWidth,strokeOpacity:xe?1:.6,markerEnd:X?"url(#arrowhead)":void 0}),a.showEdgeLabels&&xe&&jsx("text",{x:(de.x+F.x)/2,y:(de.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Jd($.type)})]},$.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map($=>{let de=x===$.id,F=$.onCriticalPath;return jsxs("g",{className:p("relationships-graph-node",de&&"hovered",F&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:X=>C($.id,X),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:X=>L($,X),children:[jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:R($),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:de?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.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 e0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[d,c]=useState(false),[i,u]=useState(null),[l,m]=useState(null),g=useRef(null),x=d||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let h=w=>{w.key==="Escape"&&!x&&b();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,x]);let b=()=>{x||(n(""),u(null),m(null),t());},v=async()=>{if(!(!s.trim()||x)){c(true),u(null),m(null);try{let h=await r(s.trim());m(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{l&&(a(l),b());};return e?jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:b,disabled:x,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:l?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!"})]}),l.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:l.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,w)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},w))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,w)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},w)),l.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.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:h=>n(h.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:x}),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((h,w)=>jsx("button",{onClick:()=>n(h),disabled:x,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:h},w))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:x&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:b,disabled:x,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"}),l?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:v,disabled:!s.trim()||x,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:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qd={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var o5={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},n5={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 s5(e,t,a){let r=Qd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ns(e){return `$${e.toFixed(4)}`}var Zd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=s5(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(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,m)=>l+m.cost,0),s=a.reduce((l,m)=>l+m.inputTokens,0),n=a.reduce((l,m)=>l+m.outputTokens,0),d=a.filter(l=>l.success),c=a.reduce((l,m)=>l+m.duration,0),i={},u={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,u[l.feature]=(u[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(u=>u.timestamp>=n).length,c=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:c,percentUsed:i,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$o=new Zd;function r0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState($o.getStats()),[s,n]=useState($o.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o($o.getStats()),n($o.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 d=$o.getRecentOperations(5);return jsxs(At,{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:ns(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 u=r.costsByFeature[c]||0,l=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:ns(u)})]})]}),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:`${l}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:d.map(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:ns(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 s0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=useState(""),[c,i]=useState(""),[u,l]=useState(""),[m,g]=useState(false),[x,b]=useState(null),[v,f]=useState(null),[h,w]=useState(null),y=useRef(null),k=m||o;useEffect(()=>{e&&y.current&&y.current.focus();},[e]),useEffect(()=>{let B=S=>{S.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[e,k]);let C=()=>{k||(d(""),i(""),l(""),b(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||k)){g(true),b(null),f(null),w(null);try{let B=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});f(B.tasks.tasks),w({from_cache:B.from_cache,tokens_used:B.tokens_used,mock_mode:B.mock_mode,similarity:B.similarity,tokens_saved:B.tokens_saved});}catch(B){b(B instanceof Error?B.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),C());};if(!e)return null;let L=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick: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("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:C,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.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"}),h?.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 (",L,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((B,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:B.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"})]}),B.start," \u2192 ",B.end]}),jsxs("span",{children:[B.duration," days"]}),B.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",B.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${B.priority==="high"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:B.priority})]})},B.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:y,value:n,onChange:B=>d(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:k}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:B=>i(B.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:k})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:B=>l(B.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:k})]})]}),x&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),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,S)=>jsx("button",{onClick:()=>d(B),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:B},S))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:C,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:D,disabled:!n.trim()||k,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:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function $i({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(v=>{t&&ws(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,h,w)=>{console.warn(`Retry attempt ${h} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(v,f,h)=>{r(w=>{let y=w.cards.find(B=>B.id===v);if(!y)return w;let k=y.columnId,C={...y,columnId:f,position:h},D=w.cards.map(B=>B.id===v?C:B),T=w.columns.map(B=>{if(B.id===k)return {...B,cardIds:B.cardIds.filter(S=>S!==v)};if(B.id===f){let S=D.filter(R=>R.columnId===f).sort((R,$)=>R.position-$.position);return {...B,cardIds:S.map(R=>R.id)}}return B}),L={...w,cards:D,columns:T};return o(L),L});},[o]),n=useCallback(async(v,f)=>{r(h=>{let w=h.cards.map(k=>k.id===v?{...k,...f}:k),y={...h,cards:w};return o(y),y});},[o]),d=useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let w={...v,id:f},y=h.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),k={...h,cards:[...h.cards,w],columns:y};return o(k),k});},[o]),c=useCallback(async v=>{r(f=>{let h=f.cards.find(C=>C.id===v);if(!h)return f;let w=f.cards.filter(C=>C.id!==v),y=f.columns.map(C=>C.id===h.columnId?{...C,cardIds:C.cardIds.filter(D=>D!==v)}:C),k={...f,cards:w,columns:y};return o(k),k});},[o]),i=useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let w={...v,id:f,cardIds:[]},y={...h,columns:[...h.columns,w]};return o(y),y});},[o]),u=useCallback(async(v,f)=>{r(h=>{let w=h.columns.map(k=>k.id===v?{...k,...f}:k),y={...h,columns:w};return o(y),y});},[o]),l=useCallback(async v=>{r(f=>{let h=f.cards.filter(k=>k.columnId!==v),w=f.columns.filter(k=>k.id!==v),y={...f,cards:h,columns:w};return o(y),y});},[o]),m=useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(v),f},[d]),g=useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),x=useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:l},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:l,clearBoard:x}}}function l0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=$i({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(l=>l.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:c,position:i??u+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 ss={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},c0={by:"none",order:"asc"};function u0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...ss,...e}),[s,n]=useState({...c0,...t}),d=useCallback(b=>{o(v=>({...v,...b}));},[]),c=useCallback(b=>{n(v=>({...v,...b}));},[]),i=useCallback(()=>{o(ss),n(c0);},[]),u=useCallback(()=>{a&&o({...ss,assignees:[a]});},[a]),l=useCallback(()=>{o({...ss,dateFilter:"overdue"});},[]),m=useCallback(()=>{o({...ss,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]),x=useCallback(b=>{let v=[...b];if(r.search){let f=r.search.toLowerCase();v=v.filter(h=>h.title.toLowerCase().includes(f)||h.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,h=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),y=String(f.getDate()).padStart(2,"0"),k=`${h}-${w}-${y}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let D=C.endDate||C.dueDate;if(!D)return false;let T;if(typeof D=="string")T=D.split("T")[0]||D;else {let L=D.getUTCFullYear(),B=String(D.getUTCMonth()+1).padStart(2,"0"),S=String(D.getUTCDate()).padStart(2,"0");T=`${L}-${B}-${S}`;}switch(r.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let L=new Date(k+"T00:00:00"),B=new Date(T+"T00:00:00"),S=new Date(L);return S.setDate(S.getDate()+7),B>=L&&B<=S;case "custom":if(r.dateRange){let R=typeof D=="string"?new Date(D):D;return R>=r.dateRange.start&&R<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,h)=>{let w=0;switch(s.by){case "created":let y=f.createdAt?new Date(f.createdAt).getTime():0,k=h.createdAt?new Date(h.createdAt).getTime():0;w=y-k;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=C[f.priority||"LOW"],T=C[h.priority||"LOW"];w=D-T;break;case "dueDate":let L=f.endDate||f.dueDate,B=h.endDate||h.dueDate;if(!L)return 1;if(!B)return -1;let S=typeof L=="string"?new Date(L).getTime():L.getTime(),R=typeof B=="string"?new Date(B).getTime():B.getTime();w=S-R;break;case "title":w=f.title.localeCompare(h.title);break;case "estimate":let $=f.estimatedTime||0,de=h.estimatedTime||0;w=$-de;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:l,filterHighPriority:m,applyFilters:x,hasActiveFilters:g}}var m0,g0;if(typeof window<"u")try{let e=ys("ai");m0=e.generateObject,g0=e.generateText;}catch{}function f0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(m0&&g0&&e.apiKey),n=useCallback(async l=>{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:",l),{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: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),d=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.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 l=>{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 l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),u=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function tc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function b0(e){let{cards:t}=e,[a,r]=tc(),o=useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=useCallback((l,m)=>{if(!m){r({selectedCardIds:[l],lastSelectedCardId:l});return}let g=m.ctrlKey||m.metaKey,x=m.shiftKey;if(g)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(x&&a.lastSelectedCardId){let b=t.find(f=>f.id===l),v=t.find(f=>f.id===a.lastSelectedCardId);if(b&&v&&b.columnId===v.columnId){let f=t.filter(T=>T.columnId===b.columnId).sort((T,L)=>T.position-L.position),h=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===l),[y,k]=h<w?[h,w]:[w,h],C=f.slice(y,k+1).map(T=>T.id),D=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:D,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),u=useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:c,toggleCard:i,getSelectedCards:u}}var h0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function y0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...h0,...a}),[a]),[s,n]=useState([]),d=useCallback((b,v,f,h,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let y={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:v,columnId:f,strategy:h,color:w,isExpanded:true,position:s.filter(k=>k.columnId===f).length,createdAt:new Date};n(k=>[...k,y]);},[o.minCardsPerStack,s]),c=useCallback(b=>{n(v=>v.filter(f=>f.id!==b));},[]),i=useCallback(b=>{n(v=>v.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),u=useCallback((b,v)=>{n(f=>f.map(h=>h.id===b&&!h.cardIds.includes(v)?{...h,cardIds:[...h.cardIds,v]}:h));},[]),l=useCallback((b,v)=>{n(f=>f.map(h=>{if(h.id===b){let w=h.cardIds.filter(y=>y!==v);return w.length<o.minCardsPerStack?null:{...h,cardIds:w}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),m=useCallback(b=>s.filter(v=>v.columnId===b).sort((v,f)=>v.position-f.position),[s]),g=useCallback(async b=>{let v=t.filter(k=>k.columnId===b);if(v.length<o.minCardsPerStack*2)return [];let f=[],h=new Map;v.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(C=>{h.has(C)||h.set(C,[]),h.get(C).push(k);});}),h.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:k.map(D=>D.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${C}"`,confidence:.85});});let w=new Map;v.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(C=>{w.has(C)||w.set(C,[]),w.get(C).push(k);});}),w.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:k.map(D=>D.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let y=new Map;if(v.forEach(k=>{k.priority&&(y.has(k.priority)||y.set(k.priority,[]),y.get(k.priority).push(k));}),y.forEach((k,C)=>{if(k.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${C} Priority`,cardIds:k.map(T=>T.id),columnId:b,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let k of v){let D=(await r.findSimilar(k,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let T=[k.id,...D.map(B=>B.card.id)],L=D.reduce((B,S)=>B+S.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:L});}}return f.filter(k=>k.confidence>=o.autoStackConfidenceThreshold).sort((k,C)=>C.confidence-k.confidence).slice(0,5)},[t,o,r]),x=useCallback(b=>{d(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[d]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),h=f[0];f.length>0&&h&&h.confidence>=.9&&x(h);});},[]),{stacks:s,createStack:d,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:l,getStacksForColumn:m,getSuggestions:g,applySuggestion:x,config:o}}var x0=createContext(null);function v0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=ys("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=ys("@libxai/core");n.set(c.id,new i(c));});let d=null;if(t?.board){let{Board:c}=ys("@libxai/core");d=new c(t.board);}r.current=new BoardStore({board:d,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(x0.Provider,{value:{store:o},children:e})}function Hi(){let e=useContext(x0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ls(){let e=Hi(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=useCallback(h=>{e.updateBoard(h);},[e]),c=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,w)=>{e.updateColumn(h,w);},[e]),u=useCallback(h=>{e.deleteColumn(h);},[e]),l=useCallback(h=>e.getColumn(h),[e]),m=useCallback(h=>{e.addCard(h);},[e]),g=useCallback((h,w)=>{e.updateCard(h,w);},[e]),x=useCallback(h=>{e.deleteCard(h);},[e]),b=useCallback((h,w,y)=>{e.moveCard(h,w,y);},[e]),v=useCallback(h=>e.getCard(h),[e]),f=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:l,addCard:m,updateCard:g,deleteCard:x,moveCard:b,getCard:v,getCardsByColumn:f}}function k0(e){let{cards:t}=ls();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 C0(e="position",t="asc"){let{cards:a}=ls();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?d[o.priority]:0,i=s.priority?d[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 zi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Wc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},C5=new zi;function N0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:c}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:m,className:o,children:jsx("div",{style:g,children:l.map(x=>{let b=e[x.index];if(!b)return null;let v=c?c(b,x.index):x.index,f={position:"absolute",top:n?0:x.start,left:n?x.start:0,width:n?x.size:"100%",height:n?"100%":x.size};return jsx("div",{style:f,"data-index":x.index,children:r(b,x.index)},v)})})})}function D0(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 E0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:c,horizontal:i=true}){let u=useRef(null),l=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:d}),m=l.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:g,className:s,children:jsx("div",{style:x,children:m.map(b=>{let v=e[b.index];if(!v)return null;let f=c?c(v,b.index):b.index,h={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsx("div",{style:h,"data-index":b.index,children:o(v,b.index)},f)})})})}function F0(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 P0(e,t=10){return e>t}var nc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},sc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ic={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},lc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},dc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},cc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},uc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},pc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},mc={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},gc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},fc={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},bc={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},Ui={spacing:nc,borderRadius:sc,fontSize:ic,fontWeight:lc,lineHeight:dc,zIndex:cc,duration:uc,easing:pc,shadows:mc,opacity:gc,kanban:fc,gantt:bc};function M0(e,t,a){return e[t]??a}function hc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?hc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function D5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function yc(e="asakaa"){let t=hc(Ui),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=D5(o);a.push(` ${s}: ${n};`);}return `:root {
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function pm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Qr(e,t){let a=pm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let c=d.name.toLowerCase();return n.every(i=>c.includes(i))})}function fd(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 x=new Date(r),b=x.getDay(),v=g-b;return v<=0&&(v+=7),x.setDate(x.getDate()+v),x}}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(),x=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?x.setDate(x.getDate()+m):g==="week"||g==="semana"||g==="semanas"?x.setDate(x.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&x.setMonth(x.getMonth()+m),x}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let m=parseInt(d[1],10),g=parseInt(d[2],10)-1,x=parseInt(d[3],10);return new Date(x,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()],x=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(x,g,m)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=u[l[1].toLowerCase()],g=parseInt(l[2],10),x=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(x,m,g)}return null}function bd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),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 mm(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 gm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),l=Qr(t,i),m=fd(u);if(!l)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:l.id,taskName:l.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,x=new Date(m);return x.setDate(x.getDate()+g),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:m,endDate:x},message:`Moved "${l.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(),u=o[2].trim(),l=Qr(t,i),m=bd(u);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(l.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:g},message:`Extended "${l.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(),u=s[2].trim(),l=Qr(t,i),m=hd(u);return l?m===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:m},message:`Set "${l.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(),u=n[2].trim(),l=Qr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:u},message:`Renamed "${l.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),u=d[2].trim(),l=Qr(t,i),m=Qr(t,u);return l?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:l.id,dependencyTo:m.id,message:`Linked "${l.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Qr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function fm(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 $v(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 Hv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function hi(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let l=a.find(m=>m.id===u);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>hi(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},d=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||d&&c&&Math.abs(c.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:c,progress:e.progress||0,status:$v(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 bm(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:Hv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function hm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>hi(r,e,t))}var yd={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:"Time Spent",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},xd={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:"Tiempo",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},yi={en:yd,es:xd};function vd(e){return yi[e]||yi.en}function xi(e,t){let a=vd(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-[#007BFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#32D74B]"}];function ym(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 xm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let g=x=>{d.current&&!d.current.contains(x.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=ym(e),i=wd[0],u=wd.find(g=>g.value===c)??i,l=u.icon,m=g=>{switch(ym(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(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsx(ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:p("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 x=g.icon;return jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:p("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(x,{className:p("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var kd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#007BFF]",bg:"bg-[#007BFF]"},{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),d=useRef(null);useEffect(()=>{let u=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let c=kd.find(u=>u.value===e)??kd[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:p("w-4 h-4",c.color)}),jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:p("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:p("w-4 h-4",c.color)}),jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsx(ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:p("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:kd.map(u=>jsxs("button",{onClick:l=>{l.stopPropagation(),t(u.value),n(false);},className:p("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===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:p("w-2 h-2 rounded-full",u.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function qn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Cd(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 Nm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=useState(false),[c,i]=useState(""),u=useRef(null),l=useRef(null);useEffect(()=>{let b=v=>{u.current&&!u.current.contains(v.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),useEffect(()=>{n&&l.current&&l.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),g=b=>e.some(v=>v.name===b),x=b=>{if(a){if(g(b.name))a(e.filter(v=>v.name!==b.name));else {let v={name:b.name,initials:qn(b.name),color:b.color||Cd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,v]);}d(false),i("");}};return s||!a?e.length===0?jsx("span",{className:p("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,v)=>jsx("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)},`${b.name}-${v}`)),e.length>3&&jsxs("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:b=>{b.stopPropagation(),d(!n);},className:p("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:p("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:p("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,v)=>jsx("div",{className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Cd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)},`${b.name}-${v}`)),e.length>2&&jsxs("span",{className:p("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:l,type:"text",value:c,onChange:b=>i(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,v)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(h=>h.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${b.name}-${v}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let v=g(b.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),x(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):qn(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),v&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function Em({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:c}){let[i,u]=useState(false),[l,m]=useState(o),[g,x]=useState(()=>{let D=o==="start"?e:t;if(D){let T=D instanceof Date?D:new Date(D);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let D=T=>{b.current&&!b.current.contains(T.target)&&u(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let h=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let D=g.getFullYear(),T=g.getMonth(),L=new Date(D,T,1),S=new Date(D,T+1,0).getDate(),R=L.getDay(),$=[],F=new Date(D,T,0).getDate();for(let xe=R-1;xe>=0;xe--)$.push({date:new Date(D,T-1,F-xe),isCurrentMonth:false});for(let xe=1;xe<=S;xe++)$.push({date:new Date(D,T,xe),isCurrentMonth:true});let X=42-$.length;for(let xe=1;xe<=X;xe++)$.push({date:new Date(D,T+1,xe),isCurrentMonth:false});return $},[g]),y=D=>{if(r)o==="start"?a(D,f||void 0):a(v||void 0,D),u(false);else if(l==="start"){let T=f&&D>f?D:f;a(D,T||void 0),m("end");}else {let T=v&&D<v?D:v;a(T||void 0,D),u(false);}},k=()=>{let D=new Date,T=new Date(D);T.setDate(D.getDate()+1);let L=new Date(D);L.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let B=new Date(D);B.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let S=new Date(D);S.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let R=new Date(D);R.setDate(D.getDate()+14);let $=new Date(D);return $.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:L,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:B,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:R,display:R.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:$,display:$.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let D=r&&o==="start"?v:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:h(D)})]})}let C=r&&o==="start"?v:f;return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{onClick:D=>{D.stopPropagation(),u(!i);let T=o==="start"?v:f;T&&x(new Date(T.getFullYear(),T.getMonth(),1));},className:p("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:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:h(C)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(false)}),jsxs("div",{className:p("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:D=>D.stopPropagation(),children:[jsxs("div",{className:p("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[k().map((D,T)=>jsxs("button",{className:p("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:()=>y(D.date),children:[jsx("span",{children:D.label}),jsx("span",{className:p("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},T)),jsx("div",{className:p("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),u(false);},className:p("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:p("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:l==="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:p("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:()=>x(new Date),className:p("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:()=>x(new Date(g.getFullYear(),g.getMonth()-1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>x(new Date(g.getFullYear(),g.getMonth()+1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:p("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(D=>jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,T)=>{let L=D.date.toDateString()===new Date().toDateString(),B=v?.toDateString()===D.date.toDateString(),S=f?.toDateString()===D.date.toDateString(),R=B||S,$=!r&&v&&f&&D.date>=v&&D.date<=f;return jsx("button",{onClick:()=>y(new Date(D.date)),className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),L&&"ring-2 ring-[#007BFF]",B&&"bg-[#007BFF] text-white",S&&!B&&"bg-[#7C3AED] text-white",$&&!R&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!R&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},T)})})]})]})]})]})}function ki({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Em,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:d||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function yn(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 Ci(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[d,c]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let l=i.current??0,m=e,g=m-l,x=r/o;c(true);for(let b=1;b<=o;b++){let v=setTimeout(()=>{let f=b/o,h=1-Math.pow(1-f,3),w=Math.round(l+g*h);n(w),b===o&&(c(false),n(m));},x*b);u.current.push(v);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function Fm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,d]=useState(0),c=useRef(null),i=useRef(null),u=useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),d(0);let x=Date.now();i.current=setInterval(()=>{let b=Date.now()-x,v=Math.min(b/a*100,100);d(v);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),d(0);},a);},[a,e]),l=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),d(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:u,cancelChange:l}}function Am({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=yn(),{displayValue:c,isAnimating:i}=Ci(e,{enabled:o,duration:300,steps:6}),u=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),x=m.clientX-g.left,b=Math.round(x/g.width*100),v=Math.max(0,Math.min(100,b));v!==e&&(t(v),s&&d());},l=c??e;return jsxs("div",{className:p("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#32D74B]/30":"bg-[#32D74B]/20")),children:[jsx("div",{onClick:u,className:p("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:p("h-full rounded-full transition-[width]",l===100?"bg-[#32D74B]":"bg-[#007BFF]",i&&"transition-none"),style:{width:`${l}%`}})}),jsxs("span",{className:p("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[l,"%"]})]})}function Bm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[d,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{d!==e&&t?.(d),n(false);},l=m=>{m.key==="Enter"?u():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:p("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:d,onChange:m=>c(m.target.value),onBlur:u,onKeyDown:l,onClick:m=>m.stopPropagation(),className:p("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:p("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 $m({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:c=true}){let[i,u]=useState(false),[l,m]=useState(e?.toString()||""),g=useRef(null),{isFlashing:x,triggerFlash:b}=yn(),{displayValue:v,isAnimating:f}=Ci(e,{enabled:d&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{m(e?.toString()||"");},[e]);let h=()=>{let y=parseFloat(l);if(!isNaN(y)){let k=y;o!==void 0&&(k=Math.max(o,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&b());}u(false);},w=y=>{y.key==="Enter"?h():y.key==="Escape"&&(m(e?.toString()||""),u(false));};return n||!t?jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsx("input",{ref:g,type:"number",value:l,onChange:y=>m(y.target.value),onBlur:h,onKeyDown:w,onClick:y=>y.stopPropagation(),min:o,max:s,className:p("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:y=>{y.stopPropagation(),u(true);},className:p("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),x&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Hm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=useState(false),c=useRef(null);return useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:p("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(),d(!n);},className:p("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:p("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:p("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:p("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:p("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),d(false);},className:p("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 Um({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:c,startChange:i,cancelChange:u}=Fm(t,{delay:s}),l=g=>{g.stopPropagation(),!r&&t&&(o?d?u():i(!e):t(!e));},m=d?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:l,disabled:r||!t,className:p("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&m&&"ring-green-500/50",d&&!m&&"ring-red-500/50",d&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[d&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),d?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),d&&jsx("button",{onClick:g=>{g.stopPropagation(),u();},className:p("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 Vm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:p("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:p("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 w2(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 k2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),c=parseInt(a[2],10);return d*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(d*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 Ro({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false,lens:c="hours",hourlyRate:i=0}){let[u,l]=useState(false),[m,g]=useState(""),x=useRef(null),{isFlashing:b,triggerFlash:v}=yn(),f=c==="financial"&&i>0,h=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:w2(e,r);useEffect(()=>{u&&x.current&&(x.current.focus(),x.current.select());},[u]),useEffect(()=>{if(e){let C=Math.floor(e/60),D=e%60;C>0&&D>0?g(`${C}h ${D}m`):C>0?g(`${C}h`):g(`${D}m`);}else g("");},[e,u]);let w=()=>{let C=k2(m);C!==e&&(t?.(C),n&&v()),l(false);},y=C=>{C.key==="Enter"?w():C.key==="Escape"&&l(false);};if(d)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:p("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 k=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(k,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:h})]}):u?jsx("input",{ref:x,type:"text",value:m,onChange:C=>g(C.target.value),onBlur:w,onKeyDown:y,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:C=>{C.stopPropagation(),l(true);},className:p("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(k,{className:p("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:h})]})}function Ym({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsx("span",{className:p("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let d=o==="es";return a===0?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#007BFF"},children:d?"En Tiempo":"On Track"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#32D74B"},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF453A"},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:p("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function qm({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:d,lens:c="hours",hourlyRate:i=0}){let u=a==="es",l=c==="financial"&&i>0,m=M=>l?`$${Math.round(M*i).toLocaleString("en-US")}`:`${M}h`,[g,x]=useState(false),[b,v]=useState(false),[f,h]=useState(null),w=useRef(null),y=e.timeLoggedMinutes||0,k=e.effortMinutes||0,C=e.soldEffortMinutes||0,D=Math.round(y/60*10)/10,T=Math.round(k/60*10)/10,L=Math.round(C/60*10)/10,B=k>0?y/k*100:0,S=B>100?Math.round((y-k)/60*10)/10:0,R=B>100?"#FF453A":B>=80?"#FFD60A":"#32D74B";useEffect(()=>{if(!b&&!f)return;let M=W=>{w.current&&!w.current.contains(W.target)&&(v(false),h(null));};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[b,f]);let $=M=>{if(M.stopPropagation(),r&&!o&&!s){h("log");return}if(r||o||s){v(W=>!W),h(null);return}d&&d(e);},de=M=>{v(false),h(M);},F=async(M,W)=>{f==="log"&&r&&M?r(e,M,W):f==="estimate"&&o?o(e,M):f==="quoted"&&s&&s(e,M),h(null);},X=r||o||s||d,xe=[{mode:"log",icon:Clock,label:u?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:u?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:u?"T. Ofertado":"Quoted time",show:!!s}].filter(M=>M.show),_e=f==="estimate"?k:f==="quoted"?C:void 0;return k===0&&y===0&&C===0?jsxs("div",{ref:w,className:"relative flex items-center gap-2",onClick:M=>M.stopPropagation(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),children:[jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&X&&jsx("button",{onClick:$,className:"px-2 py-0.5 rounded-full text-[9px] font-mono uppercase bg-[#007BFF]/15 text-[#007BFF] hover:bg-[#007BFF]/25 transition-colors",children:u?"Tiempo":"Time"}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:xe.map(M=>jsxs("button",{onClick:W=>{W.stopPropagation(),de(M.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.mode))})}),jsx(AnimatePresence,{children:f&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:_e||void 0,onSave:F,onClose:()=>h(null)})})})})]}):jsxs("div",{ref:w,className:"relative flex items-center gap-2 w-full",onClick:M=>M.stopPropagation(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:m(D)}),k>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),S>0&&jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF453A"},children:["+",m(S)," ",u?"Exceso":"Over"]})]}),k>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(B,100)}%`,backgroundColor:R,borderRadius:2,transition:"width 0.3s"}})}),C>0&&(s||n)&&jsxs("div",{className:"flex items-center gap-1",style:{marginTop:1},children:[jsxs("span",{className:"font-mono",style:{fontSize:9,color:t?"rgba(255,255,255,0.25)":"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:[u?"Ofertado":"Quoted",":"]}),jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(L)})]})]}),X&&jsxs("button",{onClick:$,className:"flex-shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors",style:{border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB",color:t?"rgba(255,255,255,0.7)":"#374151"},children:[jsx(Plus,{className:"w-3 h-3"}),u?"Tiempo":"Time"]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:xe.map(M=>jsxs("button",{onClick:W=>{W.stopPropagation(),de(M.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(M.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),M.label]},M.mode))})}),jsx(AnimatePresence,{children:f&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:_e||void 0,onSave:F,onClose:()=>h(null)})})})})]})}function Xm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF453A]/15 text-[#FF453A]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#32D74B]/15 text-[#32D74B]";return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsx("img",{src:a.avatar,alt:a.name,className:p("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsx("div",{className:p("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsx("span",{className:p("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var F2={critical:"bg-[#FF453A]/15 text-[#FF453A]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#007BFF]/15 text-[#007BFF]"};function Qm({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:p("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:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",F2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function K2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Y2(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 ag({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:l,onReportBlocker:m,onCopyTaskLink:g}){let x=useRef(null),b=r==="es"?eg.es:eg.en;if(useEffect(()=>{let y=C=>{x.current&&!x.current.contains(C.target)&&t();},k=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),d&&(y.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),u.length>0&&y.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:k.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],T=C.some(L=>L.name===k.name)?C.filter(L=>L.name!==k.name):[...C,{name:k.name,initials:K2(k.name),color:k.color||Y2(k.name),avatar:k.avatarUrl}];d({...e.task,assignees:T}),t();}}))})),l&&y.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{l(e.task),t();}}),m&&y.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&y.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},f=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.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"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),y},h=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:x,style:w,className:p("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:h.map(y=>y.separator?jsx("div",{className:p("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},y.id):y.submenu?jsx(q2,{item:y,isDark:a},y.id):jsxs("button",{onClick:y.onClick,className:p("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",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:p(y.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function q2({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:p("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:p("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:p("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxs("button",{onClick:d.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var eg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var cg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},p1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function pg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[c,i]=useState(""),[u,l]=useState(null),m=useRef(null),g=d==="es"?ug.es:ug.en;if(useLayoutEffect(()=>{if(!e||!m.current)return;let y=()=>{if(!m.current)return;let k=m.current.getBoundingClientRect(),D=window.innerHeight-k.top-20;l(Math.max(300,D));};return requestAnimationFrame(y),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[e]),useEffect(()=>{if(!e)return;let y=setTimeout(()=>{let k=D=>{m.current&&!m.current.contains(D.target)&&t();},C=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",C),m._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(y),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let x=y=>g.columns[y]||y,b=y=>{if(y==="name")return;let k=a.map(C=>C.id===y?{...C,visible:!C.visible}:C);o(k);},v=(y,k)=>{let C=a.find(T=>T.type===y&&(!k||T.customFieldId===k));if(C){b(C.id);return}let D={id:k||y,type:y,label:k?r.find(T=>T.id===k)?.name||y:x(y),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};o([...a,D]);},f=p1.filter(y=>x(y).toLowerCase().includes(c.toLowerCase())),h=r.filter(y=>y.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:m,style:{...u?{maxHeight:`${u}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",y.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:y=>{y.currentTarget.style.backgroundColor="transparent",y.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:y=>i(y.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:y=>{y&&y.style.setProperty("--focus-border",w);},onFocus:y=>{y.currentTarget.style.borderColor=w,y.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:y=>{y.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",y.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:y=>y.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(y=>{let k=a.find(T=>T.type===y&&!T.customFieldId),C=k?.visible??false,D=y==="name";return jsxs("button",{onClick:()=>{D||(k?b(k.id):v(y));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:T=>{D||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cg[y]}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:x(y)})]},y)})})]}),h.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:h.map(y=>{let C=a.find(D=>D.customFieldId===y.id)?.visible??false;return jsxs("button",{onClick:()=>v(y.type,y.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cg[y.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y.name})]},y.id)})})]})]})]})}var ug={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var w1=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function fg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[d,c]=useState("text"),[i,u]=useState([""]),l=o==="es"?gg.es:gg.en;useEffect(()=>{e&&(n(""),c("text"),u([""]));},[e]),useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:d};d==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{u([...i,""]);},x=(v,f)=>{let h=[...i];h[v]=f,u(h);},b=v=>{i.length>1&&u(i.filter((f,h)=>h!==v));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:p("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:p("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:p("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsx("button",{onClick:t,className:p("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:p("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:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:l.fieldNamePlaceholder,className:p("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:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:w1.map(v=>jsxs("button",{onClick:()=>c(v.type),className:p("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsx("span",{className:p("text-xs",d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:l.types[v.type]})]},v.type))})]}),d==="dropdown"&&jsxs("div",{children:[jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:v,onChange:h=>x(f,h.target.value),placeholder:`${l.option} ${f+1}`,className:p("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:()=>b(f),className:p("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:p("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"}),l.addOption]})]})]})]}),jsxs("div",{className:p("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:p("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:l.cancel}),jsx("button",{onClick:m,disabled:!s.trim(),className:p("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:l.create})]})]})]}):null}var gg={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 yg={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 xg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=useState(false),c=useRef(null),i=useRef(0),u=s==="es"?yg.es:yg.en;useEffect(()=>{if(!n)return;let g=b=>{Date.now()-i.current<100||c.current&&!c.current.contains(b.target)&&d(false);},x=b=>{b.key==="Escape"&&d(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",x);}},[n]);let l=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:u.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()),d(x=>!x);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-[#222] hover:bg-white/[0.05] text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#007BFF]/20 border-[#007BFF]/50 text-[#007BFF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,m&&jsx("span",{className:p("w-2 h-2 rounded-full",o?"bg-[#007BFF]":"bg-blue-500")})]}),n&&jsxs("div",{className:p("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:p("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:p("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:l.map(g=>{let x=e===g.value&&!t,b=()=>g.value==="all"?x?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),d(false);},className:p("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",x&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:p(x?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),x&&jsx(Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:p("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),d(false);},className:p("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:p("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:p("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 wg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxs("div",{className:p("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:p("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:p("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:p("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,d=n>0?Math.min(Math.round(s/n*100),100):0,c=s>n&&n>0,i=c?"#FF453A":d>=80?"#FFD60A":"#32D74B";return jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:p("text-[11px] font-mono font-bold",c?"text-[#FF453A]":t?"text-white/80":"text-gray-800"),children:vg(s)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:p("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:vg(n)})]}),n>0&&jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:p("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF453A]/15 text-[#FF453A]":"bg-[#32D74B]/15 text-[#32D74B]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:p("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#32D74B]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,d=s<0,c=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:p("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#32D74B]/15 text-[#32D74B]",d&&"bg-[#FF453A]/15 text-[#FF453A]",!n&&!d&&"bg-[#007BFF]/15 text-[#007BFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let d=s.utilizationPercent>=100?"#FF453A":s.utilizationPercent>=80?"#FFD60A":s.color||"#32D74B";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxs("span",{className:p("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${s.name}-${n}`)})})]})]})}var R1=[{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 Dg(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(...Dg(r.subtasks,t+1));return a}function O1(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 u=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(u<=0)continue;let l=(s.progress||0)/u;r+=l,o++;}return o>0?r/o:null}function $1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function $d(e){if(!e.subtasks?.length)return {spent:0,allocated:0};let t=0,a=0;for(let r of e.subtasks)if(t+=r.timeLoggedMinutes??0,a+=r.effortMinutes??0,r.subtasks?.length){let o=$d(r);t+=o.spent,a+=o.allocated;}return {spent:t,allocated:a}}function Fi(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 Sg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:c=[],toolbarRightContent:i}){let{theme:u="dark",locale:l="en",customTranslations:m,showSearch:g=true,showHierarchy:x=true,tableColumns:b,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:h=true,showCreateTaskButton:w=false,onCreateTask:y,persistFilter:k=false,financialBlur:C,healthSidebar:D,lens:T="hours",hourlyRate:L=0,aggregateParentHours:B=false}=t,S=xi(l,m),R=u==="dark",$=useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let z=localStorage.getItem(k);if(z){let fe=JSON.parse(z);return {statusFilter:fe.statusFilter||"all",hideCompleted:fe.hideCompleted||!1}}}catch(z){console.error("Error loading persisted filter:",z);}return {statusFilter:"all",hideCompleted:false}},[k]),de=useMemo(()=>{function z(fe){let we=0,Ke=0;for(let qe of fe)if(qe.subtasks&&qe.subtasks.length>0){let ge=z(qe.subtasks);we+=ge.spent,Ke+=ge.allocated;}else we+=qe.timeLoggedMinutes??0,Ke+=qe.effortMinutes??0;return {spent:we,allocated:Ke}}return z(e)},[e]),F=useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:de.spent,totalHoursAllocatedMinutes:de.allocated}},[D,de]),[X,xe]=useState(true),[_e,M]=useState("position"),[W,re]=useState("asc"),[Ce,O]=useState(""),[q,J]=useState(()=>$().statusFilter),[pe,Be]=useState(()=>$().hideCompleted),[ze,it]=useState(b||R1),[nt,oe]=useState(false),[ct,Re]=useState(false),[yt,ft]=useState({isOpen:false,x:0,y:0,type:"task"}),[pt,Te]=useState(null),[Xe,ot]=useState(0),[Qe,H]=useState(0),se=useRef(null);useEffect(()=>{b&&it(b);},[b]),useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:q,hideCompleted:pe}));}catch(z){console.error("Error persisting filter state:",z);}},[k,q,pe]);let N=useMemo(()=>{let z=new Set;function fe(we){for(let Ke of we)Ke.subtasks?.length&&(Ke.isExpanded!==false&&z.add(Ke.id),fe(Ke.subtasks));}return fe(e),z},[e]),Y=useMemo(()=>ze.filter(z=>z.visible),[ze]),ie=useCallback(z=>{a.onTaskToggleExpand?.(z);},[a]),he=useCallback(z=>{_e===z?re(fe=>fe==="asc"?"desc":"asc"):(M(z),re("asc")),a.onSortChange?.({column:z,direction:W==="asc"?"desc":"asc"});},[_e,W,a]),_=useCallback(z=>{it(z),a.onColumnsChange?.(z);},[a]),ee=useCallback(z=>{let fe=ze.map(we=>we.id===z?{...we,visible:false}:we);_(fe);},[ze,_]),Ve=useCallback((z,fe)=>{M(z),re(fe);},[]),ve=useCallback((z,fe,we)=>{h&&(z.preventDefault(),ft({isOpen:true,x:z.clientX,y:z.clientY,type:fe?"task":"header",task:fe,columnId:we}));},[h]),Ue=useCallback(()=>{ft(z=>({...z,isOpen:false}));},[]),Se=useCallback((z,fe)=>{if(!f)return;z.preventDefault(),z.stopPropagation();let we=ze.find(Ke=>Ke.id===fe);we&&(Te(fe),ot(z.clientX),H(we.width));},[ze,f]);useEffect(()=>{if(!pt)return;let z=we=>{let Ke=we.clientX-Xe,qe=Math.max(50,Qe+Ke),ge=ze.map(te=>te.id===pt?{...te,width:qe}:te);it(ge);},fe=()=>{pt&&a.onColumnsChange?.(ze),Te(null);};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",fe),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",fe);}},[pt,Xe,Qe,ze,a]);let He=useCallback(async z=>{if(a.onCreateCustomField){let fe={...z,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(fe);}Re(false);},[a]),lt=useCallback(z=>z.progress===100||z.status==="completed"?"completed":z.progress&&z.progress>0||z.status==="in-progress"?"in-progress":"todo",[]),st=useMemo(()=>{let z=Dg(e);if(Ce.trim()){let fe=Ce.toLowerCase();z=z.filter(we=>we.name.toLowerCase().includes(fe));}return q!=="all"&&(z=z.filter(fe=>lt(fe)===q)),pe&&(z=z.filter(fe=>lt(fe)!=="completed")),z.sort((fe,we)=>{let Ke,qe;switch(_e){case "name":Ke=fe.name.toLowerCase(),qe=we.name.toLowerCase();break;case "startDate":Ke=fe.startDate?.getTime()||0,qe=we.startDate?.getTime()||0;break;case "endDate":Ke=fe.endDate?.getTime()||0,qe=we.endDate?.getTime()||0;break;case "progress":Ke=fe.progress||0,qe=we.progress||0;break;case "status":Ke=fe.status||"todo",qe=we.status||"todo";break;case "priority":let ge={urgent:0,high:1,medium:2,low:3,none:4};Ke=ge[fe.priority]??4,qe=ge[we.priority]??4;break;case "position":Ke=fe.position??0,qe=we.position??0;break;default:return 0}return Ke<qe?W==="asc"?-1:1:Ke>qe?W==="asc"?1:-1:0}),z},[e,Ce,q,pe,_e,W,lt]),dt=useCallback((z,fe)=>{let we=ge=>{a.onTaskUpdate?.({...z,...ge});},Ke=ge=>ge?z.customFields?.find(V=>V.fieldId===ge)?.value:void 0,qe=(ge,te)=>{if(!ge)return;let me=[...z.customFields||[]],Z=me.findIndex(A=>A.fieldId===ge);Z>=0?me[Z]={fieldId:ge,value:te}:me.push({fieldId:ge,value:te}),we({customFields:me});};switch(fe.type){case "name":return null;case "status":return jsx(xm,{value:z.status||(z.progress===100?"completed":z.progress&&z.progress>0?"in-progress":"todo"),onChange:te=>{we({status:te,progress:te==="completed"?100:te==="in-progress"?50:0});},isDark:R,locale:l,translations:S.status});case "priority":return jsx(wm,{value:z.priority,onChange:te=>we({priority:te}),isDark:R,locale:l});case "assignees":return jsx(Nm,{value:z.assignees||[],availableUsers:d,onChange:te=>we({assignees:te}),isDark:R,locale:l});case "startDate":return jsx(ki,{value:z.startDate,onChange:te=>we({startDate:te}),isDark:R,locale:l,dateField:"start",startDate:z.startDate,endDate:z.endDate});case "endDate":return jsx(ki,{value:z.endDate,onChange:te=>we({endDate:te}),isDark:R,locale:l,dateField:"end",startDate:z.startDate,endDate:z.endDate});case "progress":return jsx(Am,{value:z.progress||0,onChange:te=>{let V=te===100?"completed":te>0?"in-progress":"todo";we({progress:te,status:V});},isDark:R});case "tags":return jsx(Vm,{value:z.tags||[],isDark:R});case "text":return jsx(Bm,{value:Ke(fe.customFieldId)||"",onChange:te=>qe(fe.customFieldId,te),isDark:R});case "number":return jsx($m,{value:Ke(fe.customFieldId)||0,onChange:te=>qe(fe.customFieldId,te),isDark:R});case "date":let ge=Ke(fe.customFieldId);return jsx(ki,{value:ge?new Date(ge):void 0,onChange:te=>qe(fe.customFieldId,te),isDark:R,locale:l});case "dropdown":return jsx(Hm,{value:Ke(fe.customFieldId)||"",options:fe.options||[],onChange:te=>qe(fe.customFieldId,te),isDark:R});case "checkbox":return jsx(Um,{value:Ke(fe.customFieldId)||false,onChange:te=>qe(fe.customFieldId,te),isDark:R});case "estimatedTime":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.estimatedTime,onChange:V=>we({estimatedTime:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:L})}case "quotedTime":{let te=z.status==="completed"||z.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsx(Ro,{value:z.quotedTime,onChange:me=>we({quotedTime:me}),isDark:R,locale:l,disabled:te,isBlurred:V,lens:T,hourlyRate:L})}case "elapsedTime":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.elapsedTime,onChange:V=>we({elapsedTime:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:L})}case "effortMinutes":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.effortMinutes,onChange:V=>we({effortMinutes:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:L})}case "timeLoggedMinutes":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.timeLoggedMinutes,onChange:a.onLogTime?V=>{a.onLogTime?.(z,V);}:void 0,isDark:R,locale:l,placeholder:l==="es"?"Agregar":"Add",disabled:te,lens:T,hourlyRate:L})}case "soldEffortMinutes":{let te=z.status==="completed"||z.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsx(Ro,{value:z.soldEffortMinutes,onChange:me=>we({soldEffortMinutes:me}),isDark:R,locale:l,disabled:te,isBlurred:V,lens:T,hourlyRate:L})}case "scheduleVariance":return jsx(Ym,{startDate:z.startDate,endDate:z.endDate,scheduleVariance:z.scheduleVariance,isDark:R,locale:l});case "hoursBar":{if(B&&z.hasChildren){let{spent:te,allocated:V}=$d(z),me=te>V&&V>0;return jsxs("span",{className:p("text-[11px] font-mono",R?"text-white/50":"text-gray-500"),children:[jsx("span",{className:p("font-bold",me?"text-[#FF453A]":R?"text-white/80":"text-gray-800"),children:Fi(te)})," / ",jsx("span",{className:R?"text-white/60":"text-gray-600",children:Fi(V)})]})}return jsx(qm,{task:z,isDark:R,locale:l,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:L})}case "teamLoad":return jsx(Xm,{task:z,isDark:R});case "blockers":return jsx(Qm,{blockers:z.blockers,isDark:R,locale:l});default:return jsx("span",{className:p("text-sm",R?"text-white/60":"text-gray-500"),children:"-"})}},[a,R,l,d,S,B]),mt=useCallback(z=>{let we={name:S.columns.name,status:S.columns.status,priority:S.columns.priority,assignees:S.columns.assignees,startDate:S.columns.startDate,endDate:S.columns.endDate,progress:S.columns.progress,tags:S.columns.tags||(l==="es"?"Etiquetas":"Tags"),estimatedTime:S.columns.estimatedTime||(l==="es"?"Estimado":"Estimated"),quotedTime:S.columns.quotedTime||(l==="es"?"Ofertado":"Quoted"),elapsedTime:S.columns.elapsedTime||(l==="es"?"Tiempo":"Time Spent"),effortMinutes:S.columns.effortMinutes||(l==="es"?"Estimado":"Estimated"),timeLoggedMinutes:S.columns.timeLoggedMinutes||(l==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:S.columns.soldEffortMinutes||(l==="es"?"Ofertado":"Quoted"),scheduleVariance:S.columns.scheduleVariance||(l==="es"?"Prog / Var":"Sched / Var"),hoursBar:S.columns.hoursBar||(l==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:S.columns.teamLoad||(l==="es"?"Carga Equipo":"Team Load"),blockers:S.columns.blockers||(l==="es"?"Bloqueantes":"Blockers")}[z.type]||z.label;return typeof we=="string"?we:String(we||z.type)},[S,l]),It=useMemo(()=>{let we=Y.reduce((qe,ge)=>qe+ge.width,0)+(v?48:0),Ke={};for(let qe of Y)Ke[qe.id]=`${qe.width/we*100}%`;return Ke},[Y,v]);return r?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"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:p("text-sm",R?"text-white/60":"text-gray-600"),children:[S.empty.noTasks,"..."]})]})}):o?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"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:p("text-lg font-semibold mb-2",R?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"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:p("text-lg font-semibold mb-2",R?"text-white":"text-gray-900"),children:S.empty.noTasks}),jsx("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:S.empty.addFirstTask})]})}):jsxs("div",{ref:se,className:p(R?"bg-[#0D0D0D]":"bg-white",pt&&"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:p("flex-shrink-0 px-6 py-4 border-b",R?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(xg,{value:q,hideCompleted:pe,onChange:J,onHideCompletedChange:Be,isDark:R,locale:l}),jsxs("div",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:[st.length," ",S.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:p("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",R?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Ce,onChange:z=>O(z.target.value),placeholder:S.toolbar.searchPlaceholder,className:p("w-full h-9 pl-10 pr-4 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 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}),F?.enabled&&F.data&&!X&&jsx("button",{onClick:()=>xe(true),className:p("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",R?"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:l==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),w&&y&&jsxs(motion.button,{onClick:y,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:S.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:p("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",R?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Y.map(z=>jsxs("div",{className:p("relative flex items-center gap-2 px-4 py-2",R?"text-white/60":"text-gray-500"),style:{width:It[z.id],minWidth:z.minWidth},onContextMenu:fe=>ve(fe,void 0,z.id),children:[z.sortable?jsxs("button",{onClick:()=>he(z.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[mt(z),jsx(ArrowUpDown,{className:p("w-3 h-3",_e===z.id&&"text-[#007BFF]")})]}):jsx("span",{children:mt(z)}),f&&z.resizable&&jsx("div",{className:p("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",pt===z.id&&"bg-[#007BFF]"),onMouseDown:fe=>Se(fe,z.id)})]},z.id)),v&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:z=>{z.stopPropagation(),oe(fe=>!fe);},className:p("p-0.5 rounded transition-colors",R?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",nt&&(R?"bg-white/[0.05]":"bg-gray-200")),title:l==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(pg,{isOpen:nt,onClose:()=>oe(false),columns:ze,customFields:c,onColumnsChange:_,onCreateCustomField:()=>{oe(false),Re(true);},isDark:R,locale:l})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:st.map((z,fe)=>{let we=N.has(z.id),Ke=Math.min(fe*.01,.2),qe=z.hasChildren&&z.level===0,ge=z.subtasks?.length||0;return qe?jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ke},className:p("flex items-center border-y cursor-pointer",R?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>ie(z.id),children:jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 w-full",children:[jsx("button",{onClick:te=>{te.stopPropagation(),ie(z.id);},className:p("p-0.5 rounded flex-shrink-0",R?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:we?jsx(ChevronDown,{className:p("w-4 h-4",R?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:p("w-4 h-4",R?"text-white/40":"text-gray-500")})}),we?jsx(FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"}}),z.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"},children:z.wbsCode}),jsx("span",{className:p("text-[10px] font-semibold font-mono uppercase tracking-wide truncate",R?"text-gray-200":"text-gray-800"),children:z.name}),jsxs("span",{className:p("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",R?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ge," ",l==="es"?ge===1?"Tarea":"Tareas":ge===1?"Item":"Items",")"]}),jsx("div",{className:"flex-1"}),(()=>{let te=O1(z),V=$1(z),{spent:me,allocated:Z}=$d(z),A=me>0||Z>0,j=me>Z&&Z>0;return jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[A&&jsxs("span",{className:p("text-[10px] font-mono",R?"text-white/50":"text-gray-500"),children:["Total:"," ",jsx("span",{className:p("font-bold",j?"text-[#FF453A]":R?"text-white/80":"text-gray-800"),children:Fi(me)})," / ",jsx("span",{className:R?"text-white/60":"text-gray-600",children:Fi(Z)})]}),te!==null&&jsxs("span",{className:p("text-[10px] font-mono",te>=1?"text-[#32D74B]":te>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",te.toFixed(2)]}),V>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A]",children:[l==="es"?"Conflicto Recurso":"Resource Conflict",": ",V]}),z.progress!=null&&z.progress>0&&jsxs("span",{className:p("text-[10px] font-mono",z.progress===100?"text-[#32D74B]":"text-[#007BFF]"),children:[z.progress,"%"]})]})})()]})},z.id):jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ke},className:p("flex items-center border-b transition-colors",R?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(z),onDoubleClick:()=>a.onTaskDoubleClick?.(z),onContextMenu:te=>ve(te,z),children:[Y.map(te=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:It[te.id],minWidth:te.minWidth},children:te.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[x&&z.level>0&&jsx("div",{style:{width:`${z.level*24}px`},className:"flex-shrink-0"}),x&&z.hasChildren&&jsx("button",{onClick:V=>{V.stopPropagation(),ie(z.id);},className:p("p-0.5 rounded flex-shrink-0",R?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:we?jsx(ChevronDown,{className:p("w-4 h-4",R?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:p("w-4 h-4",R?"text-white/60":"text-gray-400")})}),x&&!z.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(z.wbsCode||z.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[z.wbsCode&&jsx("span",{className:p("text-[10px] font-mono",R?"text-[#007BFF]":"text-blue-600"),children:z.wbsCode}),z.taskCode&&jsx("span",{className:p("text-[10px] font-mono",R?"text-white/40":"text-gray-400"),children:z.taskCode})]}),jsx("span",{className:p("truncate font-bold text-[13px]",R?"text-white":"text-gray-900",z.progress===100&&(R?"line-through text-white/30":"line-through text-gray-400")),children:z.name}),z.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${z.tags[0].color}20`,color:z.tags[0].color},children:z.tags[0].name})]})]}):dt(z,te)},te.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},z.id)})}),st.length===0&&Ce&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:p("w-12 h-12 mx-auto mb-4",R?"text-white/30":"text-gray-400")}),jsx("p",{className:p(R?"text-white/60":"text-gray-600"),children:S.empty.noResults})]})})]})}),F?.enabled&&F.data&&X&&jsx(wg,{data:F.data,isDark:R,locale:l,onClose:()=>xe(false)})]}),jsx(ag,{state:yt,onClose:Ue,isDark:R,locale:l,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ee,onColumnSort:Ve,availableUsers:d,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(fg,{isOpen:ct,onClose:()=>Re(false),onSave:He,isDark:R,locale:l})]})}var Eg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",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}],Fg=[{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"}],Pg=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var Hd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF453A",neonGreen:"#32D74B",neonAmber:"#FFD60A",neonBlue:"#0A84FF"},zd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Ud={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Pi={dark:Hd,light:zd,neutral:Ud};function Mg(e){return Pi[e]||Pi.dark}var Wd={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Gd={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Mi={en:Wd,es:Gd};function Zn(e){return Mi[e]||Mi.en}function Ai(e,t){let a=Zn(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 Ag(e){let t=Zn(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 Lg(e,t=0,a=true){let r=Zn(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 ts(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function _d(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function Rg({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:p("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Hg=26,j1=22,K1=10;function Og(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function jd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function zg(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 $g(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 Y1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:d=0}){let{task:c,spanCols:i,lane:u,isStart:l,isEnd:m}=e,g=c.progress===100||c.status==="completed",x=c.isCriticalPath,b=l&&m?"rounded":l?"rounded-l":m?"rounded-r":"",v=m?jd(c.effortMinutes,n,d):null,f=m?zg(c,n,d):null,h=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:p("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":x?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:`${u*Hg}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${j1}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:x?{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:l?"3px":void 0,borderLeftColor:l?x?"#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:[x&&l&&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&&(v||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:p(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),h&&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,": ",h.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Ug({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:c=[],onCreateTag:i,attachmentsByTask:u,comments:l,onAddComment:m,currentUser:g,mentionableUsers:x,onUploadCommentAttachments:b,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:h,timeEntries:w,timerState:y,onLogTime:k,onUpdateEstimate:C,onUpdateSoldEffort:D,onStartTimer:T,onStopTimer:L,onDiscardTimer:B,blurFinancials:S=false,suppressDetailModal:R=false,lens:$="hours",hourlyRate:de=0}){let{theme:F="dark",locale:X$1="en",customTranslations:xe,showBacklog:_e=true}=t,M=Ai(X$1,xe),W=F==="dark"||F==="neutral",[re,Ce]=useState(r||new Date),[O,q]=useState(null),[J,pe]=useState(null),[Be,ze]=useState(null),[it,nt]=useState({}),oe=3,ct=3,Re=useCallback(_=>{pe(_.id),R||q(_),v?.(_.id);},[R,v]),[yt,ft]=useState(null),pt=useCallback(()=>{Ce(new Date(re.getFullYear(),re.getMonth()-1,1));},[re]),Te=useCallback(()=>{Ce(new Date(re.getFullYear(),re.getMonth()+1,1));},[re]),Xe=useCallback(()=>{Ce(new Date);},[]),ot=useMemo(()=>{let _=re.getFullYear(),ee=re.getMonth(),Ve=new Date(_,ee,1),ve=new Date(_,ee+1,0),Ue=Ve.getDay(),Se=ve.getDate(),He=ts(e),lt=new Date;lt.setHours(0,0,0,0);let st=[],dt=Ue,mt=new Date(_,ee,0).getDate();for(let z=dt-1;z>=0;z--){let fe=new Date(_,ee-1,mt-z);st.push({date:fe,isCurrentMonth:false,isToday:false,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(we=>_d(fe,we)).map(we=>({id:we.id,title:we.name,start:we.startDate,end:we.endDate,task:we}))});}for(let z=1;z<=Se;z++){let fe=new Date(_,ee,z),we=fe.getTime()===lt.getTime();st.push({date:fe,isCurrentMonth:true,isToday:we,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ke=>_d(fe,Ke)).map(Ke=>({id:Ke.id,title:Ke.name,start:Ke.startDate,end:Ke.endDate,task:Ke}))});}let It=42-st.length;for(let z=1;z<=It;z++){let fe=new Date(_,ee+1,z);st.push({date:fe,isCurrentMonth:false,isToday:false,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(we=>_d(fe,we)).map(we=>({id:we.id,title:we.name,start:we.startDate,end:we.endDate,task:we}))});}return st},[re,e]),Qe=useMemo(()=>ts(e).filter(_=>!_.startDate||!_.endDate),[e]),H=useMemo(()=>{let _=ts(e),ee=0,Ve=0,ve=0,Ue=0,Se=0;_.forEach(mt=>{mt.effortMinutes&&(ee+=mt.effortMinutes),mt.soldEffortMinutes&&(Ve+=mt.soldEffortMinutes),mt.scheduleVariance!=null&&(ve+=mt.scheduleVariance,Ue++),mt.soldEffortMinutes&&mt.effortMinutes&&(Se+=mt.soldEffortMinutes-mt.effortMinutes);});let He=Ve>0?Math.min(100,Math.round(ee/Ve*100)):0,lt=Ue>0?Math.round(ve/Ue):0,dt=`${Se<0?"-":"+"}${$g(Se,$,de)}`;return {budgetUtil:He,avgVariance:lt,costDisplay:dt,hasCostData:Ve>0}},[e,$,de]),se=useMemo(()=>{let _=[0,0,0,0,0,0];return ot.forEach((ee,Ve)=>{let ve=Math.floor(Ve/7);ee.events.forEach(Ue=>{if(Ue.task.startDate&&Ue.task.soldEffortMinutes){let Se=new Date(Ue.task.startDate),He=ee.date;Se.getFullYear()===He.getFullYear()&&Se.getMonth()===He.getMonth()&&Se.getDate()===He.getDate()&&ve<_.length&&(_[ve]-=Ue.task.soldEffortMinutes);}});}),_},[ot]),N=useMemo(()=>{let _=ts(e),ee=new Map,Ve=new Set,ve=[0,0,0,0,0,0];if(ot.length===0)return {segmentsByCell:ee,multiDayTaskIds:Ve,maxLanesPerRow:ve};let Ue=dt=>new Date(dt.getFullYear(),dt.getMonth(),dt.getDate()),Se=Ue(ot[0].date),He=Ue(ot[ot.length-1].date),lt=[];for(let dt of _){if(!dt.startDate||!dt.endDate)continue;let mt=Ue(dt.startDate),It=Ue(dt.endDate);if(mt.getTime()===It.getTime()||It<Se||mt>He)continue;let z=mt<Se?Se:mt,fe=It>He?He:It,we=Og(z,Se),Ke=Og(fe,Se);we<0||we>41||Ke<0||Ke>41||we!==Ke&&(Ve.add(dt.id),lt.push({task:dt,startIdx:we,endIdx:Ke}));}lt.sort((dt,mt)=>dt.startIdx!==mt.startIdx?dt.startIdx-mt.startIdx:mt.endIdx-mt.startIdx-(dt.endIdx-dt.startIdx));let st=[[],[],[],[],[],[]];for(let{task:dt,startIdx:mt,endIdx:It}of lt){let z=Math.floor(mt/7),fe=Math.floor(It/7),we=Ue(dt.startDate),Ke=Ue(dt.endDate),qe=false;for(let ge=z;ge<=fe;ge++){let te=ge===z?mt%7:0,V=ge===fe?It%7:6,me=V-te+1,Z=0,A=st[ge]??[];for(st[ge]||(st[ge]=A);Z<A.length&&(A[Z]??-1)>=te;)Z++;if(Z>=K1){qe=true;break}Z>=A.length?A.push(V):A[Z]=V,ve[ge]=Math.max(ve[ge]??0,Z+1);let j=ge===z&&we>=Se,ae=ge===fe&&Ke<=He,Ne=ge*7+te,Pe={taskId:dt.id,task:dt,rowIndex:ge,startCol:te,endCol:V,spanCols:me,lane:Z,isStart:j,isEnd:ae};ee.has(Ne)||ee.set(Ne,[]),ee.get(Ne).push(Pe);}qe&&(Ve.delete(dt.id),ee.forEach((ge,te)=>{let V=ge.filter(me=>me.taskId!==dt.id);V.length===0?ee.delete(te):ee.set(te,V);}));}return {segmentsByCell:ee,multiDayTaskIds:Ve,maxLanesPerRow:ve}},[ot,e]),Y=X$1==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=re.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),he=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:p("text-sm font-mono",W?"text-white/30":"text-gray-600"),children:[M.labels.noEvents,"..."]})]})}):s?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:p("w-12 h-12 rounded-full flex items-center justify-center",W?"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:p("text-lg font-semibold mb-2",W?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:p("text-sm",W?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:p("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",W?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:p("w-8 h-8",W?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:p("text-lg font-semibold mb-2",W?"text-white/90":"text-gray-900"),children:M.labels.noEvents}),jsx("p",{className:p("text-sm",W?"text-white/30":"text-gray-600"),children:M.labels.newTask})]})}):jsxs("div",{className:p("flex-1 flex flex-col w-full h-full overflow-hidden",W?"bg-[#050505]":"bg-white",n),style:d,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:p("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",W?"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:p("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",W?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:p("w-3.5 h-3.5",W?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:p("font-medium",W?"text-white":"text-gray-900"),children:X$1==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:p("h-4 w-px",W?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:pt,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",W?"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:p("text-sm font-semibold tracking-tight min-w-[150px] text-center",W?"text-white":"text-gray-900"),children:he}),jsx("button",{onClick:Te,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",W?"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:p("h-4 w-px",W?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:Xe,className:p("px-2.5 py-1 text-xs rounded-md transition-all font-medium",W?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:M.navigation.today})]})]}),jsx("div",{className:p("grid grid-cols-7 sticky top-0 z-10",W?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(_=>jsx("div",{className:p("py-2 text-center text-[10px] font-bold uppercase tracking-widest",W?"text-white/60 font-mono":"text-gray-500"),children:_},_))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:p("grid grid-cols-7 min-h-[800px]",W?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>pe(null),children:ot.map((_,ee)=>{let Ve=ee%7===6,ve=ee>=35;return jsxs("div",{className:p("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ve&&(W?"border-r border-[#222]":"border-r border-gray-200"),!ve&&(W?"border-b border-[#222]":"border-b border-gray-200"),W?_.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":_.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",_.isToday&&W&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",_.isToday&&!W&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:p("text-xs font-mono select-none relative z-20",_.isToday?W?"text-[#007FFF] font-bold":"text-blue-600 font-bold":_.isCurrentMonth?W?"text-white/60":"text-gray-900":W?"text-white/20":"text-gray-400"),children:String(_.date.getDate()).padStart(2,"0")}),(()=>{let Ue=Math.floor(ee/7),Se=(N.maxLanesPerRow[Ue]??0)*Hg,He=N.segmentsByCell.get(ee);return Se===0&&!He?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Se}px`,zIndex:5},children:He?.map(lt=>jsx(Y1,{segment:lt,isDark:W,blurFinancials:S,isSelected:J===lt.taskId,t:M,lens:$,hourlyRate:de,onClick:()=>{Re(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let Ue=_.events.filter(Se=>Se.task.isMilestone&&!N.multiDayTaskIds.has(Se.id));return Ue.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ue.slice(0,4).map(Se=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Se.title,onClick:He=>{He.stopPropagation(),Re(Se.task);}},Se.id)),Ue.length>4&&jsxs("span",{className:p("text-[8px] font-mono",W?"text-white/30":"text-gray-400"),children:["+",Ue.length-4]})]})})(),(()=>{let Ue=[];_.events.forEach(He=>{He.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&Ue.push({taskId:He.id,type:lt.type,severity:lt.severity,variance:He.task.scheduleVariance});});});let Se=Ue[0];return Se?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:p("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Se.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[M.labels.risk,": ",Se.type,Se.variance?` (+${Math.abs(Se.variance)}d ${M.labels.delay})`:""]})]})}):null})(),(()=>{let Ue=_.events.filter(st=>!N.multiDayTaskIds.has(st.id)),Se=it[ee]||oe,He=Ue.slice(0,Se),lt=Ue.length-Se;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[He.map(st=>jsxs(motion.button,{onClick:()=>{Re(st.task),a.onEventClick?.(st);},whileHover:{scale:1.01},className:p("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",st.task.progress===100||st.task.status==="completed"?W?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":W?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:W?st.task.progress===100||st.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:st.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:p("flex-shrink-0 text-[9px]",st.task.isMilestone?W?"text-amber-400":"text-amber-600":st.task.isCriticalPath?"text-red-400":W?"text-[#1264FF]":"text-gray-400"),children:st.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:st.title})]},st.id)),lt>0&&jsxs("button",{onClick:st=>{st.stopPropagation(),nt(dt=>({...dt,[ee]:Se+ct}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",W?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",X$1==="es"?"m\xE1s":"more"]}),Se>oe&&Ue.length>oe&&jsx("button",{onClick:st=>{st.stopPropagation(),nt(dt=>({...dt,[ee]:oe}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",W?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:X$1==="es"?"menos":"less"})]})})(),_.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ue=ee>=28,Se=ee%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:He=>{He.stopPropagation(),ft(yt===ee?null:ee);},className:p("w-5 h-5 rounded flex items-center justify-center transition-all",yt===ee?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",W?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:p("w-3.5 h-3.5 transition-transform",yt===ee&&"rotate-45")})}),jsx(AnimatePresence,{children:yt===ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ft(null)}),jsx(motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:p("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",Se?"right-0":"left-0",W?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Eo,{onSubmit:He=>{a.onTaskCreate?.({name:He.name,startDate:He.startDate||_.date,endDate:He.endDate||_.date,priority:He.priority,assignees:He.assignee?[He.assignee]:void 0}),ft(null);},onCancel:()=>ft(null),availableUsers:t.availableUsers,isDark:W,locale:X$1==="es"?"es":"en",defaultDate:_.date,dropdownDirection:Ue?"up":"down"})})]})})]})})()}),ee%7===6&&(()=>{let Ue=Math.floor(ee/7),Se=se[Ue];if(!Se||Se===0)return null;let He=$g(Se,$,de);return jsxs("div",{className:p("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Se<0?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:[M.labels.cashOut,": ",Se<0?"-":"+",He]})})()]},ee)})})})]}),_e&&jsxs("aside",{className:p("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",W?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:p("flex-shrink-0 h-14 flex items-center justify-between px-4",W?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",W?"text-white/40":"text-gray-500"),children:M.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:p("text-[10px] font-mono tabular-nums",W?"text-white/20":"text-gray-400"),children:Qe.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Qe.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:p("w-10 h-10 rounded-xl flex items-center justify-center mb-3",W?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:p("w-5 h-5",W?"text-white/20":"text-gray-400")})}),jsx("p",{className:p("text-xs font-mono",W?"text-white/20":"text-gray-400"),children:X$1==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Qe.map(_=>jsxs("button",{onClick:()=>{Re(_);},className:p("w-full text-left rounded-md p-3 transition-all group/card",W?"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:p("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",W?"bg-white/20":"bg-gray-300")}),jsx("span",{className:p("text-sm font-medium leading-snug line-clamp-2",W?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:_.name})]}),_.tags&&_.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[_.tags.slice(0,3).map(ee=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ee.color}15`,color:ee.color,border:`1px solid ${ee.color}30`},children:ee.name},ee.id)),_.tags.length>3&&jsxs("span",{className:p("text-[9px] font-mono px-1 py-0.5",W?"text-white/20":"text-gray-400"),children:["+",_.tags.length-3]})]}),(_.effortMinutes||_.soldEffortMinutes)&&jsxs("div",{className:p("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",W?"text-white/25":"text-gray-400",S&&"blur-sm select-none"),children:[jd(_.effortMinutes,$,de)&&jsxs("span",{children:[M.labels.estimate,": ",jd(_.effortMinutes,$,de)]}),(()=>{let ee=zg(_,$,de);return ee?jsx("span",{className:ee.isNegative?"text-red-400":"text-emerald-400",children:ee.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[_.priority&&jsx(Flag,{className:p("w-3 h-3",_.priority==="urgent"||_.priority==="high"?"text-red-400":_.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(Rg,{task:_,isDark:W})]}),_.assignees&&_.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:_.assignees.slice(0,2).map((ee,Ve)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:ee.color||"#007FFF"},title:ee.name,children:ee.initials||ee.name?.slice(0,2).toUpperCase()},Ve))})]})]},_.id))}),a.onTaskCreate&&jsx("div",{className:p("flex-shrink-0 px-3 py-2.5 border-t",W?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:M.labels.typeToAdd,className:p("w-full text-[11px] font-mono bg-transparent outline-none",W?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:_=>{_.key==="Enter"&&_.target.value.trim()&&(a.onTaskCreate?.({name:_.target.value.trim()}),_.target.value="");}})}),H.hasCostData&&jsxs("div",{className:p("flex-shrink-0 px-4 py-3 border-t space-y-2.5",W?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",W?"text-white/40":"text-gray-500"),children:["\u25C8 ",M.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:p("text-[10px] font-mono",W?"text-white/40":"text-gray-500"),children:M.labels.budgetUtil}),jsxs("span",{className:p("text-[10px] font-mono font-bold tabular-nums",W?"text-white/60":"text-gray-700",S&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:p("h-1.5 rounded-full overflow-hidden",W?"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:p("rounded-md px-2 py-1.5 text-center",W?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",W?"text-white/25":"text-gray-400"),children:M.labels.variance}),jsxs("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":W?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",M.labels.days]})]}),jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",W?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",W?"text-white/25":"text-gray-400"),children:M.labels.cost}),jsx("div",{className:p("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})]})]})]})]})]}),!R&&jsx(jr,{task:O,isOpen:!!O,onClose:()=>q(null),onTaskUpdate:_=>{a.onTaskUpdate?.(_),q(_);},theme:F==="dark"?"dark":"light",locale:X$1,availableUsers:t.availableUsers?.map(_=>({id:_.id,name:_.name,avatar:_.avatar,initials:_.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:O?u?.get(O.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ts(e).filter(_=>_.id!==O?.id),comments:l?.filter(_=>_.taskId===O?.id).map(_=>({..._,createdAt:_.createdAt instanceof Date?_.createdAt:new Date(_.createdAt),updatedAt:_.updatedAt instanceof Date?_.updatedAt:_.updatedAt?new Date(_.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:x,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:h,timeEntries:w,isTimerRunning:y?.isRunning,timerElapsedSeconds:y?.elapsedSeconds,onTimeLog:k,onEstimateUpdate:C,onSoldEffortUpdate:D,onTimerStart:T,onTimerStop:L,onTimerDiscard:B,blurFinancials:S}),jsx(AnimatePresence,{children:Be&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>ze(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:p("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",W?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between",W?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:p("font-medium text-sm",W?"text-white/90":"text-gray-900"),children:Be.date.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>ze(null),className:p("p-1 rounded",W?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Be.events.map(_=>jsxs("button",{onClick:()=>{ze(null),Re(_.task);},className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",W?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(Rg,{task:_.task,isDark:W}),jsx("span",{className:p("text-sm truncate flex-1",W?"text-white/80":"text-gray-900"),children:_.title}),(_.task.priority==="high"||_.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},_.id))})]})]})})]})}var Kd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Yd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},qd={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Bi={dark:Kd,light:Yd,neutral:qd};function Wg(e){return Bi[e]||Bi.dark}function X1({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[c,i]=useState(false),u=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),l=useMemo(()=>{let g=u.length,x=new Set(u.flatMap(f=>f.assignedUserIds||[])).size,b=u.map(f=>f.priority).filter(Boolean),v=new Set(u.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:x,priorities:b,labels:v}},[u]),m=()=>{o?.(e.id);};return jsxs("div",{className:p("card-stack",!e.isExpanded&&"card-stack-collapsed",d),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:p("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:l.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:[l.uniqueAssignees," assignees"]})]}),l.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:[l.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(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:x=>{x.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 Vg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rs(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 os(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 _g(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 jg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let c=useMemo(()=>({...Vg,...n}),[n]),[i,u]=useState(new Set),l=useRef(null),m=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(w=>{let y=w.timestamp.toISOString().split("T")[0],k=h.get(y);k?k.push(w):h.set(y,[w]);}),Array.from(h.entries()).sort((w,y)=>y[0].localeCompare(w[0])).map(([w,y])=>({date:new Date(w),events:y.sort((k,C)=>C.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:x}=useMemo(()=>{let h=new Set,w=new Set;return e.forEach(y=>{h.add(y.userId),w.add(y.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(w)}},[e]),b=h=>{u(w=>{let y=new Set(w);return y.has(h)?y.delete(h):y.add(h),y});},v=h=>{let y=new Date().getTime()-h.getTime(),k=Math.floor(y/6e4),C=Math.floor(y/36e5),D=Math.floor(y/864e5);return k<1?"just now":k<60?`${k}m ago`:C<24?`${C}h ago`:D<7?`${D}d ago`:h.toLocaleDateString()},f=useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:p("history-timeline-empty",d),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:p("history-timeline",c.compact&&"compact",d),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let w=h.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),x.map(h=>jsxs("option",{value:h,children:[os(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let w=h.target.value;a({...t,users:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:l,children:m.map(h=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((w,y)=>{let k=i.has(w.id),C=s===w.id,D=_g(w.type);return jsxs("div",{"data-event-id":w.id,className:p("history-timeline-event",k&&"expanded",C&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:os(w.type)})}),y<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:rs(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(w.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,L])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},T)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([T,L])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},T))]})]})]})]},w.id)})})]},h.date?.toISOString()||"all"))})]})}function Yg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],l=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:p("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:p("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:l&&os(l.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:l&&rs(l)}),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:l&&l.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>d(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,x)=>jsx("div",{className:p("history-replay-progress-marker",x===e.currentIndex&&"active"),style:{left:`${x/(e.totalEvents-1)*100}%`},onClick:()=>d(x),title:rs(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:u.map(g=>jsxs("button",{className:p("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:l&&l.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:p("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 Xd(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function Jd(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function qg(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function Xg(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function a5(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})),d=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(u=>{let l=a/2,m=r/2;u.vx+=(l-u.x)*o.centerForce*i,u.vy+=(m-u.y)*o.centerForce*i,n.forEach(g=>{if(u.id===g.id)return;let x=u.x-g.x,b=u.y-g.y,v=Math.sqrt(x*x+b*b)||1,f=o.chargeStrength*i/(v*v);u.vx+=x/v*f,u.vy+=b/v*f;});}),t.forEach(u=>{let l=d.get(typeof u.source=="string"?u.source:u.source.id),m=d.get(typeof u.target=="string"?u.target:u.target.id);if(!l||!m)return;let g=m.x-l.x,x=m.y-l.y,b=Math.sqrt(g*g+x*x)||1,v=(b-o.linkDistance)/b*o.forceStrength*i;l.vx+=g*v,l.vy+=x*v,m.vx-=g*v,m.vy-=x*v;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function Jg({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:c}){let i=useRef(null),[u,l]=useState([]),[m,g]=useState(null),[x,b]=useState(null),[v,f]=useState(null),[h,w]=useState(1),[y,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let $=a5(e,t,a.width,a.height,a,150);l($);},[e,t,a]);let C=useCallback(($,de)=>{a.enableDragging&&(de.stopPropagation(),g($));},[a.enableDragging]),D=useCallback($=>{if(!m||!i.current)return;let F=i.current.getBoundingClientRect(),X=($.clientX-F.left-y.x)/h,xe=($.clientY-F.top-y.y)/h;l(_e=>_e.map(M=>M.id===m?{...M,x:X,y:xe,fx:X,fy:xe}:M));},[m,h,y]),T=useCallback(()=>{g(null);},[]),L=useCallback(($,de)=>{de.stopPropagation(),d?.({type:"node-click",node:$,position:{x:de.clientX,y:de.clientY}});},[d]),B=useCallback(($,de)=>{de.stopPropagation(),d?.({type:"edge-click",edge:$,position:{x:de.clientX,y:de.clientY}});},[d]),S=useCallback($=>{let de=u.find(F=>F.id===$);return de?{x:de.x,y:de.y}:{x:0,y:0}},[u]),R=useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let de=$.card.priority;return de==="URGENT"?"#ef4444":de==="HIGH"?"#f59e0b":de==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:p("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:p("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w($=>Math.min($+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w($=>Math.max($-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Xd($)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[qg($)," ",Jd($)]})]},$))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let de=S(typeof $.source=="string"?$.source:$.source.id),F=S(typeof $.target=="string"?$.target:$.target.id),X=Xg($.type),xe=v===$.id,_e=$.onCriticalPath;return jsxs("g",{className:p("relationships-graph-edge",xe&&"hovered",_e&&"critical"),onMouseEnter:()=>f($.id),onMouseLeave:()=>f(null),onClick:M=>B($,M),children:[jsx("line",{x1:de.x,y1:de.y,x2:F.x,y2:F.y,stroke:Xd($.type),strokeWidth:_e?a.edgeWidth*2:a.edgeWidth,strokeOpacity:xe?1:.6,markerEnd:X?"url(#arrowhead)":void 0}),a.showEdgeLabels&&xe&&jsx("text",{x:(de.x+F.x)/2,y:(de.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Jd($.type)})]},$.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map($=>{let de=x===$.id,F=$.onCriticalPath;return jsxs("g",{className:p("relationships-graph-node",de&&"hovered",F&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:X=>C($.id,X),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:X=>L($,X),children:[jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:R($),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:de?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.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 e0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[d,c]=useState(false),[i,u]=useState(null),[l,m]=useState(null),g=useRef(null),x=d||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let h=w=>{w.key==="Escape"&&!x&&b();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,x]);let b=()=>{x||(n(""),u(null),m(null),t());},v=async()=>{if(!(!s.trim()||x)){c(true),u(null),m(null);try{let h=await r(s.trim());m(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{l&&(a(l),b());};return e?jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:b,disabled:x,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:l?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!"})]}),l.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:l.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,w)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},w))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,w)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},w)),l.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.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:h=>n(h.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:x}),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((h,w)=>jsx("button",{onClick:()=>n(h),disabled:x,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:h},w))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:x&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:b,disabled:x,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"}),l?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:v,disabled:!s.trim()||x,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:x?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qd={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var o5={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},n5={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 s5(e,t,a){let r=Qd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ns(e){return `$${e.toFixed(4)}`}var Zd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=s5(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(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,m)=>l+m.cost,0),s=a.reduce((l,m)=>l+m.inputTokens,0),n=a.reduce((l,m)=>l+m.outputTokens,0),d=a.filter(l=>l.success),c=a.reduce((l,m)=>l+m.duration,0),i={},u={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,u[l.feature]=(u[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(u=>u.timestamp>=n).length,c=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:c,percentUsed:i,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$o=new Zd;function r0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState($o.getStats()),[s,n]=useState($o.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o($o.getStats()),n($o.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 d=$o.getRecentOperations(5);return jsxs(At,{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:ns(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 u=r.costsByFeature[c]||0,l=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:ns(u)})]})]}),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:`${l}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:d.map(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:ns(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 s0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=useState(""),[c,i]=useState(""),[u,l]=useState(""),[m,g]=useState(false),[x,b]=useState(null),[v,f]=useState(null),[h,w]=useState(null),y=useRef(null),k=m||o;useEffect(()=>{e&&y.current&&y.current.focus();},[e]),useEffect(()=>{let B=S=>{S.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[e,k]);let C=()=>{k||(d(""),i(""),l(""),b(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||k)){g(true),b(null),f(null),w(null);try{let B=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});f(B.tasks.tasks),w({from_cache:B.from_cache,tokens_used:B.tokens_used,mock_mode:B.mock_mode,similarity:B.similarity,tokens_saved:B.tokens_saved});}catch(B){b(B instanceof Error?B.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),C());};if(!e)return null;let L=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick: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("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:C,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.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"}),h?.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 (",L,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[v.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((B,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:B.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"})]}),B.start," \u2192 ",B.end]}),jsxs("span",{children:[B.duration," days"]}),B.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",B.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${B.priority==="high"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:B.priority})]})},B.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:y,value:n,onChange:B=>d(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:k}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:B=>i(B.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:k})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:B=>l(B.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:k})]})]}),x&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:x}),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,S)=>jsx("button",{onClick:()=>d(B),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:B},S))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:C,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),v?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:D,disabled:!n.trim()||k,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:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function $i({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(v=>{t&&ws(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,h,w)=>{console.warn(`Retry attempt ${h} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(v,f,h)=>{r(w=>{let y=w.cards.find(B=>B.id===v);if(!y)return w;let k=y.columnId,C={...y,columnId:f,position:h},D=w.cards.map(B=>B.id===v?C:B),T=w.columns.map(B=>{if(B.id===k)return {...B,cardIds:B.cardIds.filter(S=>S!==v)};if(B.id===f){let S=D.filter(R=>R.columnId===f).sort((R,$)=>R.position-$.position);return {...B,cardIds:S.map(R=>R.id)}}return B}),L={...w,cards:D,columns:T};return o(L),L});},[o]),n=useCallback(async(v,f)=>{r(h=>{let w=h.cards.map(k=>k.id===v?{...k,...f}:k),y={...h,cards:w};return o(y),y});},[o]),d=useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let w={...v,id:f},y=h.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),k={...h,cards:[...h.cards,w],columns:y};return o(k),k});},[o]),c=useCallback(async v=>{r(f=>{let h=f.cards.find(C=>C.id===v);if(!h)return f;let w=f.cards.filter(C=>C.id!==v),y=f.columns.map(C=>C.id===h.columnId?{...C,cardIds:C.cardIds.filter(D=>D!==v)}:C),k={...f,cards:w,columns:y};return o(k),k});},[o]),i=useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let w={...v,id:f,cardIds:[]},y={...h,columns:[...h.columns,w]};return o(y),y});},[o]),u=useCallback(async(v,f)=>{r(h=>{let w=h.columns.map(k=>k.id===v?{...k,...f}:k),y={...h,columns:w};return o(y),y});},[o]),l=useCallback(async v=>{r(f=>{let h=f.cards.filter(k=>k.columnId!==v),w=f.columns.filter(k=>k.id!==v),y={...f,cards:h,columns:w};return o(y),y});},[o]),m=useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(v),f},[d]),g=useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),x=useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:l},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:l,clearBoard:x}}}function l0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=$i({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(l=>l.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:c,position:i??u+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 ss={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},c0={by:"none",order:"asc"};function u0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...ss,...e}),[s,n]=useState({...c0,...t}),d=useCallback(b=>{o(v=>({...v,...b}));},[]),c=useCallback(b=>{n(v=>({...v,...b}));},[]),i=useCallback(()=>{o(ss),n(c0);},[]),u=useCallback(()=>{a&&o({...ss,assignees:[a]});},[a]),l=useCallback(()=>{o({...ss,dateFilter:"overdue"});},[]),m=useCallback(()=>{o({...ss,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]),x=useCallback(b=>{let v=[...b];if(r.search){let f=r.search.toLowerCase();v=v.filter(h=>h.title.toLowerCase().includes(f)||h.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,h=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),y=String(f.getDate()).padStart(2,"0"),k=`${h}-${w}-${y}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let D=C.endDate||C.dueDate;if(!D)return false;let T;if(typeof D=="string")T=D.split("T")[0]||D;else {let L=D.getUTCFullYear(),B=String(D.getUTCMonth()+1).padStart(2,"0"),S=String(D.getUTCDate()).padStart(2,"0");T=`${L}-${B}-${S}`;}switch(r.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let L=new Date(k+"T00:00:00"),B=new Date(T+"T00:00:00"),S=new Date(L);return S.setDate(S.getDate()+7),B>=L&&B<=S;case "custom":if(r.dateRange){let R=typeof D=="string"?new Date(D):D;return R>=r.dateRange.start&&R<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,h)=>{let w=0;switch(s.by){case "created":let y=f.createdAt?new Date(f.createdAt).getTime():0,k=h.createdAt?new Date(h.createdAt).getTime():0;w=y-k;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=C[f.priority||"LOW"],T=C[h.priority||"LOW"];w=D-T;break;case "dueDate":let L=f.endDate||f.dueDate,B=h.endDate||h.dueDate;if(!L)return 1;if(!B)return -1;let S=typeof L=="string"?new Date(L).getTime():L.getTime(),R=typeof B=="string"?new Date(B).getTime():B.getTime();w=S-R;break;case "title":w=f.title.localeCompare(h.title);break;case "estimate":let $=f.estimatedTime||0,de=h.estimatedTime||0;w=$-de;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:l,filterHighPriority:m,applyFilters:x,hasActiveFilters:g}}var m0,g0;if(typeof window<"u")try{let e=ys("ai");m0=e.generateObject,g0=e.generateText;}catch{}function f0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(m0&&g0&&e.apiKey),n=useCallback(async l=>{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:",l),{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: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),d=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.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 l=>{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 l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),u=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function tc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function b0(e){let{cards:t}=e,[a,r]=tc(),o=useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=useCallback((l,m)=>{if(!m){r({selectedCardIds:[l],lastSelectedCardId:l});return}let g=m.ctrlKey||m.metaKey,x=m.shiftKey;if(g)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(x&&a.lastSelectedCardId){let b=t.find(f=>f.id===l),v=t.find(f=>f.id===a.lastSelectedCardId);if(b&&v&&b.columnId===v.columnId){let f=t.filter(T=>T.columnId===b.columnId).sort((T,L)=>T.position-L.position),h=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===l),[y,k]=h<w?[h,w]:[w,h],C=f.slice(y,k+1).map(T=>T.id),D=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:D,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),u=useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:c,toggleCard:i,getSelectedCards:u}}var h0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function y0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...h0,...a}),[a]),[s,n]=useState([]),d=useCallback((b,v,f,h,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let y={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:v,columnId:f,strategy:h,color:w,isExpanded:true,position:s.filter(k=>k.columnId===f).length,createdAt:new Date};n(k=>[...k,y]);},[o.minCardsPerStack,s]),c=useCallback(b=>{n(v=>v.filter(f=>f.id!==b));},[]),i=useCallback(b=>{n(v=>v.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),u=useCallback((b,v)=>{n(f=>f.map(h=>h.id===b&&!h.cardIds.includes(v)?{...h,cardIds:[...h.cardIds,v]}:h));},[]),l=useCallback((b,v)=>{n(f=>f.map(h=>{if(h.id===b){let w=h.cardIds.filter(y=>y!==v);return w.length<o.minCardsPerStack?null:{...h,cardIds:w}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),m=useCallback(b=>s.filter(v=>v.columnId===b).sort((v,f)=>v.position-f.position),[s]),g=useCallback(async b=>{let v=t.filter(k=>k.columnId===b);if(v.length<o.minCardsPerStack*2)return [];let f=[],h=new Map;v.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(C=>{h.has(C)||h.set(C,[]),h.get(C).push(k);});}),h.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:k.map(D=>D.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${C}"`,confidence:.85});});let w=new Map;v.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(C=>{w.has(C)||w.set(C,[]),w.get(C).push(k);});}),w.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:k.map(D=>D.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let y=new Map;if(v.forEach(k=>{k.priority&&(y.has(k.priority)||y.set(k.priority,[]),y.get(k.priority).push(k));}),y.forEach((k,C)=>{if(k.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${C} Priority`,cardIds:k.map(T=>T.id),columnId:b,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let k of v){let D=(await r.findSimilar(k,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let T=[k.id,...D.map(B=>B.card.id)],L=D.reduce((B,S)=>B+S.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:L});}}return f.filter(k=>k.confidence>=o.autoStackConfidenceThreshold).sort((k,C)=>C.confidence-k.confidence).slice(0,5)},[t,o,r]),x=useCallback(b=>{d(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[d]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),h=f[0];f.length>0&&h&&h.confidence>=.9&&x(h);});},[]),{stacks:s,createStack:d,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:l,getStacksForColumn:m,getSuggestions:g,applySuggestion:x,config:o}}var x0=createContext(null);function v0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=ys("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=ys("@libxai/core");n.set(c.id,new i(c));});let d=null;if(t?.board){let{Board:c}=ys("@libxai/core");d=new c(t.board);}r.current=new BoardStore({board:d,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(x0.Provider,{value:{store:o},children:e})}function Hi(){let e=useContext(x0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ls(){let e=Hi(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=useCallback(h=>{e.updateBoard(h);},[e]),c=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,w)=>{e.updateColumn(h,w);},[e]),u=useCallback(h=>{e.deleteColumn(h);},[e]),l=useCallback(h=>e.getColumn(h),[e]),m=useCallback(h=>{e.addCard(h);},[e]),g=useCallback((h,w)=>{e.updateCard(h,w);},[e]),x=useCallback(h=>{e.deleteCard(h);},[e]),b=useCallback((h,w,y)=>{e.moveCard(h,w,y);},[e]),v=useCallback(h=>e.getCard(h),[e]),f=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:l,addCard:m,updateCard:g,deleteCard:x,moveCard:b,getCard:v,getCardsByColumn:f}}function k0(e){let{cards:t}=ls();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 C0(e="position",t="asc"){let{cards:a}=ls();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?d[o.priority]:0,i=s.priority?d[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 zi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Wc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},C5=new zi;function N0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:c}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:m,className:o,children:jsx("div",{style:g,children:l.map(x=>{let b=e[x.index];if(!b)return null;let v=c?c(b,x.index):x.index,f={position:"absolute",top:n?0:x.start,left:n?x.start:0,width:n?x.size:"100%",height:n?"100%":x.size};return jsx("div",{style:f,"data-index":x.index,children:r(b,x.index)},v)})})})}function D0(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 E0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:c,horizontal:i=true}){let u=useRef(null),l=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:d}),m=l.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},x={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:g,className:s,children:jsx("div",{style:x,children:m.map(b=>{let v=e[b.index];if(!v)return null;let f=c?c(v,b.index):b.index,h={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsx("div",{style:h,"data-index":b.index,children:o(v,b.index)},f)})})})}function F0(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 P0(e,t=10){return e>t}var nc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},sc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ic={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},lc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},dc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},cc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},uc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},pc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},mc={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},gc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},fc={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},bc={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},Ui={spacing:nc,borderRadius:sc,fontSize:ic,fontWeight:lc,lineHeight:dc,zIndex:cc,duration:uc,easing:pc,shadows:mc,opacity:gc,kanban:fc,gantt:bc};function M0(e,t,a){return e[t]??a}function hc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?hc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function D5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function yc(e="asakaa"){let t=hc(Ui),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=D5(o);a.push(` ${s}: ${n};`);}return `:root {
414
414
  ${a.join(`
415
415
  `)}
416
416
  }`}function ds(e,t="asakaa"){let a=[],r=hc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {