@libxai/board 0.18.11 → 0.18.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 lm 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,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,Timer,Clock,Tag,BarChart,CalendarCheck,Users,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,FileText,File,Sparkles,Maximize2,MoreHorizontal,X,User,Check,CalendarDays,Diamond,Upload,MessageSquare,Rows3,Filter,FileImage,FileSpreadsheet,FileJson,FolderKanban,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,Search,Copy}from'lucide-react';import {Command}from'cmdk';import Uf from'react-markdown';import $f from'remark-gfm';import Hf from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';var gn=(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 fn=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 [fn.Translate.toString(e),fn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function b(...e){return twMerge(clsx(e))}function bn(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 _u(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Is(e,t){return e.length===0?1e3:t===0?bn(null,e[0].position):t>=e.length?bn(e[e.length-1].position,null):bn(e[t-1].position,e[t].position)}function td(e,t=100){return e>t}var Vu=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 ju(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 hn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Vu,onRetry:l}=t,m,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(m=d,c===a||!n(m,c))return {error:m,attempts:i,success:false};let f=ju(c,r,o,s);if(l)try{l(m,c,f);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,f));}}return {error:m||new Error("Unknown error"),attempts:i,success:false}}function Ku(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 Yu(e,t={}){return async(...a)=>hn(()=>e(...a),t)}var Bs=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 ad=(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))(ad||{}),jr=class jr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,m?n:"");break;case "INFO":console.info(l,o,m?n:"");break;case "WARN":console.warn(l,o,m?n:"");break;case "ERROR":console.error(l,o,m?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",...jr.globalOptions};}static configure(t){jr.globalOptions={...jr.globalOptions,...t};}child(t){return new jr({...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 yn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new yn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:ad[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};jr.globalOptions={};var Rs=jr,yn=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}},rd=new Rs;function Xu(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 Ju(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(l=>l.id===s.columnId);return [s.id,Os(s.title),Os(s.description||""),Os(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 Zu(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 lm(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),m=297,i=210,c=n.width/n.height,d=m-20,u=d/c;u>i-20&&(u=i-20,d=u*c);let f=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});f.setFontSize(16),f.setTextColor(255,255,255),f.setFillColor(10,10,10),f.rect(0,0,m,15,"F"),f.text(e.title||"Kanban Board",10,10);let y=(m-d)/2;return f.addImage(l,"PNG",y,20,d,u),f}catch(n){console.error("Error capturing board:",n);}let o=new jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let l=e.cards.filter(m=>m.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(m.description,160);o.text(c,25,s),s+=c.length*5;}let i=[];if(m.priority&&i.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&i.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&i.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let c=[];m.startDate&&c.push(`Start: ${m.startDate}`),m.endDate&&c.push(`End: ${m.endDate}`),i.push(c.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Os(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
3
|
`)?`"${e.replace(/"/g,'""')}"`:e}async function nd(e,t,a,r){switch(t){case "json":return Xu(e,r);case "csv":return Ju(e);case "pdf":return await Zu(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function sd(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),m=URL.createObjectURL(l),i=document.createElement("a");i.href=m,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(m);}function Qu(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 eg(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=id(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=id(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((f,y)=>{i[f]=l[y]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),u={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(u),d.cardIds.push(u.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function id(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 ld(e,t){switch(t){case "json":return Qu(e);case "csv":return eg(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function dd(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 zs=createContext(null);function cd(){return useContext(zs)}var md=createContext(null);function pd({children:e,themeName:t}){return jsx(md.Provider,{value:{themeName:t},children:e})}function uo(){return useContext(md)}function gt({children:e,container:t}){let[a,r]=useState(false),o=cd(),s=uo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:m}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":m,"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 hd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},lg="#BDC3C7",dg=({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 Kr({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),m=useRef(null),i=()=>{if(!m.current)return;let f=m.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,g=160,v=220,h=4,p=f.right-g;p<10&&(p=f.left),p+g>k-10&&(p=k-g-10);let w=y-f.bottom,x=f.top,S;w>=v+h?S=f.bottom+h:x>=v+h?S=f.top-v-h:S=w>=x?f.bottom+h:Math.max(10,f.top-v-h),n({top:S,left:p}),o(true);};useEffect(()=>{let f=y=>{l.current&&!l.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),useEffect(()=>{let f=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let c=f=>{t(f),o(false);},d=e?hd[e]:null,u=d?.color||lg;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:m,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?`${u}10`:"transparent",boxShadow:e?`0 0 0 2px ${u}30 inset`:"none"},title:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:u,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:u,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(gt,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(hd).map(([f,y])=>jsxs("button",{onClick:()=>c(f),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsx(dg,{color:y.color}),jsx("span",{className:"font-semibold text-sm",children:y.label}),e===f&&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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>c(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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("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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var cg=[{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 Ro({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),u=(uo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let p=i.current.getBoundingClientRect(),w=window.innerHeight,x=window.innerWidth,S=320,T=380,C=4,A=p.left;A+S>x-10&&(A=x-S-10),A<10&&(A=10);let I=w-p.bottom,N=p.top,z;I>=T+C?z=p.bottom+C:N>=T+C?z=p.top-T-C:z=I>=N?p.bottom+C:Math.max(10,p.top-T-C),l({top:z,left:A}),s(true);};useEffect(()=>{let p=w=>{m.current&&!m.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]),useEffect(()=>{let p=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[o]);let y=p=>{let w=new Date,x=A=>{let I=A.getFullYear(),N=String(A.getMonth()+1).padStart(2,"0"),z=String(A.getDate()).padStart(2,"0");return `${I}-${N}-${z}`},S=x(w),T=new Date(w);T.setDate(T.getDate()+p);let C=x(T);a(S,C),s(false);},k=()=>{if(!e||!t)return "Set date";let p=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=T.split("-").map(Number);if(C.length!==3||C.some(z=>isNaN(z)))return null;let A=C[0],I=C[1],N=C[2];return A===void 0||I===void 0||N===void 0?null:new Date(A,I-1,N)},w=p(e),x=p(t);if(!w||!x||isNaN(w.getTime())||isNaN(x.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[w.getMonth()]} ${w.getDate()} \u2013 ${S[x.getMonth()]} ${x.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let p=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),p<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):f(),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:g?`${k()}`:"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:k()})]}),o&&jsx(gt,{children:jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:u?"#1A1D25":"#FFFFFF",border:`1px solid ${u?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:u?"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:u?"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:u?"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:cg.map(p=>jsx("button",{onClick:()=>y(p.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:p.label},p.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"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:p=>a(p.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:p=>a(e,p.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"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:p=>{p.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function qr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[l,m]=useState(""),[i,c]=useState({top:0,left:0}),d=useRef(null),u=useRef(null),f=()=>{if(!u.current)return;let h=u.current.getBoundingClientRect(),p=window.innerHeight,w=window.innerWidth,x=300,S=380,T=4,C=h.right-x;C<10&&(C=h.left),C+x>w-10&&(C=w-x-10);let A=p-h.bottom,I=h.top,N;A>=S+T?N=h.bottom+T:I>=S+T?N=h.top-S-T:N=A>=I?h.bottom+T:Math.max(10,h.top-S-T),c({top:N,left:C}),n(true);};useEffect(()=>{let h=p=>{d.current&&!d.current.contains(p.target)&&!u.current?.contains(p.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=p=>{p.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let y=h=>{let p=e.some(w=>w.id===h.id);a(p?e.filter(w=>w.id!==h.id):[...e,h]);},k=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),g=e.slice(0,o),v=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:u,onClick:()=>s?n(false):f(),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:[g.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)),v>0&&jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):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(gt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange:h=>m(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:k.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"}):k.map(h=>{let p=e.some(w=>w.id===h.id);return jsxs("button",{onClick:()=>y(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:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor: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:p?"#3b82f6":"transparent"},children:p?"\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 vn(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(m),false};return l(a)}function zo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,m]=useState(false),[i,c]=useState(""),[d,u]=useState(t.length>0),[f,y]=useState({top:0,left:0}),[k,g]=useState(null),v=useRef(null),h=useRef(null),p=()=>{if(!h.current)return;let C=h.current.getBoundingClientRect(),A=window.innerHeight,I=window.innerWidth,N=300,z=d?380:120,R=4,V=C.right-N;V<10&&(V=C.left),V+N>I-10&&(V=I-N-10);let ne=A-C.bottom,ae=C.top,ie;ne>=z+R?ie=C.bottom+R:ae>=z+R?ie=C.top-z-R:ie=ne>=ae?C.bottom+R:Math.max(10,C.top-z-R),y({top:ie,left:V}),m(true);};useEffect(()=>{if(!l||!h.current)return;let C=h.current.getBoundingClientRect(),A=window.innerHeight,I=window.innerWidth,N=300,z=d?380:120,R=4,V=C.right-N;V<10&&(V=C.left),V+N>I-10&&(V=I-N-10);let ne=A-C.bottom,ae=C.top,ie;ne>=z+R?ie=C.bottom+R:ae>=z+R?ie=C.top-z-R:ie=ne>=ae?C.bottom+R:Math.max(10,C.top-z-R),y({top:ie,left:V});},[d,l]),useEffect(()=>{let C=A=>{v.current&&!v.current.contains(A.target)&&!h.current?.contains(A.target)&&(m(false),c(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),useEffect(()=>{let C=A=>{A.key==="Escape"&&(m(false),c(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let w=C=>{let A=t.includes(C),I=a.find(N=>N.id===C);if(g(null),A){let N=t.filter(z=>z!==C);r(N),N.length===0&&u(false);}else {if(s&&vn(a,C,e)){let z=`Cannot add "${I?.title||C}" as dependency - would create circular reference`;g(z),n?.(C,I?.title||C),setTimeout(()=>g(null),3e3);return}r([...t,C]),u(true);}},x=()=>{let C=!d;u(C),C||r([]);},S=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:h,onClick:()=>l?m(false):p(),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:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),l&&jsx(gt,{children:jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[k&&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:k})]}),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:x,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:C=>c(C.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:S.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"}):S.map(C=>{let A=t.includes(C.id);return jsxs("button",{onClick:()=>w(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:A?"#3b82f6":"transparent",borderColor:A?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:A&&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:C.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),u(false),m(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 gr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:y}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:fn.Transform.toString(u),transition:f};if(t)return jsx("div",{ref:d,style:k,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=l.filter(w=>e.assignedUserIds?.includes(w.id)),v=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),p={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:p,className:b("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),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:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,x)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:S=>{S.currentTarget.style.display="none";}}),x===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]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(Kr,{priority:e.priority,onChange:w=>n?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Ro,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,x)=>n?.(e.id,{startDate:w,endDate:x})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(qr,{assignedUsers:g,availableUsers:l,onChange:w=>n?.(e.id,{assignedUserIds:w.map(x=>x.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(zo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:m,onChange:w=>n?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},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:"#3B82F6"}})})]})]})},(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&&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)));gr.displayName="Card";var xn={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"}},Sd=({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 Ed({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),c=[...Object.entries(xn).map(([g,v])=>({id:g,label:v.label,color:v.color,icon:v.icon})),...r.filter(g=>!Object.keys(xn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=xn[e];if(g)return {...g,id:e};let v=r.find(h=>h.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...xn.todo,id:"todo"}},u=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),v=window.innerHeight,h=window.innerWidth,p=180,w=280,x=4,S=g.right-p;S<10&&(S=g.left),S+p>h-10&&(S=h-p-10);let T=v-g.bottom,C=g.top,A;T>=w+x?A=g.bottom+x:C>=w+x?A=g.top-w-x:A=T>=C?g.bottom+x:Math.max(10,g.top-w-x),l({top:A,left:S}),s(true);};useEffect(()=>{let g=v=>{m.current&&!m.current.contains(v.target)&&!i.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),useEffect(()=>{let g=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},y=d(),k=y.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):u(),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:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:y.label,children:jsx(Sd,{icon:y.icon,color:k})}),o&&jsx(gt,{children:jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:c.map(g=>jsxs("button",{onClick:()=>f(g.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:g.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsx(Sd,{icon:g.icon,color:g.color}),jsx("span",{className:"font-semibold",children:g.label}),e===g.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function Pd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[l,m]=useState(false),[i,c]=useState(e),[d,u]=useState({top:0,left:0}),f=useRef(null),y=useRef(null),k=useRef(null);useEffect(()=>{if(s&&y.current){let p=y.current.getBoundingClientRect();u({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[s]),useEffect(()=>{let p=w=>{f.current&&!f.current.contains(w.target)&&!y.current?.contains(w.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),useEffect(()=>{let p=w=>{w.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s,e]),useEffect(()=>{l&&k.current&&(k.current.focus(),k.current.select());},[l]);let g=()=>{m(true),c(e);},v=()=>{let p=i.trim();p&&p!==e&&t(p),m(false),n(false),c(e);},h=p=>{p.key==="Enter"?v():p.key==="Escape"&&(m(false),c(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:y,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",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"})]})}),s&&jsx(gt,{children:jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:k,type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:h,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:g,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:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),n(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:"Delete"})]})]})]})})})]})}var bo=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:u,onToggleCollapse:f,onColumnRename:y,onColumnDelete:k,isDeletable:g=false,className:v})=>{let{setNodeRef:h,isOver:p}=useDroppable({id:e.id,data:{type:"column",column:e}}),w=useRef(null),x=c??td(t.length),S=useVirtualizer({count:t.length,getScrollElement:()=>w.current,estimateSize:()=>d,enabled:x});if(a)return jsx("div",{ref:h,className:v,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),A=C.state==="exceeded",I=()=>"asakaa-column-count";return jsxs("div",{ref:h,className:b("asakaa-column",p&&"ring-2 ring-asakaa-accent-blue",A&&"ring-2 ring-asakaa-accent-red",v),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:b(I()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.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"})]}),C.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"})]}),C.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"})}),C.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||k)&&jsx(Pd,{columnTitle:e.title,onRename:N=>y?.(e.id,N),onDelete:k?()=>k(e.id):void 0,isDeletable:g}),f&&jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":u?"Expand column":"Collapse column",children:u?"\u25B6":"\u25BC"})]})]}),!u&&jsx("div",{ref:w,className:"asakaa-column-cards",style:{maxHeight:x?"600px":void 0},children:jsx(SortableContext,{items:t.map(N=>N.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"})}):x?jsx("div",{style:{height:`${S.getTotalSize()}px`,position:"relative"},children:S.getVirtualItems().map(N=>{let z=t[N.index];return z?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsx(gr,{card:z,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i})},z.id):null})}):t.map(N=>jsx(gr,{card:N,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i},N.id))})})]})});bo.displayName="Column";function Gs({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let m=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?m():c.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:m,onKeyDown:i,className:b("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:b("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Mg(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 Bd(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let m=l.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Fg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ag(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Lg=["\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 Rd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:u=[],onFilesSelect:f,onRemoveFile:y,maxFileSizeMB:k=10}){let g=l==="dark",[v,h]=useState(false),[p,w]=useState([]),[x,S]=useState(0),[T,C]=useState(null),[A,I]=useState(false),N=useRef(null),z=useRef(null),R=useRef(null),V=useRef(null),ne=useCallback((E,W)=>{let J=Mg(E,W);if(C(J),J){let ue=r.filter(be=>be.name.toLowerCase().includes(J.query)||be.email&&be.email.toLowerCase().includes(J.query)).slice(0,5);w(ue),h(ue.length>0),S(0);}else h(false),w([]);},[r]),ae=E=>{let W=E.target.value;t(W),ne(W,E.target.selectionStart||0);},ie=()=>{N.current&&ne(e,N.current.selectionStart||0);},ke=useCallback(E=>{if(!T||!N.current)return;let W=e.slice(0,T.start),J=e.slice(T.end),ue=`@${E.name.replace(/\s+/g,"")} `,be=W+ue+J;t(be),h(false),C(null),setTimeout(()=>{if(N.current){let G=T.start+ue.length;N.current.selectionStart=G,N.current.selectionEnd=G,N.current.focus();}},0);},[T,e,t]),Ne=E=>{if(v&&p.length>0)switch(E.key){case "ArrowDown":E.preventDefault(),S(W=>W<p.length-1?W+1:0);break;case "ArrowUp":E.preventDefault(),S(W=>W>0?W-1:p.length-1);break;case "Enter":{E.preventDefault();let W=p[x];W&&ke(W);break}case "Tab":{E.preventDefault();let W=p[x];W&&ke(W);break}case "Escape":E.preventDefault(),h(false);break}else E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),a());};useEffect(()=>{let E=W=>{z.current&&!z.current.contains(W.target)&&N.current&&!N.current.contains(W.target)&&h(false),V.current&&!V.current.contains(W.target)&&I(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);let Ae=useCallback(E=>{if(!N.current)return;let W=N.current.selectionStart||e.length,J=e.slice(0,W)+E+e.slice(W);t(J),I(false),setTimeout(()=>{if(N.current){let ue=W+E.length;N.current.selectionStart=ue,N.current.selectionEnd=ue,N.current.focus();}},0);},[e,t]),F=useCallback(E=>{if(!f||!E.target.files)return;let W=Array.from(E.target.files),J=k*1024*1024,ue=W.filter(be=>be.size>J?(console.warn(`File ${be.name} exceeds max size of ${k}MB`),false):true);ue.length>0&&f(ue),E.target.value="";},[f,k]),B=useCallback(E=>E.type.startsWith("image/")?Image:E.type.includes("pdf")||E.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(v&&z.current){let E=z.current.children[x];E&&E.scrollIntoView({block:"nearest"});}},[x,v]),jsxs("div",{className:"flex flex-col gap-2",children:[u.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:u.map(E=>{let W=B(E.file),J=E.file.type.startsWith("image/");return jsxs("div",{className:b("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[J&&E.preview?jsx("img",{src:E.preview,alt:E.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(W,{className:b("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:b("text-xs truncate",g?"text-white":"text-gray-900"),children:E.file.name}),jsx("p",{className:b("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Ag(E.file.size)})]}),y&&jsx("button",{onClick:()=>y(E.id),className:b("p-0.5 rounded-full transition-colors",g?"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"})})]},E.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:b("flex-1 relative min-w-0"),children:[jsxs("div",{className:b("flex items-center gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!A),disabled:s||n,className:b("p-1 rounded transition-colors flex-shrink-0",g?"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:A&&jsx(motion.div,{ref:V,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:b("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"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:Lg.map(E=>jsx("button",{type:"button",onClick:()=>Ae(E),className:b("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:E},E))})})})]}),d&&f&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>R.current?.click(),disabled:s||n,className:b("p-1.5 rounded transition-colors",g?"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:m==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:R,type:"file",multiple:true,onChange:F,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("input",{ref:N,type:"text",value:e,onChange:ae,onSelect:ie,onKeyDown:Ne,placeholder:o||(m==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:b("flex-1 bg-transparent text-sm outline-none min-w-[100px]",g?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsx("button",{onClick:a,disabled:n||!e.trim()&&u.length===0||s,className:b("p-1.5 rounded transition-colors",(e.trim()||u.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"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:v&&p.length>0&&jsx(motion.div,{ref:z,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:b("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.map((E,W)=>jsxs("button",{type:"button",onClick:()=>ke(E),className:b("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",W===x?g?"bg-white/10":"bg-gray-100":g?"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:E.color||"#8B5CF6"},children:Fg(E.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:b("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:E.name}),E.email&&jsx("p",{className:b("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:E.email})]})]},E.id))})})]})]})]})}function Od({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,m)=>l.type==="mention"?jsx("span",{className:b("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},m):jsx("span",{children:l.value},m))})}var Nn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Sr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,m]=useState(false),[i,c]=useState(""),[d,u]=useState(false),[f,y]=useState(Nn[10]||"#3B82F6"),[k,g]=useState({top:0,left:0}),v=useRef(null),h=useRef(null),p=useRef(null),w=useRef(null),x=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),S=t.some(N=>N.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&h.current){let N=h.current.getBoundingClientRect();g({top:N.bottom+6,left:N.left});}},[l]),useEffect(()=>{let N=z=>{let R=z.target,V=v.current?.contains(R),ne=p.current?.contains(R);!V&&!ne&&(m(false),c(""),u(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let T=N=>{let z=e.some(R=>R.id===N.id);a(z?e.filter(R=>R.id!==N.id):[...e,N]);},C=async()=>{if(!(!r||!i.trim())){u(true);try{let N=await r(i.trim(),f);N&&(a([...e,N]),c(""),y(Nn[Math.floor(Math.random()*Nn.length)]||"#3B82F6"));}finally{u(false);}}},A=(N,z)=>{z.stopPropagation(),a(e.filter(R=>R.id!==N));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:v,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:p,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:k.top,left:k.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:N=>c(N.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:N=>{N.key==="Enter"&&i.trim()&&!S&&r&&C();}})}),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(N=>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:`${N.color}20`,color:N.color},onClick:z=>A(N.id,z),children:[N.name,jsx(X,{className:"w-3 h-3"})]},N.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:x.length>0?x.map(N=>{let z=e.some(R=>R.id===N.id);return jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:z?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:R=>{z||(R.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:R=>{z||(R.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsx("span",{className:"flex-1 text-left",children:N.name}),z&&jsx(Check,{className:"w-4 h-4",style:{color:N.color}})]},N.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()&&!S&&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:Nn.map(N=>jsx("button",{type:"button",onClick:()=>y(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:f===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxs("button",{type:"button",onClick:C,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Vs({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 Ud({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(Vs,{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 Jr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{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 Kd(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}}return e}function rf(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 fr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:u,availableTasks:f=[],comments:y=[],onAddComment:k,currentUser:g,mentionableUsers:v=[],onUploadCommentAttachments:h}){let p=s==="dark",w={textTertiary:p?"#6B7280":"#9CA3AF",textSecondary:p?"#9CA3AF":"#6B7280",textPrimary:p?"#FFFFFF":"#111827",borderLight:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:p?"#1A1D25":"#FFFFFF",bgSecondary:p?"#0F1117":"#F9FAFB",hoverBg:p?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},x=e&&"title"in e&&!("name"in e),S=e,[T,C]=useState(e?Kd(e,l):null),[A,I]=useState(false),[N,z]=useState(false),[R,V]=useState(false),[ne,ae]=useState(null),[ie,ke]=useState(new Date),[Ne,Ae]=useState(false),[F,B]=useState(false),[E,W]=useState(""),[J,ue]=useState(false),[be,G]=useState(false),[he,j]=useState(false),[He,de]=useState(""),Be=useRef(null),nt=useRef(null),[st,Xe]=useState(""),kt=useRef(null),[ct,$t]=useState(""),[ge,L]=useState(false),[re,Te]=useState([]),[ze,Z]=useState(""),[Re,H]=useState(false),Y=useRef(null);useEffect(()=>{if(e){let D=Kd(e,l);C(D),de(D.description||""),Xe(D.name||"");}},[e?.id,l]),useEffect(()=>{if(!t||!He)return;let D=setTimeout(()=>{let Q=nt.current;Q&&(Q.style.height="auto",Q.style.height=`${Math.max(100,Q.scrollHeight)}px`);},50);return ()=>clearTimeout(D)},[t,He]),useEffect(()=>()=>{Be.current&&clearTimeout(Be.current),kt.current&&clearTimeout(kt.current);},[]),useEffect(()=>{t&&Y.current&&y.length>0&&setTimeout(()=>{Y.current&&(Y.current.scrollTop=Y.current.scrollHeight);},100);},[t,y.length]);let we=useCallback(D=>{C(D),x&&o&&S?o(rf(D,S)):r&&r(D);},[x,S,o,r]),Le=useCallback(()=>{I(false),z(false),V(false),ae(null),B(false),W(""),ue(false);},[]),Ge=useCallback((D,Q)=>{if(!T)return;let me={...T,[D]:Q};we(me);},[T,we]),We=useCallback(()=>{let D=nt.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),se=useCallback(D=>{de(D),setTimeout(We,0),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{if(T){let Q={...T,description:D};we(Q);}},800);},[T,we,We]),Ie=useCallback(D=>{Xe(D),kt.current&&clearTimeout(kt.current),kt.current=setTimeout(()=>{if(T&&D.trim()){let Q={...T,name:D.trim()};we(Q);}},800);},[T,we]),ee=useCallback(D=>{let Q=D.map(me=>{let qe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:me};return me.type.startsWith("image/")&&(qe.preview=URL.createObjectURL(me)),qe});Te(me=>[...me,...Q]);},[]),Ke=useCallback(D=>{Te(Q=>{let me=Q.find(qe=>qe.id===D);return me?.preview&&URL.revokeObjectURL(me.preview),Q.filter(qe=>qe.id!==D)});},[]),Pa=useCallback(async()=>{if(!(!T||!ct.trim()&&re.length===0||!k)){L(true);try{let D=Bd(ct,v),Q=[];if(re.length>0&&h){let me=re.map(qe=>qe.file);Q=await h(me);}await k(T.id,ct.trim(),D.length>0?D:void 0,Q.length>0?Q:void 0),$t(""),re.forEach(me=>{me.preview&&URL.revokeObjectURL(me.preview);}),Te([]);}finally{L(false);}}},[T,ct,re,k,v,h]),fe=useCallback(()=>{if(!T||!ze.trim())return;let D={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:ze.trim(),progress:0,startDate:new Date,endDate:new Date},Q=[...T.subtasks||[],D],me={...T,subtasks:Q};we(me),Z(""),H(false);},[T,ze,we]),Ye=useCallback(D=>{if(!T?.subtasks)return;let Q=T.subtasks.map(qe=>qe.id===D?{...qe,progress:qe.progress===100?0:100}:qe),me={...T,subtasks:Q};we(me);},[T,we]),$e=useCallback(D=>{if(!T?.subtasks)return;let Q=T.subtasks.filter(qe=>qe.id!==D),me={...T,subtasks:Q};we(me);},[T,we]),Je=useCallback(D=>{let Q=typeof D=="string"?new Date(D):D,qe=new Date().getTime()-Q.getTime(),Mt=Math.floor(qe/6e4),Zt=Math.floor(qe/36e5),Dt=Math.floor(qe/864e5);return Mt<1?n==="es"?"Ahora":"Just now":Mt<60?n==="es"?`Hace ${Mt} min`:`${Mt}m ago`:Zt<24?n==="es"?`Hace ${Zt}h`:`${Zt}h ago`:Dt<7?n==="es"?`Hace ${Dt}d`:`${Dt}d ago`:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),at=useCallback(D=>{if(!T)return;let Q=T.progress||0;D==="completed"?Q=100:D==="in-progress"&&Q===0?Q=10:D==="todo"&&(Q=0);let me={...T,status:D,progress:Q};we(me),I(false);},[T,we]),it=useCallback((D,Q)=>{if(!T)return;let me={...T,startDate:D,endDate:Q};we(me);},[T,we]),_=useCallback(()=>{let D=ie.getFullYear(),Q=ie.getMonth(),me=new Date(D,Q,1),Mt=new Date(D,Q+1,0).getDate(),Zt=me.getDay(),Dt=[],ce=new Date(D,Q,0).getDate();for(let _e=Zt-1;_e>=0;_e--)Dt.push({date:new Date(D,Q-1,ce-_e),isCurrentMonth:false});for(let _e=1;_e<=Mt;_e++)Dt.push({date:new Date(D,Q,_e),isCurrentMonth:true});let Ze=42-Dt.length;for(let _e=1;_e<=Ze;_e++)Dt.push({date:new Date(D,Q+1,_e),isCurrentMonth:false});return Dt},[ie]),q=useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),G(false),!T||!d)return;let Q=Array.from(D.dataTransfer.files);if(Q.length!==0){j(true);try{await d(T.id,Q);}finally{j(false);}}},[T,d]),Pe=useCallback(async D=>{if(!T||!d||!D.target.files)return;let Q=Array.from(D.target.files);if(Q.length!==0){j(true);try{await d(T.id,Q);}finally{j(false);}D.target.value="";}},[T,d]),je=useCallback(D=>{D.preventDefault(),D.stopPropagation(),G(true);},[]),Oe=useCallback(D=>{D.preventDefault(),D.stopPropagation(),G(false);},[]),U=useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),le=useCallback(D=>D.startsWith("image/")?Image:D.includes("pdf")||D.includes("document")?FileText:File,[]);return !t||!T?null:jsx(AnimatePresence,{children:t&&T&&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:b("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",p?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:b("px-6 py-3 border-b flex items-center gap-3",p?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:b("text-xs px-2 py-0.5 rounded",p?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:b("text-xs font-mono",p?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)}),jsxs("button",{className:b("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",p?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsx(Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsx("div",{className:"flex-1"}),jsx("button",{className:b("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:b("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:a,className:b("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let D=T.progress===100?0:100,me={...T,progress:D,status:D===100?"completed":"todo"};we(me);},className:b("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",T.progress===100?"bg-green-500 border-green-500":p?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:st,onChange:D=>Ie(D.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:b("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",T.progress===100?"line-through text-[#6B7280]":p?"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:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Le(),I(!A);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",T.progress===100||T.status==="completed"?"bg-green-500/20 text-green-400":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/20 text-blue-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.progress===100||T.status==="completed"?n==="es"?"COMPLETADO":"DONE":T.progress&&T.progress>0||T.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:A&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"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(D=>jsxs("button",{onClick:()=>at(D.id),className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",T.status===D.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:b("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:p?"text-white":"text-gray-900",children:D.label})]},D.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Le(),V(!R);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[T.assignees&&T.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[T.assignees.slice(0,3).map((D,Q)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:D.color||"#8B5CF6"},title:D.name,children:D.initials||D.name.slice(0,2).toUpperCase()},Q)),T.assignees.length>3&&jsxs("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:["+",T.assignees.length-3]})]}):jsx("span",{className:b("text-sm",p?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:b("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:R&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>V(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(D=>{let Q=T.assignees?.some(me=>me.name===D.name);return jsxs("button",{onClick:()=>{let me=T.assignees||[],qe;Q?qe=me.filter(Mt=>Mt.name!==D.name):qe=[...me,D],Ge("assignees",qe);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Q&&(p?"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:D.color||"#8B5CF6"},children:D.initials||D.name.slice(0,2).toUpperCase()}),jsx("span",{className:b("flex-1",p?"text-white":"text-gray-900"),children:D.name}),Q&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},D.name)}):jsx("div",{className:b("px-3 py-4 text-sm text-center",p?"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:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ae(ne?null:"start"),ke(T.startDate||new Date);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[T.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:b("mx-1",p?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),T.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:ne&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ae(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:b("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:b("w-44 py-2 border-r",p?"border-white/10":"border-gray-200"),children:[(()=>{let D=new Date,Q=new Date(D);Q.setDate(D.getDate()+1);let me=new Date(D);me.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let qe=new Date(D);qe.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let Mt=new Date(D);Mt.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let Zt=new Date(D);Zt.setDate(D.getDate()+14);let Dt=new Date(D);return Dt.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:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:me,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:qe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Mt,display:Mt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Zt,display:Zt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Dt,display:Dt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ze,_e)=>jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ne==="start"){let ar=T.endDate&&Ze.date>T.endDate?Ze.date:T.endDate;it(Ze.date,ar),ae("end");}else {let ar=T.startDate&&Ze.date<T.startDate?Ze.date:T.startDate;it(ar,Ze.date),ae(null);}},children:[jsx("span",{children:Ze.label}),jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Ze.display})]},_e))})(),jsx("div",{className:b("border-t mt-2 pt-2",p?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{it(void 0,void 0),ae(null);},className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"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:b("text-xs mb-3 px-2 py-1 rounded",p?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ne==="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:b("font-medium",p?"text-white":"text-gray-900"),children:ie.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ke(new Date),className:b("p-1 rounded text-sm transition-colors",p?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ke(new Date(ie.getFullYear(),ie.getMonth()-1)),className:b("p-1 rounded",p?"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:()=>ke(new Date(ie.getFullYear(),ie.getMonth()+1)),className:b("p-1 rounded",p?"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(D=>jsx("div",{className:b("w-8 h-8 flex items-center justify-center text-xs",p?"text-[#6B7280]":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:_().map((D,Q)=>{let me=D.date.toDateString()===new Date().toDateString(),qe=T.startDate?.toDateString()===D.date.toDateString(),Mt=T.endDate?.toDateString()===D.date.toDateString(),Zt=qe||Mt,Dt=T.startDate&&T.endDate&&D.date>=T.startDate&&D.date<=T.endDate;return jsx("button",{onClick:()=>{let ce=new Date(D.date);if(ne==="start"){let Ze=T.endDate&&ce>T.endDate?ce:T.endDate;it(ce,Ze),ae("end");}else {let Ze=T.startDate&&ce<T.startDate?ce:T.startDate;it(Ze,ce),ae(null);}},className:b("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(p?"text-[#4B5563]":"text-gray-300"),D.isCurrentMonth&&(p?"text-white":"text-gray-900"),me&&"ring-2 ring-[#3B82F6]",qe&&"bg-[#3B82F6] text-white",Mt&&!qe&&"bg-[#7C3AED] text-white",Dt&&!Zt&&(p?"bg-[#7C3AED]/20":"bg-purple-100"),!Zt&&(p?"hover:bg-white/10":"hover:bg-gray-100")),children:D.date.getDate()},Q)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Le(),z(!N);},className:b("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",T.priority==="high"||T.priority==="urgent"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":T.priority==="low"?"bg-green-500/20 text-green-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.priority?T.priority==="high"||T.priority==="urgent"?n==="es"?"Alta":"High":T.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:N&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>z(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"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(D=>jsxs("button",{onClick:()=>{Ge("priority",D.id),z(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",T.priority===D.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:b("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:p?"text-white":"text-gray-900",children:D.label})]},D.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:T.startDate&&T.endDate?`${Math.ceil((T.endDate.getTime()-T.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:b("w-4 h-4 rounded-full border-2",p?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Ne?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:T.progress||0,onChange:D=>{let Q=parseInt(D.target.value),me=T.status;Q===100?me="completed":Q>0?me="in-progress":me="todo";let qe={...T,progress:Q,status:me};we(qe);},onBlur:()=>Ae(false),className:b("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",p?"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-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ae(true),className:b("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",p?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:b("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxs("span",{className:b("text-sm font-medium min-w-[40px]",p?"text-white":"text-gray-900"),children:[T.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(Sr,{selectedTags:T.tags||[],availableTags:m,onChange:D=>{Ge("tags",D);},onCreateTag:i,theme:w})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:b("w-4 h-4 mt-1.5",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24 mt-1",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[T.dependencies&&T.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:T.dependencies.map(D=>{let Q=f.find(me=>me.id===D);return jsxs("span",{className:b("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",p?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[Q?.name||D.slice(0,8),jsx("button",{onClick:()=>{let me=(T.dependencies||[]).filter(qe=>qe!==D);Ge("dependencies",me);},className:b("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{onClick:()=>{Le(),B(!F);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"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:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:F&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{B(false),W("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:b("p-2 border-b",p?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:E,onChange:D=>W(D.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:b("w-full px-3 py-2 rounded-md text-sm outline-none",p?"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:f.length>0?f.filter(D=>D.id!==T.id).filter(D=>E===""||D.name.toLowerCase().includes(E.toLowerCase())).map(D=>{let Q=T.dependencies?.includes(D.id);return jsxs("button",{onClick:()=>{let me=T.dependencies||[],qe;Q?qe=me.filter(Mt=>Mt!==D.id):qe=[...me,D.id],Ge("dependencies",qe);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Q&&(p?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:b("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",Q?"bg-blue-500 border-blue-500":p?"border-white/30":"border-gray-300"),children:Q&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:b("block truncate",p?"text-white":"text-gray-900"),children:D.name}),jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:D.id.slice(0,8)})]})]},D.id)}):jsx("div",{className:b("px-3 py-4 text-sm text-center",p?"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:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Le(),ue(!J);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"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:T.color||"#6366F1"}}),jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:Jr.find(D=>D.value===T.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:b("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:J&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ue(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Jr.map(D=>{let Q=T.color===D.value;return jsx("button",{onClick:()=>{Ge("color",D.value),ue(false);},className:b("w-7 h-7 rounded-full flex items-center justify-center transition-all",Q&&"ring-2 ring-offset-2",p?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:D.value,outlineColor:Q?D.value:void 0},title:D.name,children:Q&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},D.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"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:T.isMilestone||false,onChange:D=>Ge("isMilestone",D.target.checked),className:b("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",T.isMilestone?"bg-purple-500 border-purple-500":p?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:nt,value:He,onChange:D=>se(D.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:b("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",p?"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("button",{className:b("flex items-center gap-2 text-sm mt-2 transition-colors",p?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",T.subtasks&&T.subtasks.length>0&&jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",T.subtasks.filter(D=>D.progress===100).length,"/",T.subtasks.length,")"]})]})}),T.subtasks&&T.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:T.subtasks.map(D=>jsxs("div",{className:b("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",p?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Ye(D.id),className:b("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",D.progress===100?"bg-green-500 border-green-500":p?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:D.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:b("text-sm flex-1",D.progress===100?"line-through text-[#6B7280]":p?"text-white":"text-gray-900"),children:D.name}),jsx("button",{onClick:()=>$e(D.id),className:b("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",p?"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"})})]},D.id))}),Re?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:ze,onChange:D=>Z(D.target.value),onKeyDown:D=>{D.key==="Enter"&&ze.trim()?fe():D.key==="Escape"&&(H(false),Z(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:b("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",p?"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:fe,disabled:!ze.trim(),className:b("px-3 py-2 rounded-lg text-sm font-medium transition-colors",ze.trim()?"bg-blue-500 hover:bg-blue-600 text-white":p?"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:()=>{H(false),Z("");},className:b("p-2 rounded-lg transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>H(true),className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"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:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:b("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(D=>{let Q=le(D.type),me=D.type.startsWith("image/");return jsxs("div",{className:b("flex items-center gap-3 p-2 rounded-lg group transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[me&&D.thumbnailUrl?jsx("img",{src:D.thumbnailUrl,alt:D.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:b("w-10 h-10 rounded flex items-center justify-center",p?"bg-white/10":"bg-gray-200"),children:jsx(Q,{className:b("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:b("text-sm font-medium truncate block hover:underline",p?"text-white":"text-gray-900"),children:D.name}),jsx("p",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:U(D.size)})]}),u&&jsx("button",{onClick:()=>u(D.id),className:b("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",p?"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"})})]},D.id)})}),jsxs("div",{onDragOver:je,onDragLeave:Oe,onDrop:q,className:b("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",be?p?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":p?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",he&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Pe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||he}),he?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:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:b("w-6 h-6 mx-auto mb-2",be?"text-blue-500":p?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:be?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:b("text-xs mt-1",p?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:b("w-80 border-l flex flex-col",p?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:b("px-4 py-3 border-b",p?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]})}),jsx("div",{ref:Y,className:"flex-1 overflow-y-auto p-4",children:y.length>0?jsx("div",{className:"space-y-4",children:[...y].sort((D,Q)=>{let me=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,qe=typeof Q.createdAt=="string"?new Date(Q.createdAt):Q.createdAt;return me.getTime()-qe.getTime()}).map(D=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:D.user?.color||"#8B5CF6"},children:D.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:b("text-sm font-medium",p?"text-white":"text-gray-900"),children:D.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Je(D.createdAt)})]}),jsx("div",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Od,{content:D.content,theme:s})}),D.attachments&&D.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:D.attachments.map(Q=>{let me=Q.type.startsWith("image/");return jsxs("a",{href:Q.url,target:"_blank",rel:"noopener noreferrer",className:b("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[me?jsx(Image,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:b("text-xs truncate max-w-[100px]",p?"text-white":"text-gray-900"),children:Q.name})]},Q.id)})})]})]},D.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:b("w-10 h-10 mb-3",p?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:b("text-sm",p?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:b("p-4 border-t",p?"border-white/10":"border-gray-200"),children:jsx(Rd,{value:ct,onChange:$t,onSubmit:Pa,users:v,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!k,isSubmitting:ge,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:re,onFilesSelect:ee,onRemoveFile:Ke})})]})]})]})})}function Ks(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Mr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:m,error:i,children:c,availableTags:d=[],onCreateTag:u,attachmentsByCard:f,onUploadAttachments:y,onDeleteAttachment:k,comments:g,onAddComment:v,currentUser:h,mentionableUsers:p,onTaskOpen:w}){let[x,S]=Ks(),[T,C]=useState(null),[A,I]=useState(false),N=useRef(null),z=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),R=o?.theme||"dark",V=R==="dark"||R==="neutral",ne=V?"dark":"",ae=useCallback((G,he)=>{t.onCardUpdate?.(G,he);},[t]),ie=useCallback((G,he)=>{t.onColumnUpdate?.(G,{title:he});},[t]),ke=useCallback(G=>{t.onColumnDelete?.(G);},[t]),Ne=["todo","in-progress","completed"],Ae=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),F=useMemo(()=>{let G=new Map;return e.columns.forEach(he=>{let j=he.cardIds.map(He=>e.cards.find(de=>de.id===He)).filter(He=>He!==void 0).sort((He,de)=>He.position-de.position);G.set(he.id,j);}),G},[e.cards,e.columns]);useEffect(()=>{let G=N.current;if(!G)return;let he=Be=>{let nt=Be.target,st=Be.button===1,Xe=nt===G||nt.classList.contains("asakaa-column")&&!nt.closest(".asakaa-card");(st||Be.button===0&&Xe&&!x.isDragging)&&(Be.preventDefault(),I(true),z.current={x:Be.clientX,y:Be.clientY,scrollLeft:G.scrollLeft,scrollTop:G.scrollTop},G.style.cursor="grabbing",G.style.userSelect="none");},j=Be=>{if(!A)return;let nt=Be.clientX-z.current.x,st=Be.clientY-z.current.y;G.scrollLeft=z.current.scrollLeft-nt,G.scrollTop=z.current.scrollTop-st;},He=()=>{A&&(I(false),G.style.cursor="",G.style.userSelect="");},de=()=>{A&&(I(false),G.style.cursor="",G.style.userSelect="");};return G.addEventListener("mousedown",he),document.addEventListener("mousemove",j),document.addEventListener("mouseup",He),G.addEventListener("mouseleave",de),()=>{G.removeEventListener("mousedown",he),document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",He),G.removeEventListener("mouseleave",de);}},[A,x.isDragging]);let B=useMemo(()=>e.cards.map(G=>({id:G.id,name:G.title,startDate:G.startDate?new Date(G.startDate):void 0,endDate:G.endDate?new Date(G.endDate):void 0,progress:G.progress||0,status:G.columnId,priority:G.priority?.toLowerCase(),dependencies:Array.isArray(G.dependencies)?G.dependencies.map(he=>typeof he=="string"?he:he.taskId):[]})),[e.cards]),E=useCallback(G=>{let{active:he}=G,j=e.cards.find(He=>He.id===he.id);j&&S({isDragging:true,draggedCardId:j.id,sourceColumnId:j.columnId,targetColumnId:j.columnId});},[e.cards,S]),W=useCallback(G=>{let{active:he,over:j}=G;if(!j||!e.cards.find(Be=>Be.id===he.id))return;let de=null;j.data.current?.type==="column"?de=j.id:j.data.current?.type==="card"&&(de=e.cards.find(nt=>nt.id===j.id)?.columnId||null),de&&de!==x.targetColumnId&&S({...x,targetColumnId:de});},[e.cards,x,S]),J=useCallback(async G=>{let{active:he,over:j}=G;if(S({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!j)return;let He=e.cards.find(st=>st.id===he.id);if(!He)return;let de,Be;if(j.data.current?.type==="column"){de=j.id;let st=F.get(de)||[];Be=Is(st,0);}else {let st=e.cards.find(ct=>ct.id===j.id);if(!st)return;de=st.columnId;let Xe=F.get(de)||[],kt=Xe.findIndex(ct=>ct.id===j.id);Be=Is(Xe,kt);}let nt=e.columns.find(st=>st.id===de);if(nt&&nt.wipLimit&&nt.wipLimitType==="hard"){let st=F.get(de)||[];if(He.columnId!==de&&st.length>=nt.wipLimit){t.onWipLimitExceeded?.(nt,He);return}}(He.columnId!==de||He.position!==Be)&&await t.onCardMove?.(He.id,de,Be);},[e.cards,e.columns,F,t,S]),ue=useCallback(G=>{C(G),a?.(G),w?.(G.id);},[a,w]),be=useCallback(G=>{t.onCardUpdate?.(G.id,G),C(G);},[t]);return m?jsx("div",{className:b("asakaa-board",ne,n),style:l,children:jsx(bf,{columnCount:3})}):i?jsx("div",{className:b("asakaa-board",ne,n),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(pd,{themeName:R,children:[jsxs(DndContext,{sensors:Ae,collisionDetection:closestCorners,onDragStart:E,onDragOver:W,onDragEnd:J,children:[jsxs("div",{ref:N,className:b("asakaa-board",ne,n),style:{...l,cursor:A?"grabbing":void 0},"data-theme":R,children:[e.columns.sort((G,he)=>G.position-he.position).map(G=>{let he=F.get(G.id)||[],j=!Ne.includes(G.id);return jsx(bo,{column:G,cards:he,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:ue,onCardUpdate:ae,onColumnRename:ie,onColumnDelete:ke,isDeletable:j,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},G.id)}),c]}),jsx(DragOverlay,{children:x.draggedCardId?jsx(gr,{card:e.cards.find(G=>G.id===x.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(fr,{task:T,isOpen:!!T,onClose:()=>C(null),onCardUpdate:be,theme:V?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:u,attachments:T?f?.get(T.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:k,availableTasks:B,comments:g,onAddComment:v,currentUser:h,mentionableUsers:p})]})}function bf({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 kf={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},wf={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:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Cf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Tf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Nf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),n(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,c)=>i.position-c.position).map((i,c)=>jsxs(motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Df({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,m]=useState(null),i=useRef(null);if(useEffect(()=>{let f=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(f=>f.handler),u=async(f,y)=>{if(y){m(f);try{await y();}catch(k){console.error(`Export ${f} failed:`,k);}finally{m(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((f,y)=>jsxs(motion.button,{onClick:()=>u(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function Sf({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, #3B82F6 0%, #2563EB 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:t})]})}function qs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:m,translations:i}){let c=r==="dark"?kf:wf,d={...o==="es"?Cf:Tf,...i},u=n||l||m;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxs(Fragment,{children:[jsx(Df,{theme:c,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:m}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsx(Nf,{columns:e,onSelect:t,theme:c,t:d,createTaskLabel:a}):jsx(Sf,{onClick:()=>t(),label:a||d.newTask}))]})})}function Js({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(""),i=useCallback(()=>{let u=l.trim();u&&(e(u),m(""),n(false));},[l,e]),c=useCallback(u=>{u.key==="Enter"?(u.preventDefault(),i()):u.key==="Escape"&&(m(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsx("div",{className:b("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:u=>m(u.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{m(""),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:b("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 Zs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:m="es"}){let[i,c]=useState(false),[d,u]=useState(false),[f,y]=useState(""),[k,g]=useState([]),[v,h]=useState(""),[p,w]=useState(""),[x,S]=useState(""),[T,C]=useState(false),[A,I]=useState(false),[N,z]=useState(false),R=useRef(null),V=useRef(null),ne={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},ae=useCallback(()=>{y(""),g([]),h(""),w(""),S(""),C(false),I(false),z(false),c(false);},[]);useEffect(()=>{i&&R.current&&R.current.focus();},[i]),useEffect(()=>{if(!i)return;let F=B=>{V.current&&!V.current.contains(B.target)&&(f.trim()||ae());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[i,f,ae]);let ie=useCallback(async()=>{let F=f.trim();if(!(!F||d)){u(true);try{await t({name:F,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:v?new Date(v):void 0,endDate:p?new Date(p):void 0,priority:x||void 0}),y(""),g([]),h(""),w(""),S(""),C(!1),I(!1),z(!1),R.current?.focus();}catch(B){console.error("Error creating card:",B);}finally{u(false);}}},[f,e,k,v,p,x,t,d]),ke=useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),ie()):F.key==="Escape"&&ae();},[ie,ae]),Ne=useCallback(F=>{g(B=>B.includes(F)?B.filter(E=>E!==F):[...B,F]);},[]),Ae=l==="dark";return i?jsxs("div",{ref:V,className:b("rounded-lg overflow-hidden shadow-lg",Ae?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:R,type:"text",value:f,onChange:F=>y(F.target.value),onKeyDown:ke,placeholder:ne.placeholder,disabled:d,className:b("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ae?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>C(!T),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||k.length>0?"bg-emerald-500/20 text-emerald-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.addAssignee,children:[jsxs("svg",{width:"14",height:"14",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"})]}),k.length>0&&jsx("span",{className:"ml-0.5",children:k.length})]}),jsx("button",{onClick:()=>I(!A),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||v||p?"bg-blue-500/20 text-blue-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.addDates,children:jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>z(!N),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||x?x==="urgent"?"bg-red-500/20 text-red-400":x==="high"?"bg-orange-500/20 text-orange-400":x==="medium"?"bg-yellow-500/20 text-yellow-400":x==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ne.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:ie,disabled:!f.trim()||d,className:b("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):ne.save})]})]}),T&&a.length>0&&jsx("div",{className:b("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxs("button",{onClick:()=>Ne(F.id),className:b("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(F.id)?"bg-emerald-500 text-white":Ae?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:b("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(F.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:F.name.charAt(0).toUpperCase()}),jsx("span",{children:F.name.split(" ")[0]})]},F.id))})}),A&&jsx("div",{className:b("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:ne.startDate}),jsx("input",{type:"date",value:v,onChange:F=>h(F.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:ne.endDate}),jsx("input",{type:"date",value:p,onChange:F=>w(F.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsx("div",{className:b("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsx("button",{onClick:()=>S(x===F?"":F),className:b("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",x===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:Ae?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ne[F]},F))})})]}):jsxs("button",{onClick:()=>c(true),disabled:n,className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ae?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsx("span",{className:"text-sm font-medium",children:ne.buttonLabel})]})}var _o=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(Mr,{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(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=id(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=id(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((f,y)=>{i[f]=l[y]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),u={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(u),d.cardIds.push(u.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function id(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 ld(e,t){switch(t){case "json":return Qu(e);case "csv":return eg(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function dd(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 zs=createContext(null);function cd(){return useContext(zs)}var md=createContext(null);function pd({children:e,themeName:t}){return jsx(md.Provider,{value:{themeName:t},children:e})}function uo(){return useContext(md)}function gt({children:e,container:t}){let[a,r]=useState(false),o=cd(),s=uo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:m}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":m,"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 hd={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},lg="#BDC3C7",dg=({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 Kr({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),m=useRef(null),i=()=>{if(!m.current)return;let f=m.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,g=160,v=220,h=4,p=f.right-g;p<10&&(p=f.left),p+g>k-10&&(p=k-g-10);let w=y-f.bottom,x=f.top,S;w>=v+h?S=f.bottom+h:x>=v+h?S=f.top-v-h:S=w>=x?f.bottom+h:Math.max(10,f.top-v-h),n({top:S,left:p}),o(true);};useEffect(()=>{let f=y=>{l.current&&!l.current.contains(y.target)&&!m.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),useEffect(()=>{let f=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let c=f=>{t(f),o(false);},d=e?hd[e]:null,u=d?.color||lg;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:m,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?`${u}10`:"transparent",boxShadow:e?`0 0 0 2px ${u}30 inset`:"none"},title:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:u,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:u,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(gt,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(hd).map(([f,y])=>jsxs("button",{onClick:()=>c(f),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsx(dg,{color:y.color}),jsx("span",{className:"font-semibold text-sm",children:y.label}),e===f&&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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>c(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter: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("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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var cg=[{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 Ro({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),u=(uo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let p=i.current.getBoundingClientRect(),w=window.innerHeight,x=window.innerWidth,S=320,T=380,C=4,A=p.left;A+S>x-10&&(A=x-S-10),A<10&&(A=10);let I=w-p.bottom,N=p.top,z;I>=T+C?z=p.bottom+C:N>=T+C?z=p.top-T-C:z=I>=N?p.bottom+C:Math.max(10,p.top-T-C),l({top:z,left:A}),s(true);};useEffect(()=>{let p=w=>{m.current&&!m.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]),useEffect(()=>{let p=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[o]);let y=p=>{let w=new Date,x=A=>{let I=A.getFullYear(),N=String(A.getMonth()+1).padStart(2,"0"),z=String(A.getDate()).padStart(2,"0");return `${I}-${N}-${z}`},S=x(w),T=new Date(w);T.setDate(T.getDate()+p);let C=x(T);a(S,C),s(false);},k=()=>{if(!e||!t)return "Set date";let p=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=T.split("-").map(Number);if(C.length!==3||C.some(z=>isNaN(z)))return null;let A=C[0],I=C[1],N=C[2];return A===void 0||I===void 0||N===void 0?null:new Date(A,I-1,N)},w=p(e),x=p(t);if(!w||!x||isNaN(w.getTime())||isNaN(x.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[w.getMonth()]} ${w.getDate()} \u2013 ${S[x.getMonth()]} ${x.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let p=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),p<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):f(),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:g?`${k()}`:"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:k()})]}),o&&jsx(gt,{children:jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:u?"#1A1D25":"#FFFFFF",border:`1px solid ${u?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:u?"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:u?"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:u?"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:cg.map(p=>jsx("button",{onClick:()=>y(p.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:p.label},p.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:u?"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:p=>a(p.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:p=>a(e,p.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:u?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:u?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:u?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:u?"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:p=>{p.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:p=>{p.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function qr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[l,m]=useState(""),[i,c]=useState({top:0,left:0}),d=useRef(null),u=useRef(null),f=()=>{if(!u.current)return;let h=u.current.getBoundingClientRect(),p=window.innerHeight,w=window.innerWidth,x=300,S=380,T=4,C=h.right-x;C<10&&(C=h.left),C+x>w-10&&(C=w-x-10);let A=p-h.bottom,I=h.top,N;A>=S+T?N=h.bottom+T:I>=S+T?N=h.top-S-T:N=A>=I?h.bottom+T:Math.max(10,h.top-S-T),c({top:N,left:C}),n(true);};useEffect(()=>{let h=p=>{d.current&&!d.current.contains(p.target)&&!u.current?.contains(p.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=p=>{p.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let y=h=>{let p=e.some(w=>w.id===h.id);a(p?e.filter(w=>w.id!==h.id):[...e,h]);},k=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),g=e.slice(0,o),v=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:u,onClick:()=>s?n(false):f(),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:[g.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)),v>0&&jsxs("div",{className:"asakaa-avatar",children:["+",v]})]}):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(gt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange:h=>m(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:k.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"}):k.map(h=>{let p=e.some(w=>w.id===h.id);return jsxs("button",{onClick:()=>y(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:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor: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:p?"#3b82f6":"transparent"},children:p?"\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 vn(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(m),false};return l(a)}function zo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,m]=useState(false),[i,c]=useState(""),[d,u]=useState(t.length>0),[f,y]=useState({top:0,left:0}),[k,g]=useState(null),v=useRef(null),h=useRef(null),p=()=>{if(!h.current)return;let C=h.current.getBoundingClientRect(),A=window.innerHeight,I=window.innerWidth,N=300,z=d?380:120,R=4,_=C.right-N;_<10&&(_=C.left),_+N>I-10&&(_=I-N-10);let se=A-C.bottom,te=C.top,ie;se>=z+R?ie=C.bottom+R:te>=z+R?ie=C.top-z-R:ie=se>=te?C.bottom+R:Math.max(10,C.top-z-R),y({top:ie,left:_}),m(true);};useEffect(()=>{if(!l||!h.current)return;let C=h.current.getBoundingClientRect(),A=window.innerHeight,I=window.innerWidth,N=300,z=d?380:120,R=4,_=C.right-N;_<10&&(_=C.left),_+N>I-10&&(_=I-N-10);let se=A-C.bottom,te=C.top,ie;se>=z+R?ie=C.bottom+R:te>=z+R?ie=C.top-z-R:ie=se>=te?C.bottom+R:Math.max(10,C.top-z-R),y({top:ie,left:_});},[d,l]),useEffect(()=>{let C=A=>{v.current&&!v.current.contains(A.target)&&!h.current?.contains(A.target)&&(m(false),c(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),useEffect(()=>{let C=A=>{A.key==="Escape"&&(m(false),c(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let w=C=>{let A=t.includes(C),I=a.find(N=>N.id===C);if(g(null),A){let N=t.filter(z=>z!==C);r(N),N.length===0&&u(false);}else {if(s&&vn(a,C,e)){let z=`Cannot add "${I?.title||C}" as dependency - would create circular reference`;g(z),n?.(C,I?.title||C),setTimeout(()=>g(null),3e3);return}r([...t,C]),u(true);}},x=()=>{let C=!d;u(C),C||r([]);},S=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:h,onClick:()=>l?m(false):p(),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:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),l&&jsx(gt,{children:jsxs("div",{ref:v,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[k&&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:k})]}),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:x,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:C=>c(C.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:S.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"}):S.map(C=>{let A=t.includes(C.id);return jsxs("button",{onClick:()=>w(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:A?"#3b82f6":"transparent",borderColor:A?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:A&&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:C.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),u(false),m(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 gr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:u,transition:f,isDragging:y}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:fn.Transform.toString(u),transition:f};if(t)return jsx("div",{ref:d,style:k,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=l.filter(w=>e.assignedUserIds?.includes(w.id)),v=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),p={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:p,className:b("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),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:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,x)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:S=>{S.currentTarget.style.display="none";}}),x===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]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:v?"line-through":"none",opacity:v?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(Kr,{priority:e.priority,onChange:w=>n?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Ro,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,x)=>n?.(e.id,{startDate:w,endDate:x})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(qr,{assignedUsers:g,availableUsers:l,onChange:w=>n?.(e.id,{assignedUserIds:w.map(x=>x.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(zo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:m,onChange:w=>n?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},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:"#3B82F6"}})})]})]})},(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&&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)));gr.displayName="Card";var xn={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"}},Sd=({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 Ed({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),c=[...Object.entries(xn).map(([g,v])=>({id:g,label:v.label,color:v.color,icon:v.icon})),...r.filter(g=>!Object.keys(xn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=xn[e];if(g)return {...g,id:e};let v=r.find(h=>h.id===e);return v?{id:v.id,label:v.title,color:v.color||"#8B5CF6",icon:"circle-dot"}:{...xn.todo,id:"todo"}},u=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),v=window.innerHeight,h=window.innerWidth,p=180,w=280,x=4,S=g.right-p;S<10&&(S=g.left),S+p>h-10&&(S=h-p-10);let T=v-g.bottom,C=g.top,A;T>=w+x?A=g.bottom+x:C>=w+x?A=g.top-w-x:A=T>=C?g.bottom+x:Math.max(10,g.top-w-x),l({top:A,left:S}),s(true);};useEffect(()=>{let g=v=>{m.current&&!m.current.contains(v.target)&&!i.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),useEffect(()=>{let g=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},y=d(),k=y.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):u(),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:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:y.label,children:jsx(Sd,{icon:y.icon,color:k})}),o&&jsx(gt,{children:jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:c.map(g=>jsxs("button",{onClick:()=>f(g.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:g.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsx(Sd,{icon:g.icon,color:g.color}),jsx("span",{className:"font-semibold",children:g.label}),e===g.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function Pd({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[l,m]=useState(false),[i,c]=useState(e),[d,u]=useState({top:0,left:0}),f=useRef(null),y=useRef(null),k=useRef(null);useEffect(()=>{if(s&&y.current){let p=y.current.getBoundingClientRect();u({top:p.bottom+window.scrollY+8,left:p.left+window.scrollX});}},[s]),useEffect(()=>{let p=w=>{f.current&&!f.current.contains(w.target)&&!y.current?.contains(w.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]),useEffect(()=>{let p=w=>{w.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[s,e]),useEffect(()=>{l&&k.current&&(k.current.focus(),k.current.select());},[l]);let g=()=>{m(true),c(e);},v=()=>{let p=i.trim();p&&p!==e&&t(p),m(false),n(false),c(e);},h=p=>{p.key==="Enter"?v():p.key==="Escape"&&(m(false),c(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:y,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",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"})]})}),s&&jsx(gt,{children:jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:k,type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:h,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:g,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:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),n(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:"Delete"})]})]})]})})})]})}var bo=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:u,onToggleCollapse:f,onColumnRename:y,onColumnDelete:k,isDeletable:g=false,className:v})=>{let{setNodeRef:h,isOver:p}=useDroppable({id:e.id,data:{type:"column",column:e}}),w=useRef(null),x=c??td(t.length),S=useVirtualizer({count:t.length,getScrollElement:()=>w.current,estimateSize:()=>d,enabled:x});if(a)return jsx("div",{ref:h,className:v,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let N=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:N}:N>=80?{state:"warning",percentage:N}:N>=60?{state:"approaching",percentage:N}:{state:"ok",percentage:N}})(),A=C.state==="exceeded",I=()=>"asakaa-column-count";return jsxs("div",{ref:h,className:b("asakaa-column",p&&"ring-2 ring-asakaa-accent-blue",A&&"ring-2 ring-asakaa-accent-red",v),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:b(I()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.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"})]}),C.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"})]}),C.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"})}),C.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(y||k)&&jsx(Pd,{columnTitle:e.title,onRename:N=>y?.(e.id,N),onDelete:k?()=>k(e.id):void 0,isDeletable:g}),f&&jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":u?"Expand column":"Collapse column",children:u?"\u25B6":"\u25BC"})]})]}),!u&&jsx("div",{ref:w,className:"asakaa-column-cards",style:{maxHeight:x?"600px":void 0},children:jsx(SortableContext,{items:t.map(N=>N.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"})}):x?jsx("div",{style:{height:`${S.getTotalSize()}px`,position:"relative"},children:S.getVirtualItems().map(N=>{let z=t[N.index];return z?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${N.start}px)`},children:jsx(gr,{card:z,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i})},z.id):null})}):t.map(N=>jsx(gr,{card:N,render:r,onClick:n,onUpdate:l,availableUsers:m,allCards:i},N.id))})})]})});bo.displayName="Column";function Gs({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let m=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?m():c.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:m,onKeyDown:i,className:b("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:b("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Mg(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 Bd(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let m=l.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Fg(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ag(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Lg=["\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 Rd({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:u=[],onFilesSelect:f,onRemoveFile:y,maxFileSizeMB:k=10}){let g=l==="dark",[v,h]=useState(false),[p,w]=useState([]),[x,S]=useState(0),[T,C]=useState(null),[A,I]=useState(false),N=useRef(null),z=useRef(null),R=useRef(null),_=useRef(null),se=useCallback((E,W)=>{let J=Mg(E,W);if(C(J),J){let ue=r.filter(be=>be.name.toLowerCase().includes(J.query)||be.email&&be.email.toLowerCase().includes(J.query)).slice(0,5);w(ue),h(ue.length>0),S(0);}else h(false),w([]);},[r]),te=E=>{let W=E.target.value;t(W),se(W,E.target.selectionStart||0);},ie=()=>{N.current&&se(e,N.current.selectionStart||0);},xe=useCallback(E=>{if(!T||!N.current)return;let W=e.slice(0,T.start),J=e.slice(T.end),ue=`@${E.name.replace(/\s+/g,"")} `,be=W+ue+J;t(be),h(false),C(null),setTimeout(()=>{if(N.current){let Ce=T.start+ue.length;N.current.selectionStart=Ce,N.current.selectionEnd=Ce,N.current.focus();}},0);},[T,e,t]),Ne=E=>{if(v&&p.length>0)switch(E.key){case "ArrowDown":E.preventDefault(),S(W=>W<p.length-1?W+1:0);break;case "ArrowUp":E.preventDefault(),S(W=>W>0?W-1:p.length-1);break;case "Enter":{E.preventDefault();let W=p[x];W&&xe(W);break}case "Tab":{E.preventDefault();let W=p[x];W&&xe(W);break}case "Escape":E.preventDefault(),h(false);break}else E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),a());};useEffect(()=>{let E=W=>{z.current&&!z.current.contains(W.target)&&N.current&&!N.current.contains(W.target)&&h(false),_.current&&!_.current.contains(W.target)&&I(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);let Ae=useCallback(E=>{if(!N.current)return;let W=N.current.selectionStart||e.length,J=e.slice(0,W)+E+e.slice(W);t(J),I(false),setTimeout(()=>{if(N.current){let ue=W+E.length;N.current.selectionStart=ue,N.current.selectionEnd=ue,N.current.focus();}},0);},[e,t]),F=useCallback(E=>{if(!f||!E.target.files)return;let W=Array.from(E.target.files),J=k*1024*1024,ue=W.filter(be=>be.size>J?(console.warn(`File ${be.name} exceeds max size of ${k}MB`),false):true);ue.length>0&&f(ue),E.target.value="";},[f,k]),B=useCallback(E=>E.type.startsWith("image/")?Image:E.type.includes("pdf")||E.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(v&&z.current){let E=z.current.children[x];E&&E.scrollIntoView({block:"nearest"});}},[x,v]),jsxs("div",{className:"flex flex-col gap-2",children:[u.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:u.map(E=>{let W=B(E.file),J=E.file.type.startsWith("image/");return jsxs("div",{className:b("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[J&&E.preview?jsx("img",{src:E.preview,alt:E.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(W,{className:b("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:b("text-xs truncate",g?"text-white":"text-gray-900"),children:E.file.name}),jsx("p",{className:b("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Ag(E.file.size)})]}),y&&jsx("button",{onClick:()=>y(E.id),className:b("p-0.5 rounded-full transition-colors",g?"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"})})]},E.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:b("flex-1 relative min-w-0"),children:[jsxs("div",{className:b("flex items-center gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!A),disabled:s||n,className:b("p-1 rounded transition-colors flex-shrink-0",g?"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:A&&jsx(motion.div,{ref:_,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:b("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"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:Lg.map(E=>jsx("button",{type:"button",onClick:()=>Ae(E),className:b("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:E},E))})})})]}),d&&f&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>R.current?.click(),disabled:s||n,className:b("p-1.5 rounded transition-colors",g?"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:m==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:R,type:"file",multiple:true,onChange:F,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("input",{ref:N,type:"text",value:e,onChange:te,onSelect:ie,onKeyDown:Ne,placeholder:o||(m==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,className:b("flex-1 bg-transparent text-sm outline-none min-w-[100px]",g?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400",(s||n)&&"opacity-50")}),jsx("button",{onClick:a,disabled:n||!e.trim()&&u.length===0||s,className:b("p-1.5 rounded transition-colors",(e.trim()||u.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"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:v&&p.length>0&&jsx(motion.div,{ref:z,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:b("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.map((E,W)=>jsxs("button",{type:"button",onClick:()=>xe(E),className:b("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",W===x?g?"bg-white/10":"bg-gray-100":g?"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:E.color||"#8B5CF6"},children:Fg(E.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:b("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:E.name}),E.email&&jsx("p",{className:b("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:E.email})]})]},E.id))})})]})]})]})}function Od({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,m)=>l.type==="mention"?jsx("span",{className:b("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},m):jsx("span",{children:l.value},m))})}var Nn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Sr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,m]=useState(false),[i,c]=useState(""),[d,u]=useState(false),[f,y]=useState(Nn[10]||"#3B82F6"),[k,g]=useState({top:0,left:0}),v=useRef(null),h=useRef(null),p=useRef(null),w=useRef(null),x=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),S=t.some(N=>N.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&h.current){let N=h.current.getBoundingClientRect();g({top:N.bottom+6,left:N.left});}},[l]),useEffect(()=>{let N=z=>{let R=z.target,_=v.current?.contains(R),se=p.current?.contains(R);!_&&!se&&(m(false),c(""),u(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let T=N=>{let z=e.some(R=>R.id===N.id);a(z?e.filter(R=>R.id!==N.id):[...e,N]);},C=async()=>{if(!(!r||!i.trim())){u(true);try{let N=await r(i.trim(),f);N&&(a([...e,N]),c(""),y(Nn[Math.floor(Math.random()*Nn.length)]||"#3B82F6"));}finally{u(false);}}},A=(N,z)=>{z.stopPropagation(),a(e.filter(R=>R.id!==N));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:v,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:p,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:k.top,left:k.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:N=>c(N.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:N=>{N.key==="Enter"&&i.trim()&&!S&&r&&C();}})}),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(N=>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:`${N.color}20`,color:N.color},onClick:z=>A(N.id,z),children:[N.name,jsx(X,{className:"w-3 h-3"})]},N.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:x.length>0?x.map(N=>{let z=e.some(R=>R.id===N.id);return jsxs("button",{type:"button",onClick:()=>T(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:z?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:R=>{z||(R.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:R=>{z||(R.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsx("span",{className:"flex-1 text-left",children:N.name}),z&&jsx(Check,{className:"w-4 h-4",style:{color:N.color}})]},N.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()&&!S&&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:Nn.map(N=>jsx("button",{type:"button",onClick:()=>y(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:f===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxs("button",{type:"button",onClick:C,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Vs({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 Ud({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(Vs,{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 Jr=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{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 Kd(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}}return e}function rf(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 fr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:u,availableTasks:f=[],comments:y=[],onAddComment:k,currentUser:g,mentionableUsers:v=[],onUploadCommentAttachments:h}){let p=s==="dark",w={textTertiary:p?"#6B7280":"#9CA3AF",textSecondary:p?"#9CA3AF":"#6B7280",textPrimary:p?"#FFFFFF":"#111827",borderLight:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:p?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:p?"#1A1D25":"#FFFFFF",bgSecondary:p?"#0F1117":"#F9FAFB",hoverBg:p?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},x=e&&"title"in e&&!("name"in e),S=e,[T,C]=useState(e?Kd(e,l):null),[A,I]=useState(false),[N,z]=useState(false),[R,_]=useState(false),[se,te]=useState(null),[ie,xe]=useState(new Date),[Ne,Ae]=useState(false),[F,B]=useState(false),[E,W]=useState(""),[J,ue]=useState(false),[be,Ce]=useState(false),[Y,V]=useState(false),[Oe,pe]=useState(""),Le=useRef(null),Je=useRef(null),[st,Ge]=useState(""),bt=useRef(null),[ut,Pt]=useState(""),[ge,L]=useState(false),[re,Te]=useState([]),[Ue,Z]=useState(""),[Re,H]=useState(false),K=useRef(null);useEffect(()=>{if(e){let D=Kd(e,l);C(D),pe(D.description||""),Ge(D.name||"");}},[e?.id,l]),useEffect(()=>{if(!t||!Oe)return;let D=setTimeout(()=>{let Q=Je.current;Q&&(Q.style.height="auto",Q.style.height=`${Math.max(100,Q.scrollHeight)}px`);},50);return ()=>clearTimeout(D)},[t,Oe]),useEffect(()=>()=>{Le.current&&clearTimeout(Le.current),bt.current&&clearTimeout(bt.current);},[]),useEffect(()=>{t&&K.current&&y.length>0&&setTimeout(()=>{K.current&&(K.current.scrollTop=K.current.scrollHeight);},100);},[t,y.length]);let ke=useCallback(D=>{C(D),x&&o&&S?o(rf(D,S)):r&&r(D);},[x,S,o,r]),Ie=useCallback(()=>{I(false),z(false),_(false),te(null),B(false),W(""),ue(false);},[]),_e=useCallback((D,Q)=>{if(!T)return;let ce={...T,[D]:Q};ke(ce);},[T,ke]),We=useCallback(()=>{let D=Je.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),ne=useCallback(D=>{pe(D),setTimeout(We,0),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{if(T){let Q={...T,description:D};ke(Q);}},800);},[T,ke,We]),Be=useCallback(D=>{Ge(D),bt.current&&clearTimeout(bt.current),bt.current=setTimeout(()=>{if(T&&D.trim()){let Q={...T,name:D.trim()};ke(Q);}},800);},[T,ke]),ee=useCallback(D=>{let Q=D.map(ce=>{let Xe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ce};return ce.type.startsWith("image/")&&(Xe.preview=URL.createObjectURL(ce)),Xe});Te(ce=>[...ce,...Q]);},[]),Ye=useCallback(D=>{Te(Q=>{let ce=Q.find(Xe=>Xe.id===D);return ce?.preview&&URL.revokeObjectURL(ce.preview),Q.filter(Xe=>Xe.id!==D)});},[]),Pa=useCallback(async()=>{if(!(!T||!ut.trim()&&re.length===0||!k)){L(true);try{let D=Bd(ut,v),Q=[];if(re.length>0&&h){let ce=re.map(Xe=>Xe.file);Q=await h(ce);}await k(T.id,ut.trim(),D.length>0?D:void 0,Q.length>0?Q:void 0),Pt(""),re.forEach(ce=>{ce.preview&&URL.revokeObjectURL(ce.preview);}),Te([]);}finally{L(false);}}},[T,ut,re,k,v,h]),fe=useCallback(()=>{if(!T||!Ue.trim())return;let D={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Ue.trim(),progress:0,startDate:new Date,endDate:new Date},Q=[...T.subtasks||[],D],ce={...T,subtasks:Q};ke(ce),Z(""),H(false);},[T,Ue,ke]),qe=useCallback(D=>{if(!T?.subtasks)return;let Q=T.subtasks.map(Xe=>Xe.id===D?{...Xe,progress:Xe.progress===100?0:100}:Xe),ce={...T,subtasks:Q};ke(ce);},[T,ke]),He=useCallback(D=>{if(!T?.subtasks)return;let Q=T.subtasks.filter(Xe=>Xe.id!==D),ce={...T,subtasks:Q};ke(ce);},[T,ke]),Ze=useCallback(D=>{let Q=typeof D=="string"?new Date(D):D,Xe=new Date().getTime()-Q.getTime(),Ft=Math.floor(Xe/6e4),Zt=Math.floor(Xe/36e5),Dt=Math.floor(Xe/864e5);return Ft<1?n==="es"?"Ahora":"Just now":Ft<60?n==="es"?`Hace ${Ft} min`:`${Ft}m ago`:Zt<24?n==="es"?`Hace ${Zt}h`:`${Zt}h ago`:Dt<7?n==="es"?`Hace ${Dt}d`:`${Dt}d ago`:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),rt=useCallback(D=>{if(!T)return;let Q=T.progress||0;D==="completed"?Q=100:D==="in-progress"&&Q===0?Q=10:D==="todo"&&(Q=0);let ce={...T,status:D,progress:Q};ke(ce),I(false);},[T,ke]),it=useCallback((D,Q)=>{if(!T)return;let ce={...T,startDate:D,endDate:Q};ke(ce);},[T,ke]),G=useCallback(()=>{let D=ie.getFullYear(),Q=ie.getMonth(),ce=new Date(D,Q,1),Ft=new Date(D,Q+1,0).getDate(),Zt=ce.getDay(),Dt=[],de=new Date(D,Q,0).getDate();for(let Ve=Zt-1;Ve>=0;Ve--)Dt.push({date:new Date(D,Q-1,de-Ve),isCurrentMonth:false});for(let Ve=1;Ve<=Ft;Ve++)Dt.push({date:new Date(D,Q,Ve),isCurrentMonth:true});let Qe=42-Dt.length;for(let Ve=1;Ve<=Qe;Ve++)Dt.push({date:new Date(D,Q+1,Ve),isCurrentMonth:false});return Dt},[ie]),q=useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),Ce(false),!T||!d)return;let Q=Array.from(D.dataTransfer.files);if(Q.length!==0){V(true);try{await d(T.id,Q);}finally{V(false);}}},[T,d]),Pe=useCallback(async D=>{if(!T||!d||!D.target.files)return;let Q=Array.from(D.target.files);if(Q.length!==0){V(true);try{await d(T.id,Q);}finally{V(false);}D.target.value="";}},[T,d]),Ke=useCallback(D=>{D.preventDefault(),D.stopPropagation(),Ce(true);},[]),ze=useCallback(D=>{D.preventDefault(),D.stopPropagation(),Ce(false);},[]),U=useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),le=useCallback(D=>D.startsWith("image/")?Image:D.includes("pdf")||D.includes("document")?FileText:File,[]);return !t||!T?null:jsx(AnimatePresence,{children:t&&T&&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:b("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",p?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:b("px-6 py-3 border-b flex items-center gap-3",p?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:b("text-xs px-2 py-0.5 rounded",p?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:b("text-xs font-mono",p?"text-[#6B7280]":"text-gray-400"),children:T.id.slice(0,8)}),jsxs("button",{className:b("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",p?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsx(Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsx("div",{className:"flex-1"}),jsx("button",{className:b("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:b("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:a,className:b("p-1.5 rounded transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let D=T.progress===100?0:100,ce={...T,progress:D,status:D===100?"completed":"todo"};ke(ce);},className:b("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",T.progress===100?"bg-green-500 border-green-500":p?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:T.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:st,onChange:D=>Be(D.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:b("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",T.progress===100?"line-through text-[#6B7280]":p?"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:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ie(),I(!A);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",T.progress===100||T.status==="completed"?"bg-green-500/20 text-green-400":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/20 text-blue-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.progress===100||T.status==="completed"?n==="es"?"COMPLETADO":"DONE":T.progress&&T.progress>0||T.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:A&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>I(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"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(D=>jsxs("button",{onClick:()=>rt(D.id),className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",T.status===D.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:b("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:p?"text-white":"text-gray-900",children:D.label})]},D.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ie(),_(!R);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[T.assignees&&T.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[T.assignees.slice(0,3).map((D,Q)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:D.color||"#8B5CF6"},title:D.name,children:D.initials||D.name.slice(0,2).toUpperCase()},Q)),T.assignees.length>3&&jsxs("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:["+",T.assignees.length-3]})]}):jsx("span",{className:b("text-sm",p?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:b("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:R&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>_(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(D=>{let Q=T.assignees?.some(ce=>ce.name===D.name);return jsxs("button",{onClick:()=>{let ce=T.assignees||[],Xe;Q?Xe=ce.filter(Ft=>Ft.name!==D.name):Xe=[...ce,D],_e("assignees",Xe);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Q&&(p?"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:D.color||"#8B5CF6"},children:D.initials||D.name.slice(0,2).toUpperCase()}),jsx("span",{className:b("flex-1",p?"text-white":"text-gray-900"),children:D.name}),Q&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},D.name)}):jsx("div",{className:b("px-3 py-4 text-sm text-center",p?"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:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{te(se?null:"start"),xe(T.startDate||new Date);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[T.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:b("mx-1",p?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),T.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:se&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:b("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:b("w-44 py-2 border-r",p?"border-white/10":"border-gray-200"),children:[(()=>{let D=new Date,Q=new Date(D);Q.setDate(D.getDate()+1);let ce=new Date(D);ce.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let Xe=new Date(D);Xe.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let Ft=new Date(D);Ft.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let Zt=new Date(D);Zt.setDate(D.getDate()+14);let Dt=new Date(D);return Dt.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:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ce,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Xe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ft,display:Ft.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Zt,display:Zt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Dt,display:Dt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Qe,Ve)=>jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(se==="start"){let ar=T.endDate&&Qe.date>T.endDate?Qe.date:T.endDate;it(Qe.date,ar),te("end");}else {let ar=T.startDate&&Qe.date<T.startDate?Qe.date:T.startDate;it(ar,Qe.date),te(null);}},children:[jsx("span",{children:Qe.label}),jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Qe.display})]},Ve))})(),jsx("div",{className:b("border-t mt-2 pt-2",p?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{it(void 0,void 0),te(null);},className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",p?"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:b("text-xs mb-3 px-2 py-1 rounded",p?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:se==="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:b("font-medium",p?"text-white":"text-gray-900"),children:ie.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>xe(new Date),className:b("p-1 rounded text-sm transition-colors",p?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>xe(new Date(ie.getFullYear(),ie.getMonth()-1)),className:b("p-1 rounded",p?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>xe(new Date(ie.getFullYear(),ie.getMonth()+1)),className:b("p-1 rounded",p?"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(D=>jsx("div",{className:b("w-8 h-8 flex items-center justify-center text-xs",p?"text-[#6B7280]":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:G().map((D,Q)=>{let ce=D.date.toDateString()===new Date().toDateString(),Xe=T.startDate?.toDateString()===D.date.toDateString(),Ft=T.endDate?.toDateString()===D.date.toDateString(),Zt=Xe||Ft,Dt=T.startDate&&T.endDate&&D.date>=T.startDate&&D.date<=T.endDate;return jsx("button",{onClick:()=>{let de=new Date(D.date);if(se==="start"){let Qe=T.endDate&&de>T.endDate?de:T.endDate;it(de,Qe),te("end");}else {let Qe=T.startDate&&de<T.startDate?de:T.startDate;it(Qe,de),te(null);}},className:b("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(p?"text-[#4B5563]":"text-gray-300"),D.isCurrentMonth&&(p?"text-white":"text-gray-900"),ce&&"ring-2 ring-[#3B82F6]",Xe&&"bg-[#3B82F6] text-white",Ft&&!Xe&&"bg-[#7C3AED] text-white",Dt&&!Zt&&(p?"bg-[#7C3AED]/20":"bg-purple-100"),!Zt&&(p?"hover:bg-white/10":"hover:bg-gray-100")),children:D.date.getDate()},Q)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ie(),z(!N);},className:b("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",T.priority==="high"||T.priority==="urgent"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":T.priority==="low"?"bg-green-500/20 text-green-400":p?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:T.priority?T.priority==="high"||T.priority==="urgent"?n==="es"?"Alta":"High":T.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:N&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>z(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",p?"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(D=>jsxs("button",{onClick:()=>{_e("priority",D.id),z(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",T.priority===D.id&&(p?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:b("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:p?"text-white":"text-gray-900",children:D.label})]},D.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:T.startDate&&T.endDate?`${Math.ceil((T.endDate.getTime()-T.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:b("w-4 h-4 rounded-full border-2",p?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Ne?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:T.progress||0,onChange:D=>{let Q=parseInt(D.target.value),ce=T.status;Q===100?ce="completed":Q>0?ce="in-progress":ce="todo";let Xe={...T,progress:Q,status:ce};ke(Xe);},onBlur:()=>Ae(false),className:b("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",p?"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-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ae(true),className:b("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",p?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:b("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxs("span",{className:b("text-sm font-medium min-w-[40px]",p?"text-white":"text-gray-900"),children:[T.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(Sr,{selectedTags:T.tags||[],availableTags:m,onChange:D=>{_e("tags",D);},onCreateTag:i,theme:w})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:b("w-4 h-4 mt-1.5",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24 mt-1",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[T.dependencies&&T.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:T.dependencies.map(D=>{let Q=f.find(ce=>ce.id===D);return jsxs("span",{className:b("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",p?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[Q?.name||D.slice(0,8),jsx("button",{onClick:()=>{let ce=(T.dependencies||[]).filter(Xe=>Xe!==D);_e("dependencies",ce);},className:b("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{onClick:()=>{Ie(),B(!F);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"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:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:F&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{B(false),W("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:b("p-2 border-b",p?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:E,onChange:D=>W(D.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:b("w-full px-3 py-2 rounded-md text-sm outline-none",p?"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:f.length>0?f.filter(D=>D.id!==T.id).filter(D=>E===""||D.name.toLowerCase().includes(E.toLowerCase())).map(D=>{let Q=T.dependencies?.includes(D.id);return jsxs("button",{onClick:()=>{let ce=T.dependencies||[],Xe;Q?Xe=ce.filter(Ft=>Ft!==D.id):Xe=[...ce,D.id],_e("dependencies",Xe);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",p?"hover:bg-white/5":"hover:bg-gray-50",Q&&(p?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:b("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",Q?"bg-blue-500 border-blue-500":p?"border-white/30":"border-gray-300"),children:Q&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:b("block truncate",p?"text-white":"text-gray-900"),children:D.name}),jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:D.id.slice(0,8)})]})]},D.id)}):jsx("div",{className:b("px-3 py-4 text-sm text-center",p?"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:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ie(),ue(!J);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",p?"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:T.color||"#6366F1"}}),jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:Jr.find(D=>D.value===T.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:b("w-3 h-3",p?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:J&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ue(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",p?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Jr.map(D=>{let Q=T.color===D.value;return jsx("button",{onClick:()=>{_e("color",D.value),ue(false);},className:b("w-7 h-7 rounded-full flex items-center justify-center transition-all",Q&&"ring-2 ring-offset-2",p?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:D.value,outlineColor:Q?D.value:void 0},title:D.name,children:Q&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},D.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm w-24",p?"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:T.isMilestone||false,onChange:D=>_e("isMilestone",D.target.checked),className:b("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",T.isMilestone?"bg-purple-500 border-purple-500":p?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:b("text-sm",p?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:b("w-4 h-4",p?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:Je,value:Oe,onChange:D=>ne(D.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:b("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",p?"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("button",{className:b("flex items-center gap-2 text-sm mt-2 transition-colors",p?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",T.subtasks&&T.subtasks.length>0&&jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",T.subtasks.filter(D=>D.progress===100).length,"/",T.subtasks.length,")"]})]})}),T.subtasks&&T.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:T.subtasks.map(D=>jsxs("div",{className:b("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",p?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>qe(D.id),className:b("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",D.progress===100?"bg-green-500 border-green-500":p?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:D.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:b("text-sm flex-1",D.progress===100?"line-through text-[#6B7280]":p?"text-white":"text-gray-900"),children:D.name}),jsx("button",{onClick:()=>He(D.id),className:b("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",p?"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"})})]},D.id))}),Re?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Ue,onChange:D=>Z(D.target.value),onKeyDown:D=>{D.key==="Enter"&&Ue.trim()?fe():D.key==="Escape"&&(H(false),Z(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:b("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",p?"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:fe,disabled:!Ue.trim(),className:b("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Ue.trim()?"bg-blue-500 hover:bg-blue-600 text-white":p?"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:()=>{H(false),Z("");},className:b("p-2 rounded-lg transition-colors",p?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>H(true),className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",p?"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:b("mt-6 pt-4 border-t",p?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:b("text-sm font-semibold mb-3",p?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(D=>{let Q=le(D.type),ce=D.type.startsWith("image/");return jsxs("div",{className:b("flex items-center gap-3 p-2 rounded-lg group transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ce&&D.thumbnailUrl?jsx("img",{src:D.thumbnailUrl,alt:D.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:b("w-10 h-10 rounded flex items-center justify-center",p?"bg-white/10":"bg-gray-200"),children:jsx(Q,{className:b("w-5 h-5",p?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:b("text-sm font-medium truncate block hover:underline",p?"text-white":"text-gray-900"),children:D.name}),jsx("p",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:U(D.size)})]}),u&&jsx("button",{onClick:()=>u(D.id),className:b("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",p?"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"})})]},D.id)})}),jsxs("div",{onDragOver:Ke,onDragLeave:ze,onDrop:q,className:b("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",be?p?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":p?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",Y&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Pe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||Y}),Y?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:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:b("w-6 h-6 mx-auto mb-2",be?"text-blue-500":p?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-500"),children:be?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:b("text-xs mt-1",p?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:b("w-80 border-l flex flex-col",p?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:b("px-4 py-3 border-b",p?"border-white/10":"border-gray-200"),children:jsxs("h3",{className:b("text-sm font-semibold",p?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxs("span",{className:b("ml-2 text-xs font-normal",p?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]})}),jsx("div",{ref:K,className:"flex-1 overflow-y-auto p-4",children:y.length>0?jsx("div",{className:"space-y-4",children:[...y].sort((D,Q)=>{let ce=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,Xe=typeof Q.createdAt=="string"?new Date(Q.createdAt):Q.createdAt;return ce.getTime()-Xe.getTime()}).map(D=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:D.user?.color||"#8B5CF6"},children:D.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:b("text-sm font-medium",p?"text-white":"text-gray-900"),children:D.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:b("text-xs",p?"text-[#6B7280]":"text-gray-400"),children:Ze(D.createdAt)})]}),jsx("div",{className:b("text-sm",p?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Od,{content:D.content,theme:s})}),D.attachments&&D.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:D.attachments.map(Q=>{let ce=Q.type.startsWith("image/");return jsxs("a",{href:Q.url,target:"_blank",rel:"noopener noreferrer",className:b("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",p?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ce?jsx(Image,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:b("w-4 h-4",p?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:b("text-xs truncate max-w-[100px]",p?"text-white":"text-gray-900"),children:Q.name})]},Q.id)})})]})]},D.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:b("w-10 h-10 mb-3",p?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:b("text-sm",p?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:b("p-4 border-t",p?"border-white/10":"border-gray-200"),children:jsx(Rd,{value:ut,onChange:Pt,onSubmit:Pa,users:v,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!k,isSubmitting:ge,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:re,onFilesSelect:ee,onRemoveFile:Ye})})]})]})]})})}function Ks(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Mr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:m,error:i,children:c,availableTags:d=[],onCreateTag:u,attachmentsByCard:f,onUploadAttachments:y,onDeleteAttachment:k,comments:g,onAddComment:v,currentUser:h,mentionableUsers:p,onTaskOpen:w,onUploadCommentAttachments:x}){let[S,T]=Ks(),[C,A]=useState(null),[I,N]=useState(false),z=useRef(null),R=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),_=o?.theme||"dark",se=_==="dark"||_==="neutral",te=se?"dark":"",ie=useCallback((Y,V)=>{t.onCardUpdate?.(Y,V);},[t]),xe=useCallback((Y,V)=>{t.onColumnUpdate?.(Y,{title:V});},[t]),Ne=useCallback(Y=>{t.onColumnDelete?.(Y);},[t]),Ae=["todo","in-progress","completed"],F=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),B=useMemo(()=>{let Y=new Map;return e.columns.forEach(V=>{let Oe=V.cardIds.map(pe=>e.cards.find(Le=>Le.id===pe)).filter(pe=>pe!==void 0).sort((pe,Le)=>pe.position-Le.position);Y.set(V.id,Oe);}),Y},[e.cards,e.columns]);useEffect(()=>{let Y=z.current;if(!Y)return;let V=Je=>{let st=Je.target,Ge=Je.button===1,bt=st===Y||st.classList.contains("asakaa-column")&&!st.closest(".asakaa-card");(Ge||Je.button===0&&bt&&!S.isDragging)&&(Je.preventDefault(),N(true),R.current={x:Je.clientX,y:Je.clientY,scrollLeft:Y.scrollLeft,scrollTop:Y.scrollTop},Y.style.cursor="grabbing",Y.style.userSelect="none");},Oe=Je=>{if(!I)return;let st=Je.clientX-R.current.x,Ge=Je.clientY-R.current.y;Y.scrollLeft=R.current.scrollLeft-st,Y.scrollTop=R.current.scrollTop-Ge;},pe=()=>{I&&(N(false),Y.style.cursor="",Y.style.userSelect="");},Le=()=>{I&&(N(false),Y.style.cursor="",Y.style.userSelect="");};return Y.addEventListener("mousedown",V),document.addEventListener("mousemove",Oe),document.addEventListener("mouseup",pe),Y.addEventListener("mouseleave",Le),()=>{Y.removeEventListener("mousedown",V),document.removeEventListener("mousemove",Oe),document.removeEventListener("mouseup",pe),Y.removeEventListener("mouseleave",Le);}},[I,S.isDragging]);let E=useMemo(()=>e.cards.map(Y=>({id:Y.id,name:Y.title,startDate:Y.startDate?new Date(Y.startDate):void 0,endDate:Y.endDate?new Date(Y.endDate):void 0,progress:Y.progress||0,status:Y.columnId,priority:Y.priority?.toLowerCase(),dependencies:Array.isArray(Y.dependencies)?Y.dependencies.map(V=>typeof V=="string"?V:V.taskId):[]})),[e.cards]),W=useCallback(Y=>{let{active:V}=Y,Oe=e.cards.find(pe=>pe.id===V.id);Oe&&T({isDragging:true,draggedCardId:Oe.id,sourceColumnId:Oe.columnId,targetColumnId:Oe.columnId});},[e.cards,T]),J=useCallback(Y=>{let{active:V,over:Oe}=Y;if(!Oe||!e.cards.find(Je=>Je.id===V.id))return;let Le=null;Oe.data.current?.type==="column"?Le=Oe.id:Oe.data.current?.type==="card"&&(Le=e.cards.find(st=>st.id===Oe.id)?.columnId||null),Le&&Le!==S.targetColumnId&&T({...S,targetColumnId:Le});},[e.cards,S,T]),ue=useCallback(async Y=>{let{active:V,over:Oe}=Y;if(T({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Oe)return;let pe=e.cards.find(Ge=>Ge.id===V.id);if(!pe)return;let Le,Je;if(Oe.data.current?.type==="column"){Le=Oe.id;let Ge=B.get(Le)||[];Je=Is(Ge,0);}else {let Ge=e.cards.find(Pt=>Pt.id===Oe.id);if(!Ge)return;Le=Ge.columnId;let bt=B.get(Le)||[],ut=bt.findIndex(Pt=>Pt.id===Oe.id);Je=Is(bt,ut);}let st=e.columns.find(Ge=>Ge.id===Le);if(st&&st.wipLimit&&st.wipLimitType==="hard"){let Ge=B.get(Le)||[];if(pe.columnId!==Le&&Ge.length>=st.wipLimit){t.onWipLimitExceeded?.(st,pe);return}}(pe.columnId!==Le||pe.position!==Je)&&await t.onCardMove?.(pe.id,Le,Je);},[e.cards,e.columns,B,t,T]),be=useCallback(Y=>{A(Y),a?.(Y),w?.(Y.id);},[a,w]),Ce=useCallback(Y=>{t.onCardUpdate?.(Y.id,Y),A(Y);},[t]);return m?jsx("div",{className:b("asakaa-board",te,n),style:l,children:jsx(bf,{columnCount:3})}):i?jsx("div",{className:b("asakaa-board",te,n),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(pd,{themeName:_,children:[jsxs(DndContext,{sensors:F,collisionDetection:closestCorners,onDragStart:W,onDragOver:J,onDragEnd:ue,children:[jsxs("div",{ref:z,className:b("asakaa-board",te,n),style:{...l,cursor:I?"grabbing":void 0},"data-theme":_,children:[e.columns.sort((Y,V)=>Y.position-V.position).map(Y=>{let V=B.get(Y.id)||[],Oe=!Ae.includes(Y.id);return jsx(bo,{column:Y,cards:V,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:be,onCardUpdate:ie,onColumnRename:xe,onColumnDelete:Ne,isDeletable:Oe,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},Y.id)}),c]}),jsx(DragOverlay,{children:S.draggedCardId?jsx(gr,{card:e.cards.find(Y=>Y.id===S.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(fr,{task:C,isOpen:!!C,onClose:()=>A(null),onCardUpdate:Ce,theme:se?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:u,attachments:C?f?.get(C.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:k,availableTasks:E,comments:g,onAddComment:v,currentUser:h,mentionableUsers:p,onUploadCommentAttachments:x})]})}function bf({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 kf={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},wf={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:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Cf={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Tf={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Nf({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),n(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,c)=>i.position-c.position).map((i,c)=>jsxs(motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Df({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,m]=useState(null),i=useRef(null);if(useEffect(()=>{let f=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(f=>f.handler),u=async(f,y)=>{if(y){m(f);try{await y();}catch(k){console.error(`Export ${f} failed:`,k);}finally{m(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((f,y)=>jsxs(motion.button,{onClick:()=>u(f.id,f.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function Sf({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, #3B82F6 0%, #2563EB 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:t})]})}function qs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:m,translations:i}){let c=r==="dark"?kf:wf,d={...o==="es"?Cf:Tf,...i},u=n||l||m;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxs(Fragment,{children:[jsx(Df,{theme:c,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:m}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsx(Nf,{columns:e,onSelect:t,theme:c,t:d,createTaskLabel:a}):jsx(Sf,{onClick:()=>t(),label:a||d.newTask}))]})})}function Js({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(""),i=useCallback(()=>{let u=l.trim();u&&(e(u),m(""),n(false));},[l,e]),c=useCallback(u=>{u.key==="Enter"?(u.preventDefault(),i()):u.key==="Escape"&&(m(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsx("div",{className:b("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:u=>m(u.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{m(""),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:b("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 Zs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:m="es"}){let[i,c]=useState(false),[d,u]=useState(false),[f,y]=useState(""),[k,g]=useState([]),[v,h]=useState(""),[p,w]=useState(""),[x,S]=useState(""),[T,C]=useState(false),[A,I]=useState(false),[N,z]=useState(false),R=useRef(null),_=useRef(null),se={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},te=useCallback(()=>{y(""),g([]),h(""),w(""),S(""),C(false),I(false),z(false),c(false);},[]);useEffect(()=>{i&&R.current&&R.current.focus();},[i]),useEffect(()=>{if(!i)return;let F=B=>{_.current&&!_.current.contains(B.target)&&(f.trim()||te());};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[i,f,te]);let ie=useCallback(async()=>{let F=f.trim();if(!(!F||d)){u(true);try{await t({name:F,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:v?new Date(v):void 0,endDate:p?new Date(p):void 0,priority:x||void 0}),y(""),g([]),h(""),w(""),S(""),C(!1),I(!1),z(!1),R.current?.focus();}catch(B){console.error("Error creating card:",B);}finally{u(false);}}},[f,e,k,v,p,x,t,d]),xe=useCallback(F=>{F.key==="Enter"&&!F.shiftKey?(F.preventDefault(),ie()):F.key==="Escape"&&te();},[ie,te]),Ne=useCallback(F=>{g(B=>B.includes(F)?B.filter(E=>E!==F):[...B,F]);},[]),Ae=l==="dark";return i?jsxs("div",{ref:_,className:b("rounded-lg overflow-hidden shadow-lg",Ae?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:R,type:"text",value:f,onChange:F=>y(F.target.value),onKeyDown:xe,placeholder:se.placeholder,disabled:d,className:b("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ae?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>C(!T),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||k.length>0?"bg-emerald-500/20 text-emerald-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:se.addAssignee,children:[jsxs("svg",{width:"14",height:"14",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"})]}),k.length>0&&jsx("span",{className:"ml-0.5",children:k.length})]}),jsx("button",{onClick:()=>I(!A),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",A||v||p?"bg-blue-500/20 text-blue-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:se.addDates,children:jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>z(!N),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||x?x==="urgent"?"bg-red-500/20 text-red-400":x==="high"?"bg-orange-500/20 text-orange-400":x==="medium"?"bg-yellow-500/20 text-yellow-400":x==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ae?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:se.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:ie,disabled:!f.trim()||d,className:b("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):se.save})]})]}),T&&a.length>0&&jsx("div",{className:b("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(F=>jsxs("button",{onClick:()=>Ne(F.id),className:b("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(F.id)?"bg-emerald-500 text-white":Ae?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[F.avatar?jsx("img",{src:F.avatar,alt:F.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:b("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(F.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:F.name.charAt(0).toUpperCase()}),jsx("span",{children:F.name.split(" ")[0]})]},F.id))})}),A&&jsx("div",{className:b("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:se.startDate}),jsx("input",{type:"date",value:v,onChange:F=>h(F.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",Ae?"text-gray-500":"text-gray-400"),children:se.endDate}),jsx("input",{type:"date",value:p,onChange:F=>w(F.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",Ae?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),N&&jsx("div",{className:b("px-3 pb-3 pt-0","border-t",Ae?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(F=>jsx("button",{onClick:()=>S(x===F?"":F),className:b("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",x===F?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[F]} text-white`:Ae?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:se[F]},F))})})]}):jsxs("button",{onClick:()=>c(true),disabled:n,className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ae?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsx("span",{className:"text-sm font-medium",children:se.buttonLabel})]})}var _o=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(Mr,{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(`
|
|
5
5
|
`)}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 ic(e={}){return new _o(e)}var yo=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 Qs(e,t){let a=r=>jsx(yo,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ti({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[d,u]=useState(false),[f,y]=useState(""),[k,g]=useState("home"),[v,h]=useState(""),[p,w]=useState("");useEffect(()=>{let C=A=>{(A.metaKey||A.ctrlKey)&&A.key===i&&(A.preventDefault(),u(I=>!I)),A.key==="Escape"&&(u(false),g("home"),y(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),useEffect(()=>{d||(g("home"),y(""),h(""),w(""));},[d]);let x=useCallback(()=>{u(false);},[]),S=useCallback(C=>{let[A,I]=C.split(":");switch(A){case "create-card":g("create-card");break;case "create-card-in":h(I||"");break;case "navigate":I?(a?.(I),x()):g("navigate");break;case "search":r?.(f),x();break;case "priority":g("priority");break;case "set-priority":p&&I&&(o?.(p,I),x());break;case "assign":g("assign");break;case "assign-user":p&&I&&(s?.(p,I),x());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),x();break;case "ai-predict-risks":l?.(),x();break;case "ai-usage":m?.(),x();break;case "back":g("home");break;}},[f,p,t,a,r,o,s,n,l,m,x]),T=useCallback(()=>{v&&f.trim()&&(t?.(v,f.trim()),x());},[v,f,t,x]);return d?jsx(gt,{children:jsx("div",{className:"command-palette-overlay",onClick:x,children:jsx("div",{className:`command-palette ${c}`,onClick:C=>C.stopPropagation(),children:jsxs(Command,{value:f,onValueChange:y,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:k==="create-card"&&v?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&k==="create-card"&&v&&T();}}),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."}),k==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:S,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:S,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:S,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:S,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(C=>jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:S,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(A=>jsx("span",{className:"command-palette-item-label",children:A},A))})]},C.id))})]}),k==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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(C=>jsxs(Command.Item,{value:`create-card-in:${C.id}`,onSelect:S,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:C.title}),jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),k==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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(C=>{let A=e.columns.find(I=>I.id===C.columnId);return jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:S,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:C.title}),jsx("div",{className:"command-palette-item-meta",children:A?.title})]}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},C.id)})})]}),k==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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:S,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:S,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:S,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 cc(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=`
|
|
6
6
|
position: fixed !important;
|
|
7
7
|
inset: 0 !important;
|
|
@@ -68,7 +68,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
68
68
|
border: none !important;
|
|
69
69
|
cursor: pointer !important;
|
|
70
70
|
opacity: 0.5 !important;
|
|
71
|
-
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=y=>{y.stopPropagation();let k=r<a.length-1?r+1:0;i(),o(k);},n.appendChild(d),n.appendChild(u),n.appendChild(f);}n.appendChild(l),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Lf(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 If(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 ri(e){return e.startsWith("image/")}function dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[m,i]=useState(false),[c,d]=useState(null),u=useRef(null),f=useRef(e);f.current=e;let y=useCallback((C,A)=>{A.preventDefault(),A.stopPropagation();let I=f.current.filter(R=>ri(R.type)),N=I.findIndex(R=>R.id===C.id),z=R=>{let V=f.current.filter(ae=>ri(ae.type)),ne=V[R];ne&&cc(ne.url,ne.name,V,R,z);};cc(C.url,C.name,I,N,z);},[]),k=useCallback(C=>{let A=[],I=[];return e.length+C.length>s?(I.push(`Maximum ${s} files allowed`),{valid:A,errors:I}):(C.forEach(N=>{if(N.size/1048576>r){I.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(R=>N.type.match(R))){I.push(`${N.name} has invalid file type`);return}A.push(N);}),{valid:A,errors:I})},[e.length,s,r,o]),g=useCallback(async C=>{let{valid:A,errors:I}=k(C);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(A.length!==0){i(true),d(null);try{await t?.(A);}catch(N){d(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[k,t]),v=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),h=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),p=useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),w=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let A=Array.from(C.dataTransfer.files);g(A);},[g]),x=useCallback(C=>{let A=C.target.files?Array.from(C.target.files):[];g(A),u.current&&(u.current.value="");},[g]),S=useCallback(()=>{u.current?.click();},[]),T=useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:v,onDragLeave:h,onDragOver:p,onDrop:w,onClick:S,children:[jsx("input",{ref:u,type:"file",multiple:true,onChange:x,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:m?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),c&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(C=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:ri(C.type)&&C.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:A=>y(C,A),title:"Click to view full size",children:[jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:If(C.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Lf(C.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>T(C.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"})})})]},C.id))})]})}function oi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:u,onDeleteAttachment:f,onSuggestAssignee:y,onGenerateSubtasks:k,onEstimateEffort:g,currentUserId:v="user-1"}){let[h,p]=useState("details"),[w,x]=useState(false),[S,T]=useState({}),[C,A]=useState(""),[I,N]=useState(false),[z,R]=useState({});if(!t||!e)return null;let V=useCallback(()=>{x(false),T({}),p("details"),A(""),R({}),a();},[a]),ne=useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),T({}),x(false));},[e.id,S,r]),ae=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),V());},[e.id,o,V]),ie=useCallback(()=>{c&&C.trim()&&(c(e.id,C.trim()),A(""));},[e.id,C,c]),ke=useCallback(async()=>{if(y){N(true);try{let E=await y(e);R(W=>({...W,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{N(false);}}},[e,y]),Ne=useCallback(async()=>{if(k){N(true);try{let E=await k(e);R(W=>({...W,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{N(false);}}},[e,k]),Ae=useCallback(async()=>{if(g){N(true);try{let E=await g(e);R(W=>({...W,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{N(false);}}},[e,g]),F={...e,...S},B=s.filter(E=>F.assignedUserIds?.includes(E.id));return jsx(gt,{children:jsx("div",{className:"card-detail-overlay",onClick:V,children:jsxs("div",{className:"card-detail-modal",onClick:E=>E.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:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsx("input",{type:"text",value:S.title??F.title,onChange:E=>T({...S,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[w?jsxs(Fragment,{children:[jsx("button",{onClick:ne,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{x(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>x(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:ae,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:V,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:()=>p("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:()=>p("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:()=>p("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",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>p("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:()=>p("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"}),w?jsx("textarea",{value:S.description??F.description??"",onChange:E=>T({...S,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsx("select",{multiple:true,value:S.assignedUserIds??F.assignedUserIds??[],onChange:E=>{let W=Array.from(E.target.selectedOptions,J=>J.value);T({...S,assignedUserIds:W});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsx("option",{value:E.id,children:E.name},E.id))}):jsx("div",{className:"card-detail-users",children:B.length>0?B.map(E=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsx("span",{children:E.name})]},E.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxs("select",{value:S.priority??F.priority??"",onChange:E=>T({...S,priority:E.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:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:F.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:F.labels&&F.labels.length>0?F.labels.map(E=>jsx("span",{className:"card-detail-label-tag",children:E},E)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),w?jsx("input",{type:"date",value:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:E=>T({...S,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsx("input",{type:"date",value:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:E=>T({...S,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsx("input",{type:"number",min:"0",step:"0.5",value:S.estimatedTime??F.estimatedTime??"",onChange:E=>T({...S,estimatedTime:E.target.value?parseFloat(E.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:F.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:F.dependencies&&F.dependencies.length>0?F.dependencies.map(E=>{let W=typeof E=="string"?E:E.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",W.slice(-4)]},W)}):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:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:C,onChange:E=>A(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ie,disabled:!C.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(E=>{let W=s.find(J=>J.id===E.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:[W&&jsx("div",{className:"card-detail-user-avatar",style:{background:W.color},children:W.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:W?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(E.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:E.content})]},E.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:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(E=>{let W=s.find(J=>J.id===E.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:W?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:E.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.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(dr,{cardId:e.id,attachments:i,onUpload:u?E=>u(e.id,E):void 0,onDelete:f,currentUserId:v,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:ke,disabled:I||!y,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:Ne,disabled:I||!k,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:Ae,disabled:I||!g,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"]})]}),z.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),z.assignees.map((E,W)=>{let J=s.find(ue=>ue.id===E.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:E.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},W)})]}),z.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map((E,W)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},W))]}),z.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:[z.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(z.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),m.map(E=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!z.assignees&&!z.subtasks&&!z.effort&&m.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 jo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,m]=useState({top:0,left:0}),i=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),u=window.innerHeight,f=window.innerWidth,y=4,k=d.left;k+o>f-10&&(k=f-o-10),k<10&&(k=10);let g=u-d.bottom,v=d.top,h;return g>=s+y?h=d.bottom+y:v>=s+y?h=d.top-s-y:g>=v?h=d.bottom+y:h=Math.max(10,d.top-s-y),{top:h,left:k}},[e,o,s]);return useEffect(()=>{t&&m(c());},[t,c]),useEffect(()=>{if(!t)return;let d=f=>{let y=f.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},u=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(u),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(gt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Qe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},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:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",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:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},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:"#57534E",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"}};var Wf=["LOW","MEDIUM","HIGH","URGENT"],Gf=["todo","in-progress","review","done"];function ii({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:u,onAIFindSimilar:f,availableColumns:y=[],availableLabels:k=[],availableTags:g=[],onCreateTag:v,onUploadCoverImage:h,unsplashAccessKey:p,theme:w,onSubtasksChange:x,attachments:S=[],onUploadAttachments:T,onDeleteAttachment:C}){let A=uo(),I=w||A?.themeName||"dark",[N,z]=useState(e),[R,V]=useState(false),[ne,ae]=useState(e?.subtasks||[]),[ie,ke]=useState(false),[Ne,Ae]=useState(""),[F,B]=useState(""),[E,W]=useState("all"),[J,ue]=useState(false),[be,G]=useState(false),[he,j]=useState(false),[He,de]=useState(false),[Be,nt]=useState(false),[st,Xe]=useState(false),kt=useRef(null),ct=useRef(null),$t=useRef(null),ge=useRef(null),L=useRef(null),re=useRef(null),Te=useRef(null),ze=useRef(null),Z=useRef(null),Re=useRef(null),H=useRef(null),Y=useRef(null);useEffect(()=>{e&&!N?(z({...e}),ae(e.subtasks||[])):e&&N&&e.id!==N.id&&(z({...e}),ae(e.subtasks||[]));},[e,N]),useEffect(()=>{let U=le=>{let D=le.target;ge.current&&!ge.current.contains(D)&&ue(false),L.current&&!L.current.contains(D)&&G(false),re.current&&!re.current.contains(D)&&j(false),Te.current&&!Te.current.contains(D)&&de(false);};if(J||be||he||He)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[J,be,he,He]),useEffect(()=>{if(!t)return;let U=le=>{let D=le.target,Q=D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable;if(le.key==="Escape"){le.preventDefault(),J||be||he||He||Be||st?(ue(false),G(false),j(false),de(false),nt(false),Xe(false)):Q||a();return}if(Q&&le.key!=="Escape")return;let me=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),ue(true);break;case "a":le.preventDefault(),j(true);break;case "p":le.preventDefault(),G(true);break;case "l":le.preventDefault(),de(true);break;case "d":me||(le.preventDefault(),nt(true),setTimeout(()=>ze.current?.focus(),0));break;case "e":me||(le.preventDefault(),Xe(true));break;case "i":le.preventDefault(),V(true),setTimeout(()=>ct.current?.focus(),0);break;case "t":le.preventDefault(),ke(true);break;case "c":le.preventDefault(),$t.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,J,be,he,He,Be,st]);let we=useCallback(U=>{let le=U.currentTarget.textContent?.trim()||"";if(N&&le!==N.title){let D={...N,title:le};z(D),r?.(N.id,{title:le});}},[N,r]),Le=useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=N?.title||"",U.currentTarget.blur());},[N]),Ge=useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),V(false);},[N,e,r]),We=useCallback(U=>{if(N){let le={...N,columnId:U};z(le),r?.(N.id,{columnId:U}),ue(false);}},[N,r]),se=useCallback(U=>{if(N){let le={...N,priority:U};z(le),r?.(N.id,{priority:U}),G(false);}},[N,r]),Ie=useCallback(U=>{if(N){let le=N.assignedUserIds||[],D=le.includes(U)?le.filter(me=>me!==U):[...le,U],Q={...N,assignedUserIds:D};z(Q),r?.(N.id,{assignedUserIds:D});}},[N,r]),ee=useCallback(U=>{if(N){let le=N.labels||[],D=le.includes(U)?le.filter(me=>me!==U):[...le,U],Q={...N,labels:D};z(Q),r?.(N.id,{labels:D});}},[N,r]),Ke=useCallback(U=>{if(N){let le={...N,tags:U};z(le),r?.(N.id,{tags:U});}},[N,r]),Pa=useCallback(U=>{if(N){let le=U.target.value,D={...N,endDate:le};z(D),r?.(N.id,{endDate:le}),nt(false);}},[N,r]),fe=useCallback(U=>{if(N){let le={...N,estimatedTime:parseFloat(U)||0};z(le),r?.(N.id,{estimatedTime:parseFloat(U)||0});}},[N,r]),Ye=useCallback(()=>{if(Ne.trim()&&N){let U={id:`subtask-${Date.now()}`,title:Ne.trim(),completed:false,createdAt:new Date},le=[...ne,U];ae(le),Ae(""),ke(false),x?.(N.id,le);}},[Ne,ne,N,x]),$e=useCallback(U=>{let le=ne.map(D=>D.id===U?{...D,completed:!D.completed,updatedAt:new Date}:D);ae(le),N&&x?.(N.id,le);},[ne,N,x]),Je=useCallback(U=>{let le=ne.filter(D=>D.id!==U);ae(le),N&&x?.(N.id,le);},[ne,N,x]),at=useCallback(()=>{F.trim()&&N&&m&&(m(N.id,F.trim()),B(""));},[F,N,m]),it=useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),at());},[at]),_=U=>jsx(Uf,{remarkPlugins:[$f],rehypePlugins:[Hf],components:{a:({node:le,...D})=>jsx("a",{...D,target:"_blank",rel:"noopener noreferrer"})},children:U}),q=l.filter(U=>E==="comments"?U.type.includes("COMMENT"):E==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let Pe=N||e,je=s.filter(U=>Pe.assignedUserIds?.includes(U.id)),Oe=ne.filter(U=>U.completed).length;return jsx(gt,{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:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:kt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:we,onKeyDown:Le,children:Pe.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:ge,children:[jsxs("button",{ref:Z,className:"modal-v2-field",onClick:()=>ue(!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:Pe.columnId||"No status"})]}),jsx(jo,{triggerRef:Z,isOpen:J,onClose:()=>ue(false),width:250,estimatedHeight:200,children:(y.length>0?y:Gf.map(U=>({id:U,title:U}))).map(U=>jsx("button",{className:`modal-v2-popover-item ${Pe.columnId===U.id?"active":""}`,onClick:()=>We(U.id),children:U.title},U.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:re,children:[jsxs("button",{ref:Re,className:"modal-v2-field",onClick:()=>j(!he),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"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:je.length>0?jsx("div",{className:"modal-v2-avatars",children:je.map(U=>jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(jo,{triggerRef:Re,isOpen:he,onClose:()=>j(false),width:280,estimatedHeight:300,children:s.map(U=>jsxs("button",{className:`modal-v2-popover-item ${Pe.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>Ie(U.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,Pe.assignedUserIds?.includes(U.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"})})]},U.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:L,children:[jsxs("button",{ref:H,className:"modal-v2-field",onClick:()=>G(!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:Pe.priority||"None"})]}),jsxs(jo,{triggerRef:H,isOpen:be,onClose:()=>G(false),width:180,estimatedHeight:220,children:[Wf.map(U=>jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${Pe.priority===U?"active":""}`,onClick:()=>se(U),children:U},U)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>se(""),children:"None"})]})]}),g.length>0||v?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(Sr,{selectedTags:Pe.tags||[],availableTags:g,onChange:Ke,onCreateTag:v,theme:Qe[I]||Qe.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:Te,children:[jsxs("button",{ref:Y,className:"modal-v2-field",onClick:()=>de(!He),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"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:Pe.labels&&Pe.labels.length>0?jsx("span",{children:Pe.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(jo,{triggerRef:Y,isOpen:He,onClose:()=>de(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxs("button",{className:`modal-v2-popover-item ${Pe.labels?.includes(U)?"active":""}`,onClick:()=>ee(U),children:[U,Pe.labels?.includes(U)&&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"})})]},U))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{nt(!Be),setTimeout(()=>ze.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:Pe.endDate?new Date(Pe.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:ze,type:"date",value:typeof Pe.endDate=="string"?Pe.endDate.split("T")[0]:Pe.endDate?(()=>{let U=new Date(Pe.endDate),le=U.getUTCFullYear(),D=String(U.getUTCMonth()+1).padStart(2,"0"),Q=String(U.getUTCDate()).padStart(2,"0");return `${le}-${D}-${Q}`})():"",onChange:Pa,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Xe(!st),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:Pe.estimatedTime?`${Pe.estimatedTime}h`:"Not set"})]}),st&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Pe.estimatedTime||"",onChange:U=>fe(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Xe(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"})]}),R?jsx("textarea",{className:"modal-v2-textarea",value:Pe.description||"",onChange:U=>{if(N){let le={...N,description:U.target.value};z(le);}},onBlur:Ge,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>V(true),children:Pe.description?jsx("div",{className:"modal-v2-markdown",children:_(Pe.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"}),ne.length>0&&jsxs("span",{className:"modal-v2-count",children:[Oe,"/",ne.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>ke(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:[ne.map(U=>jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>$e(U.id),children:U.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:U.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Je(U.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"})]})})]},U.id)),ie&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:Ne,onChange:U=>Ae(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Ye(),U.key==="Escape"&&(ke(false),Ae(""));},onBlur:Ye,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||S.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"}),S.length>0&&jsx("span",{className:"modal-v2-count",children:S.length})]}),jsx(dr,{cardId:Pe.id,attachments:S,onUpload:T?U=>T(Pe.id,U):void 0,onDelete:C,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 ${E==="all"?"active":""}`,onClick:()=>W("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>W("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>W("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:$t,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:U=>B(U.target.value),onKeyDown:it,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:at,disabled:!F.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[q.map(U=>{let le=s.find(Q=>Q.id===U.userId);if(U.type.includes("COMMENT")){let Q=n.find(me=>me.id===U.metadata?.commentId);return Q?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.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:le?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Q.content})]})]},U.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.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:le?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:U.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),q.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Zf({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 di({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,m)=>l+m.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(Zf,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function ib({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 ci({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ib,{})}),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:m>=50?"#10B981":"#F59E0B"},children:[m.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 bb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},vc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function hb({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:m,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function xc({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 mi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||bb[m.name]||vc[e.indexOf(m)%vc.length]})),l=n.map(m=>m.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?hb:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(xc,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.value} - ${d}%)`}})]}):jsxs(BarChart$1,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(xc,{})}),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((m,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},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((m,i)=>i.value>m.value?i:m).name})]})]})]})}var In=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[m,i]=useState(false),[c,d]=useState(false),[u,f]=useState(false);if(e.length===0)return null;let y=e.map(w=>w.id),k=w=>{r.onBulkUpdate?.(y,{priority:w}),l(false);},g=w=>{r.onBulkMove?.(y,w),i(false),a();},v=w=>{r.onBulkUpdate?.(y,{assignedUserIds:w}),d(false);},h=w=>{let x=new Set;e.forEach(T=>{T.labels?.forEach(C=>x.add(C));});let S=Array.from(new Set([...x,...w]));r.onBulkUpdate?.(y,{labels:S}),f(false);},p=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(w),children:[jsx("span",{className:b("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!u),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:p,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"})})]})]})})});In.displayName="BulkOperationsToolbar";function wb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(f=>{let y=a?.find(k=>k.id===f);n=`assignee-${f}`,l=y?.name||`User ${f}`,m=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let u={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=u.title,m=u.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,l=f,m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function pi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),l=useMemo(()=>wb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(Mr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:b("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),u={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Mr,{board:u,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ui=[{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 gi({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=ui.find(i=>i.value===e)||ui[0];useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);};return jsxs("div",{className:b("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:b("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:ui.map(i=>jsxs("button",{onClick:()=>m(i.value),className:b("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 Ko=[{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 Nb(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&l&&m}function Nc(e={}){let{shortcuts:t=Ko,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(m=>{o.current=[...o.current,m];},[]),l=useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return useEffect(()=>{function m(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Nb(i,d)){r&&i.preventDefault();let u=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(u);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Sb(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Eb(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 Pb(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Eb(e),r=t?Sb(t):"";return a?`${a} + ${r}`:r}function Mb(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 fi({shortcuts:e=Ko,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Mb(e);return jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([l,m])=>m.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:m.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:Pb(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var bi=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
71
|
+
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=y=>{y.stopPropagation();let k=r<a.length-1?r+1:0;i(),o(k);},n.appendChild(d),n.appendChild(u),n.appendChild(f);}n.appendChild(l),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Lf(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 If(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 ri(e){return e.startsWith("image/")}function dr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[m,i]=useState(false),[c,d]=useState(null),u=useRef(null),f=useRef(e);f.current=e;let y=useCallback((C,A)=>{A.preventDefault(),A.stopPropagation();let I=f.current.filter(R=>ri(R.type)),N=I.findIndex(R=>R.id===C.id),z=R=>{let _=f.current.filter(te=>ri(te.type)),se=_[R];se&&cc(se.url,se.name,_,R,z);};cc(C.url,C.name,I,N,z);},[]),k=useCallback(C=>{let A=[],I=[];return e.length+C.length>s?(I.push(`Maximum ${s} files allowed`),{valid:A,errors:I}):(C.forEach(N=>{if(N.size/1048576>r){I.push(`${N.name} is too large (max ${r}MB)`);return}if(o&&!o.some(R=>N.type.match(R))){I.push(`${N.name} has invalid file type`);return}A.push(N);}),{valid:A,errors:I})},[e.length,s,r,o]),g=useCallback(async C=>{let{valid:A,errors:I}=k(C);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(A.length!==0){i(true),d(null);try{await t?.(A);}catch(N){d(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[k,t]),v=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),h=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),p=useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),w=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let A=Array.from(C.dataTransfer.files);g(A);},[g]),x=useCallback(C=>{let A=C.target.files?Array.from(C.target.files):[];g(A),u.current&&(u.current.value="");},[g]),S=useCallback(()=>{u.current?.click();},[]),T=useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:v,onDragLeave:h,onDragOver:p,onDrop:w,onClick:S,children:[jsx("input",{ref:u,type:"file",multiple:true,onChange:x,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:m?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),c&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(C=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:ri(C.type)&&C.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:A=>y(C,A),title:"Click to view full size",children:[jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:If(C.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Lf(C.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>T(C.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"})})})]},C.id))})]})}function oi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:u,onDeleteAttachment:f,onSuggestAssignee:y,onGenerateSubtasks:k,onEstimateEffort:g,currentUserId:v="user-1"}){let[h,p]=useState("details"),[w,x]=useState(false),[S,T]=useState({}),[C,A]=useState(""),[I,N]=useState(false),[z,R]=useState({});if(!t||!e)return null;let _=useCallback(()=>{x(false),T({}),p("details"),A(""),R({}),a();},[a]),se=useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),T({}),x(false));},[e.id,S,r]),te=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),_());},[e.id,o,_]),ie=useCallback(()=>{c&&C.trim()&&(c(e.id,C.trim()),A(""));},[e.id,C,c]),xe=useCallback(async()=>{if(y){N(true);try{let E=await y(e);R(W=>({...W,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{N(false);}}},[e,y]),Ne=useCallback(async()=>{if(k){N(true);try{let E=await k(e);R(W=>({...W,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{N(false);}}},[e,k]),Ae=useCallback(async()=>{if(g){N(true);try{let E=await g(e);R(W=>({...W,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{N(false);}}},[e,g]),F={...e,...S},B=s.filter(E=>F.assignedUserIds?.includes(E.id));return jsx(gt,{children:jsx("div",{className:"card-detail-overlay",onClick:_,children:jsxs("div",{className:"card-detail-modal",onClick:E=>E.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:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsx("input",{type:"text",value:S.title??F.title,onChange:E=>T({...S,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:F.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[w?jsxs(Fragment,{children:[jsx("button",{onClick:se,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{x(false),T({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>x(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:te,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsx("button",{onClick:_,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>p("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:()=>p("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:()=>p("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",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>p("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:()=>p("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"}),w?jsx("textarea",{value:S.description??F.description??"",onChange:E=>T({...S,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:F.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsx("select",{multiple:true,value:S.assignedUserIds??F.assignedUserIds??[],onChange:E=>{let W=Array.from(E.target.selectedOptions,J=>J.value);T({...S,assignedUserIds:W});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsx("option",{value:E.id,children:E.name},E.id))}):jsx("div",{className:"card-detail-users",children:B.length>0?B.map(E=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsx("span",{children:E.name})]},E.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxs("select",{value:S.priority??F.priority??"",onChange:E=>T({...S,priority:E.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:F.priority==="URGENT"?"#EF4444":F.priority==="HIGH"?"#F59E0B":F.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:F.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:F.labels&&F.labels.length>0?F.labels.map(E=>jsx("span",{className:"card-detail-label-tag",children:E},E)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),w?jsx("input",{type:"date",value:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:F.startDate?new Date(F.startDate).toISOString().split("T")[0]:"",onChange:E=>T({...S,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:F.startDate?new Date(F.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsx("input",{type:"date",value:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:F.endDate?new Date(F.endDate).toISOString().split("T")[0]:"",onChange:E=>T({...S,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:F.endDate?new Date(F.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsx("input",{type:"number",min:"0",step:"0.5",value:S.estimatedTime??F.estimatedTime??"",onChange:E=>T({...S,estimatedTime:E.target.value?parseFloat(E.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:F.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:F.dependencies&&F.dependencies.length>0?F.dependencies.map(E=>{let W=typeof E=="string"?E:E.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",W.slice(-4)]},W)}):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:F.createdAt?new Date(F.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:C,onChange:E=>A(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ie,disabled:!C.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(E=>{let W=s.find(J=>J.id===E.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:[W&&jsx("div",{className:"card-detail-user-avatar",style:{background:W.color},children:W.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:W?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(E.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:E.content})]},E.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:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(E=>{let W=s.find(J=>J.id===E.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:W?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:E.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.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(dr,{cardId:e.id,attachments:i,onUpload:u?E=>u(e.id,E):void 0,onDelete:f,currentUserId:v,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:xe,disabled:I||!y,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:Ne,disabled:I||!k,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:Ae,disabled:I||!g,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"]})]}),z.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),z.assignees.map((E,W)=>{let J=s.find(ue=>ue.id===E.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:E.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},W)})]}),z.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),z.subtasks.map((E,W)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},W))]}),z.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:[z.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(z.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),m.map(E=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!z.assignees&&!z.subtasks&&!z.effort&&m.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 jo({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,m]=useState({top:0,left:0}),i=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),u=window.innerHeight,f=window.innerWidth,y=4,k=d.left;k+o>f-10&&(k=f-o-10),k<10&&(k=10);let g=u-d.bottom,v=d.top,h;return g>=s+y?h=d.bottom+y:v>=s+y?h=d.top-s-y:g>=v?h=d.bottom+y:h=Math.max(10,d.top-s-y),{top:h,left:k}},[e,o,s]);return useEffect(()=>{t&&m(c());},[t,c]),useEffect(()=>{if(!t)return;let d=f=>{let y=f.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},u=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(u),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(gt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var et={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},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:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",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:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},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:"#57534E",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"}};var Wf=["LOW","MEDIUM","HIGH","URGENT"],Gf=["todo","in-progress","review","done"];function ii({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:u,onAIFindSimilar:f,availableColumns:y=[],availableLabels:k=[],availableTags:g=[],onCreateTag:v,onUploadCoverImage:h,unsplashAccessKey:p,theme:w,onSubtasksChange:x,attachments:S=[],onUploadAttachments:T,onDeleteAttachment:C}){let A=uo(),I=w||A?.themeName||"dark",[N,z]=useState(e),[R,_]=useState(false),[se,te]=useState(e?.subtasks||[]),[ie,xe]=useState(false),[Ne,Ae]=useState(""),[F,B]=useState(""),[E,W]=useState("all"),[J,ue]=useState(false),[be,Ce]=useState(false),[Y,V]=useState(false),[Oe,pe]=useState(false),[Le,Je]=useState(false),[st,Ge]=useState(false),bt=useRef(null),ut=useRef(null),Pt=useRef(null),ge=useRef(null),L=useRef(null),re=useRef(null),Te=useRef(null),Ue=useRef(null),Z=useRef(null),Re=useRef(null),H=useRef(null),K=useRef(null);useEffect(()=>{e&&!N?(z({...e}),te(e.subtasks||[])):e&&N&&e.id!==N.id&&(z({...e}),te(e.subtasks||[]));},[e,N]),useEffect(()=>{let U=le=>{let D=le.target;ge.current&&!ge.current.contains(D)&&ue(false),L.current&&!L.current.contains(D)&&Ce(false),re.current&&!re.current.contains(D)&&V(false),Te.current&&!Te.current.contains(D)&&pe(false);};if(J||be||Y||Oe)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[J,be,Y,Oe]),useEffect(()=>{if(!t)return;let U=le=>{let D=le.target,Q=D.tagName==="INPUT"||D.tagName==="TEXTAREA"||D.isContentEditable;if(le.key==="Escape"){le.preventDefault(),J||be||Y||Oe||Le||st?(ue(false),Ce(false),V(false),pe(false),Je(false),Ge(false)):Q||a();return}if(Q&&le.key!=="Escape")return;let ce=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),ue(true);break;case "a":le.preventDefault(),V(true);break;case "p":le.preventDefault(),Ce(true);break;case "l":le.preventDefault(),pe(true);break;case "d":ce||(le.preventDefault(),Je(true),setTimeout(()=>Ue.current?.focus(),0));break;case "e":ce||(le.preventDefault(),Ge(true));break;case "i":le.preventDefault(),_(true),setTimeout(()=>ut.current?.focus(),0);break;case "t":le.preventDefault(),xe(true);break;case "c":le.preventDefault(),Pt.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,J,be,Y,Oe,Le,st]);let ke=useCallback(U=>{let le=U.currentTarget.textContent?.trim()||"";if(N&&le!==N.title){let D={...N,title:le};z(D),r?.(N.id,{title:le});}},[N,r]),Ie=useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=N?.title||"",U.currentTarget.blur());},[N]),_e=useCallback(()=>{N&&e&&N.description!==e.description&&r?.(N.id,{description:N.description}),_(false);},[N,e,r]),We=useCallback(U=>{if(N){let le={...N,columnId:U};z(le),r?.(N.id,{columnId:U}),ue(false);}},[N,r]),ne=useCallback(U=>{if(N){let le={...N,priority:U};z(le),r?.(N.id,{priority:U}),Ce(false);}},[N,r]),Be=useCallback(U=>{if(N){let le=N.assignedUserIds||[],D=le.includes(U)?le.filter(ce=>ce!==U):[...le,U],Q={...N,assignedUserIds:D};z(Q),r?.(N.id,{assignedUserIds:D});}},[N,r]),ee=useCallback(U=>{if(N){let le=N.labels||[],D=le.includes(U)?le.filter(ce=>ce!==U):[...le,U],Q={...N,labels:D};z(Q),r?.(N.id,{labels:D});}},[N,r]),Ye=useCallback(U=>{if(N){let le={...N,tags:U};z(le),r?.(N.id,{tags:U});}},[N,r]),Pa=useCallback(U=>{if(N){let le=U.target.value,D={...N,endDate:le};z(D),r?.(N.id,{endDate:le}),Je(false);}},[N,r]),fe=useCallback(U=>{if(N){let le={...N,estimatedTime:parseFloat(U)||0};z(le),r?.(N.id,{estimatedTime:parseFloat(U)||0});}},[N,r]),qe=useCallback(()=>{if(Ne.trim()&&N){let U={id:`subtask-${Date.now()}`,title:Ne.trim(),completed:false,createdAt:new Date},le=[...se,U];te(le),Ae(""),xe(false),x?.(N.id,le);}},[Ne,se,N,x]),He=useCallback(U=>{let le=se.map(D=>D.id===U?{...D,completed:!D.completed,updatedAt:new Date}:D);te(le),N&&x?.(N.id,le);},[se,N,x]),Ze=useCallback(U=>{let le=se.filter(D=>D.id!==U);te(le),N&&x?.(N.id,le);},[se,N,x]),rt=useCallback(()=>{F.trim()&&N&&m&&(m(N.id,F.trim()),B(""));},[F,N,m]),it=useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),rt());},[rt]),G=U=>jsx(Uf,{remarkPlugins:[$f],rehypePlugins:[Hf],components:{a:({node:le,...D})=>jsx("a",{...D,target:"_blank",rel:"noopener noreferrer"})},children:U}),q=l.filter(U=>E==="comments"?U.type.includes("COMMENT"):E==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let Pe=N||e,Ke=s.filter(U=>Pe.assignedUserIds?.includes(U.id)),ze=se.filter(U=>U.completed).length;return jsx(gt,{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:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:bt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ke,onKeyDown:Ie,children:Pe.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:ge,children:[jsxs("button",{ref:Z,className:"modal-v2-field",onClick:()=>ue(!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:Pe.columnId||"No status"})]}),jsx(jo,{triggerRef:Z,isOpen:J,onClose:()=>ue(false),width:250,estimatedHeight:200,children:(y.length>0?y:Gf.map(U=>({id:U,title:U}))).map(U=>jsx("button",{className:`modal-v2-popover-item ${Pe.columnId===U.id?"active":""}`,onClick:()=>We(U.id),children:U.title},U.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:re,children:[jsxs("button",{ref:Re,className:"modal-v2-field",onClick:()=>V(!Y),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:Ke.length>0?jsx("div",{className:"modal-v2-avatars",children:Ke.map(U=>jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(jo,{triggerRef:Re,isOpen:Y,onClose:()=>V(false),width:280,estimatedHeight:300,children:s.map(U=>jsxs("button",{className:`modal-v2-popover-item ${Pe.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>Be(U.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,Pe.assignedUserIds?.includes(U.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"})})]},U.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:L,children:[jsxs("button",{ref:H,className:"modal-v2-field",onClick:()=>Ce(!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:Pe.priority||"None"})]}),jsxs(jo,{triggerRef:H,isOpen:be,onClose:()=>Ce(false),width:180,estimatedHeight:220,children:[Wf.map(U=>jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${Pe.priority===U?"active":""}`,onClick:()=>ne(U),children:U},U)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>ne(""),children:"None"})]})]}),g.length>0||v?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(Sr,{selectedTags:Pe.tags||[],availableTags:g,onChange:Ye,onCreateTag:v,theme:et[I]||et.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:Te,children:[jsxs("button",{ref:K,className:"modal-v2-field",onClick:()=>pe(!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:Pe.labels&&Pe.labels.length>0?jsx("span",{children:Pe.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(jo,{triggerRef:K,isOpen:Oe,onClose:()=>pe(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxs("button",{className:`modal-v2-popover-item ${Pe.labels?.includes(U)?"active":""}`,onClick:()=>ee(U),children:[U,Pe.labels?.includes(U)&&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"})})]},U))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{Je(!Le),setTimeout(()=>Ue.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:Pe.endDate?new Date(Pe.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Ue,type:"date",value:typeof Pe.endDate=="string"?Pe.endDate.split("T")[0]:Pe.endDate?(()=>{let U=new Date(Pe.endDate),le=U.getUTCFullYear(),D=String(U.getUTCMonth()+1).padStart(2,"0"),Q=String(U.getUTCDate()).padStart(2,"0");return `${le}-${D}-${Q}`})():"",onChange:Pa,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Ge(!st),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:Pe.estimatedTime?`${Pe.estimatedTime}h`:"Not set"})]}),st&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:Pe.estimatedTime||"",onChange:U=>fe(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ge(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"})]}),R?jsx("textarea",{className:"modal-v2-textarea",value:Pe.description||"",onChange:U=>{if(N){let le={...N,description:U.target.value};z(le);}},onBlur:_e,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>_(true),children:Pe.description?jsx("div",{className:"modal-v2-markdown",children:G(Pe.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"}),se.length>0&&jsxs("span",{className:"modal-v2-count",children:[ze,"/",se.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>xe(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:[se.map(U=>jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>He(U.id),children:U.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:U.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ze(U.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"})]})})]},U.id)),ie&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:Ne,onChange:U=>Ae(U.target.value),onKeyDown:U=>{U.key==="Enter"&&qe(),U.key==="Escape"&&(xe(false),Ae(""));},onBlur:qe,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||S.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"}),S.length>0&&jsx("span",{className:"modal-v2-count",children:S.length})]}),jsx(dr,{cardId:Pe.id,attachments:S,onUpload:T?U=>T(Pe.id,U):void 0,onDelete:C,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 ${E==="all"?"active":""}`,onClick:()=>W("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>W("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>W("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Pt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:F,onChange:U=>B(U.target.value),onKeyDown:it,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:rt,disabled:!F.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[q.map(U=>{let le=s.find(Q=>Q.id===U.userId);if(U.type.includes("COMMENT")){let Q=n.find(ce=>ce.id===U.metadata?.commentId);return Q?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.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:le?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Q.content})]})]},U.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.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:le?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:U.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),q.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Zf({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 di({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,m)=>l+m.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(Zf,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function ib({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 ci({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ib,{})}),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:m>=50?"#10B981":"#F59E0B"},children:[m.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 bb={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},vc=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function hb({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:m,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function xc({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 mi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||bb[m.name]||vc[e.indexOf(m)%vc.length]})),l=n.map(m=>m.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?hb:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(xc,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.value} - ${d}%)`}})]}):jsxs(BarChart$1,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(xc,{})}),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((m,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},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((m,i)=>i.value>m.value?i:m).name})]})]})]})}var In=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[m,i]=useState(false),[c,d]=useState(false),[u,f]=useState(false);if(e.length===0)return null;let y=e.map(w=>w.id),k=w=>{r.onBulkUpdate?.(y,{priority:w}),l(false);},g=w=>{r.onBulkMove?.(y,w),i(false),a();},v=w=>{r.onBulkUpdate?.(y,{assignedUserIds:w}),d(false);},h=w=>{let x=new Set;e.forEach(T=>{T.labels?.forEach(C=>x.add(C));});let S=Array.from(new Set([...x,...w]));r.onBulkUpdate?.(y,{labels:S}),f(false);},p=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(w),children:[jsx("span",{className:b("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!u),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:p,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"})})]})]})})});In.displayName="BulkOperationsToolbar";function wb(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(f=>{let y=a?.find(k=>k.id===f);n=`assignee-${f}`,l=y?.name||`User ${f}`,m=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let u={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=u.title,m=u.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,l=f,m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function pi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),l=useMemo(()=>wb(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(Mr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:b("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),u={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Mr,{board:u,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ui=[{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 gi({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=ui.find(i=>i.value===e)||ui[0];useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=i=>{t(i),o(false);};return jsxs("div",{className:b("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:b("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:ui.map(i=>jsxs("button",{onClick:()=>m(i.value),className:b("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 Ko=[{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 Nb(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&l&&m}function Nc(e={}){let{shortcuts:t=Ko,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(m=>{o.current=[...o.current,m];},[]),l=useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return useEffect(()=>{function m(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Nb(i,d)){r&&i.preventDefault();let u=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(u);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Sb(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Eb(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 Pb(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Eb(e),r=t?Sb(t):"";return a?`${a} + ${r}`:r}function Mb(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 fi({shortcuts:e=Ko,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=Mb(e);return jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([l,m])=>m.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:m.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:Pb(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var bi=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
72
72
|
1.
|
|
73
73
|
|
|
74
74
|
**Expected behavior:**
|
|
@@ -108,8 +108,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
108
108
|
1.
|
|
109
109
|
|
|
110
110
|
**Action items:**
|
|
111
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function hi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxs("div",{className:b("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:b("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(m).map(([i,c])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:c.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function vi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[m,i]=useState("json"),[c,d]=useState(null),u=useRef(null);if(!t)return null;let f=async()=>{let k=o?.current||void 0,g=await nd(e,m,k);sd(g,m);},y=async k=>{let g=k.target.files?.[0];if(g){try{let v=await dd(g),h=g.name.endsWith(".json")?"json":"csv",p=ld(v,h);d(p),p.success&&r&&r(p,v);}catch(v){d({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:b("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:b("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(k=>jsxs("button",{onClick:()=>i(k),className:b("p-4 rounded-lg border-2 transition-all text-center",m===k?"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:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),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:f,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:u,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),c&&jsxs("div",{className:b("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:b("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:c.errors.map((k,g)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},g))})]})]})]})]})]})}var Bb=["URGENT","HIGH","MEDIUM","LOW"],Rb=[{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"}],Ob=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function xi({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:u=false,groupBy:f="none",onGroupByChange:y}){let[k,g]=useState(true),v=useCallback(S=>{a({search:S.target.value});},[a]),h=useCallback(S=>{a({dateFilter:S.target.value});},[a]),p=useCallback(S=>{r({by:S.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=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 ${u?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>g(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:k?"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"}),x&&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)"]})]}),!k&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:v,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:S=>{let T=S.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Bb.map(S=>jsx("option",{value:S,children:S},S))]})}),m.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let T=S.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),m.map(S=>jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let T=S.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsx("option",{value:S,children:S},S))]})}),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:p,className:"filter-bar__select filter-bar__select--sm",children:Rb.map(S=>jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:f,onChange:S=>y(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Ob.map(S=>jsx("option",{value:S.value,children:S.label},S.value))})}),x&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ki({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:m}){let[i,c]=useState(false),d=useRef(null);useEffect(()=>{let f=y=>{d.current&&!d.current.contains(y.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let u=f=>{f(),c(false);};return jsxs("div",{className:b("relative",r),ref:d,children:[jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(()=>m?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 wi={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:"#3B82F6",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"}},Ci={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:"#2563EB",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"}},Ti={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"}},to={dark:wi,light:Ci,neutral:Ti},Rn="dark";var On=createContext(void 0),Kb="asakaa-theme";function Ec({children:e,defaultTheme:t=Rn,storageKey:a=Kb}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,m=to[r];Object.entries(m.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${Yb(c)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,d])=>{let u=m.colors[c];u&&l.style.setProperty(d,u);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:to};return jsx(On.Provider,{value:n,children:e})}function wo(){let e=useContext(On);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Yb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ni({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=wo();return e?jsxs("div",{className:b("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(to).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:b("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 Pc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Qe[e]||Qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Qe[e].bgSecondary),bgGrid:r("--theme-bg-card",Qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Qe[e].bgWeekend),border:r("--theme-border-primary",Qe[e].border),borderLight:r("--theme-border-subtle",Qe[e].borderLight),textPrimary:r("--theme-text-primary",Qe[e].textPrimary),textSecondary:r("--theme-text-secondary",Qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Qe[e].textTertiary),accent:r("--theme-accent-primary",Qe[e].accent),accentHover:r("--theme-accent-hover",Qe[e].accentHover),accentLight:r("--theme-accent-primary",Qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Qe[e].dependency),dependencyHover:r("--theme-border-secondary",Qe[e].dependencyHover),criticalPath:r("--theme-error",Qe[e].criticalPath),criticalPathLight:r("--theme-error",Qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Qe[e].today):e==="neutral"?r("--theme-text-primary",Qe[e].today):r("--theme-error",Qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Qe[e].todayLight):e==="neutral"?r("--theme-text-primary",Qe[e].todayLight):r("--theme-error",Qe[e].todayLight),milestone:r("--theme-warning",Qe[e].milestone),milestoneLight:r("--theme-warning",Qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Qe[e].statusInProgress),statusCompleted:r("--theme-success",Qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Qe[e].hoverBg),focusRing:r("--theme-accent-primary",Qe[e].focusRing)}}var zn={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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",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"}},Mc={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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",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"}},Di={en:zn,es:Mc};function Fc(e){return Di[e]||Di.en}function Si(e,t){let a=Fc(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 To=createContext(zn);function Br(){return useContext(To)}function fh({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,m]=useState(false),[i,c]=useState(null),d=useRef(null),u=Br();if(useEffect(()=>{let g=v=>{d.current&&!d.current.contains(v.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),!(t||a||r||o||s||n))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),k=async(g,v)=>{if(v){c(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:u.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:l&&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:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:y.map((g,v)=>jsxs(motion.button,{onClick:()=>k(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function bh({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-xs 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 hh({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-xs 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 yh({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=Br();useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=l.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&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 left-0 mt-2 w-36 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((i,c)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:c<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function vh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),m=Br();useEffect(()=>{if(!s)return;let u=setTimeout(()=>{let f=k=>{l.current&&!l.current.contains(k.target)&&n(false);},y=k=>{k.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",y),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(u),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:u=>{u.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":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:m.toolbar.filter||"Filters"}),c&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsx(AnimatePresence,{children:s&&jsxs(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 left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-2",children:i.map(u=>{let f=t===u.value&&!r,y=()=>u.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):u.icon;return jsxs(motion.button,{onClick:()=>{a(u.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx("span",{className:`${f?u.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:u.label}),f&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},u.value)})}),jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"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-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function $n({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:u,taskFilter:f="all",onTaskFilterChange:y,hideCompleted:k=false,onHideCompletedChange:g,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:w,onExportJSON:x,onExportMSProject:S}){let T=Br(),C=v||h||p||w||x||S,A=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],I=[{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"})}];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(hh,{options:A,value:t,onChange:N=>a(N),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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}}),jsx(yh,{theme:e,value:l,onChange:m}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(vh,{theme:e,value:f,onChange:y,hideCompleted:k,onHideCompletedChange:g})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[c&&u&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||T.toolbar.createTask})]}),(C||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),C&&jsxs(Fragment,{children:[jsx(fh,{theme:e,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:w,onExportJSON:x,onExportMSProject:S}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(bh,{options:I,value:s,onChange:N=>n(N),theme:e})]})]})}function Hn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(gt,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxs("button",{onClick:()=>{t(c.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:c.label}),c.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function No({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[l,m]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,u=8,f=window.innerWidth,y=window.innerHeight,k=t,g=a;t+c+u>f&&(k=t-c,k<u&&(k=u)),a+d+u>y&&(g=y-d-u,g<u&&(g=u)),m({x:k,y:g});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=u=>{n.current&&!n.current.contains(u.target)&&o();},d=u=>{u.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(c=>jsxs("div",{children:[c.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Rt={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"}),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 $c({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:u=true}){let f=useRef(false),y=useCallback(p=>{f.current=p;},[]),k=useCallback(p=>{let w=[],x=S=>{for(let T of S)w.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&x(T.subtasks);};return x(p),w},[]),g=useCallback(()=>{let p=k(e);for(let w of p)if(t.has(w.id))return w;return null},[e,t,k]),v=useCallback((p,w)=>{let x=k(e);if(x.length===0)return;let S=g();if(!S){a(x[0].id,false);return}let T=x.findIndex(I=>I.id===S.id);if(T===-1)return;let C=p==="up"?T-1:T+1;if(C<0||C>=x.length)return;let A=x[C];a(A.id,w);},[e,g,k,a]),h=useCallback(p=>{if(!u)return;let w=p.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||f.current){p.key==="Escape"&&(w.blur(),f.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?p.metaKey:p.ctrlKey,C=Array.from(t),A=g();if(p.key==="ArrowUp"){p.preventDefault(),v("up",p.shiftKey);return}if(p.key==="ArrowDown"){p.preventDefault(),v("down",p.shiftKey);return}if(A&&(p.key==="ArrowRight"||p.key==="ArrowLeft")){A.subtasks&&A.subtasks.length>0&&(p.preventDefault(),(p.key==="ArrowRight"&&!A.isExpanded||p.key==="ArrowLeft"&&A.isExpanded)&&c(A.id));return}if(p.altKey&&(p.key==="ArrowUp"||p.key==="ArrowDown")){C.length>0&&(p.preventDefault(),n(C,p.key==="ArrowUp"?"up":"down"));return}if(p.key==="Tab"&&!p.shiftKey){C.length>0&&(p.preventDefault(),l(C));return}if(p.key==="Tab"&&p.shiftKey){C.length>0&&(p.preventDefault(),m(C));return}if(p.key==="Enter"&&!p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"below"));return}if(p.key==="Enter"&&p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"above"));return}if(p.key==="Enter"&&T){A&&(p.preventDefault(),d(A.id));return}if(p.key==="F2"){A&&(p.preventDefault(),i(A.id));return}if(p.key==="Delete"||p.key==="Backspace"&&T){C.length>0&&(p.preventDefault(),o(C));return}if(p.key==="d"&&T&&!p.shiftKey){C.length>0&&(p.preventDefault(),s(C));return}},[u,t,g,v,r,o,s,n,l,m,i,c,d]);return useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:y}}function Wc(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(u=>{let f=new Set(u);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=useCallback((d,u)=>{if(!a){o(d);return}let f=u.indexOf(a),y=u.indexOf(d);if(f===-1||y===-1){o(d);return}let k=Math.min(f,y),g=Math.max(f,y),v=u.slice(k,g+1);t(new Set(v)),r(d);},[a,o]),l=useCallback((d,u,f,y)=>{y?n(d,u):f?s(d):o(d);},[o,s,n]),m=useCallback((d,u)=>{u?t(f=>{let y=new Set(f);return y.add(d),y}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Do(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let l={...r[n],parentId:o,level:s,position:n};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&a(l.subtasks,l.id,s+1);}};return a(e),t}function Gc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Gc(a.subtasks,t);if(r)return r}}return null}function Ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ii(a.subtasks,t);if(r)return r}return null}function Bi(e,t){if(t.length===0)return e;let a=Do(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,u)=>{let f=[];return {tasks:d.filter(k=>{if(u.has(k.id))return f.push(k),false;if(k.subtasks){let g=n(k.subtasks,u);k.subtasks=g.tasks,f.push(...g.removed);}return true}),removed:f}},l=(d,u,f)=>d.map(y=>y.id===u?{...y,subtasks:[...y.subtasks||[],...f],isExpanded:true}:y.subtasks?{...y,subtasks:l(y.subtasks,u,f)}:y),m=new Set(t),{tasks:i,removed:c}=n(e,m);return l(i,s.id,c)}function Ri(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ii(a,r);if(!o)continue;let s=Ii(a,o.id),n=(i,c,d)=>{for(let u=0;u<i.length;u++){let f=i[u];if(f.id===c&&f.subtasks){let y=f.subtasks.findIndex(k=>k.id===d);if(y!==-1){let[k]=f.subtasks.splice(y,1);return k}}if(f.subtasks){let y=n(f.subtasks,c,d);if(y)return y}}return null},l=(i,c,d)=>{let u=i.findIndex(f=>f.id===c);if(u!==-1)return i.splice(u+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,c,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?l(s.subtasks,o.id,m):l(a,o.id,m));}return a}function Oi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,m)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function zi(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 Ui(e,t){let a=[...e];for(let r of t){let o=n=>{let l=n.findIndex(c=>c.id===r);if(l===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[l],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(l+1,0,i),true},s=n=>n.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?s(l.subtasks):void 0}));o(a);}return a}function _c(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:"#6366F1"},l=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function $i(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:$i(r.subtasks,t,a)}:r)}function Hi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Hi(a.subtasks,t)}:a)}function Wi(e,t){let a=c=>{for(let d of c){if(d.id===t)return d;if(d.subtasks){let u=a(d.subtasks);if(u)return u}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6"},i=c=>c.map(d=>{if(d.id===t){let u=d.subtasks||[];return {...d,subtasks:[...u,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function Vc(e,t,a,r){if(t===a)return e;let o=Gc(e,t);if(!o)return e;if(a){let l=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>l.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,u=[...c];return u.splice(d,0,{...o,parentId:a}),{...i,subtasks:u,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function _n({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:u,onTaskUpdate:f,onTaskIndent:y,onTaskOutdent:k,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:p,onTaskRename:w,onCreateSubtask:x,onOpenTaskModal:S,onDeleteRequest:T,onTaskReparent:C}){let A=useContext(To),[I,N]=useState(null),[z,R]=useState(null),[V,ne]=useState(""),ae=useRef(null),[ie,ke]=useState(null),[Ne,Ae]=useState(0),[F,B]=useState(0),[E,W]=useState({isOpen:false,x:0,y:0,type:"header"}),[J,ue]=useState(null),[be,G]=useState(null),[he,j]=useState(null),He=useRef(0),de=5,Be=useRef(false),[nt,st]=useState(null),[Xe,kt]=useState(false),[ct,$t]=useState(null),[ge,L]=useState(false),re=useRef(null);useEffect(()=>{function _(q){re.current&&!re.current.contains(q.target)&&L(false);}if(ge)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[ge]),useEffect(()=>{z&&ae.current&&(ae.current.focus(),ae.current.select());},[z]),useEffect(()=>{if(!ie)return;let _=Pe=>{let je=Pe.clientX-Ne,Oe=F+je;u?.(ie,Oe);},q=()=>{ke(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,Ne,F,u]);let{selectedTaskIds:Te,handleTaskClick:ze,isTaskSelected:Z}=Wc(),{setIsEditing:Re}=$c({tasks:e,selectedTaskIds:Te,onTaskSelect:(_,q)=>{let je=Do(e).map(Oe=>Oe.id);ze(_,je,q||false,false);},onTaskCreate:p||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:_=>{let q=Do(e).find(Pe=>Pe.id===_);q&&We(q);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:_=>{let q=Do(e).find(Pe=>Pe.id===_);q&&S&&S(q);},enableKeyboard:true}),H=(_,q=0)=>{let Pe=[];for(let je of _)Pe.push({task:je,level:q}),je.subtasks&&je.subtasks.length>0&&je.isExpanded&&Pe.push(...H(je.subtasks,q+1));return Pe},Y=H(e),we=48,Le=Math.max(Y.length*a,600-we),Ge=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,We=_=>{R(_.id),ne(_.name),Re(true);},se=_=>{V.trim()&&V!==e.find(q=>q.id===_)?.name&&w?.(_,V.trim()),R(null),ne(""),Re(false);},Ie=()=>{R(null),ne(""),Re(false);},ee=(_,q)=>{q.stopPropagation(),x?.(_.id);},Ke=(_,q)=>{q.preventDefault(),He.current=q.clientY,ue(_),Be.current=false,kt(false),st({x:q.clientX,y:q.clientY});},Pa=_=>{if(!J||(Math.abs(_.clientY-He.current)>de&&!Be.current&&(Be.current=true,kt(true)),st({x:_.clientX,y:_.clientY}),!Be.current))return;let Pe=document.querySelectorAll("[data-task-row]"),je=null,Oe=null;Pe.forEach(U=>{let le=U.getBoundingClientRect(),D=U.getAttribute("data-task-row");if(D&&D!==J&&_.clientY>=le.top&&_.clientY<=le.bottom){je=D;let Q=_.clientY-le.top,me=le.height;Q<me*.25?Oe="above":Q>me*.75?Oe="below":Oe="child";}}),G(je),j(Oe);},fe=()=>{if(Be.current&&J&&be&&he){if(he==="child")C?.(J,be);else if(he==="above"||he==="below"){let _=(je,Oe,U=null)=>{for(let le of je){if(le.id===Oe)return U;if(le.subtasks){let D=_(le.subtasks,Oe,le.id);if(D!==void 0)return D}}},q=_(e,be,null),Pe=(je,Oe)=>{let U=je.findIndex(le=>le.id===Oe);return he==="below"?U+1:U};if(q===null){let je=Pe(e,be);C?.(J,null,je);}else {let je=Y.find(Oe=>Oe.task.id===q)?.task;if(je?.subtasks){let Oe=Pe(je.subtasks,be);C?.(J,q,Oe);}}}}ue(null),G(null),j(null),st(null),Be.current=false,kt(false);};useEffect(()=>{if(J)return document.addEventListener("mousemove",Pa),document.addEventListener("mouseup",fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Pa),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[J,be,he]);let Ye=(_,q,Pe)=>{switch(_.id){case "name":let je=z===q.id,Oe=I===q.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Pe*20}px`},children:[C&&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:Oe?1:.3},onMouseDown:ce=>Ke(q.id,ce),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),q.subtasks&&q.subtasks.length>0?jsx("button",{onClick:ce=>{ce.stopPropagation(),m?.(q.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:q.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 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:q.color||"#3B82F6",opacity:q.parentId?.6:1,borderColor:q.isMilestone?t.accent:"transparent",borderWidth:q.isMilestone?"2px":"0px"},title:q.isMilestone?"Milestone":q.parentId?"Subtask":"Task"})}),je?jsx("input",{ref:ae,type:"text",value:V,onChange:ce=>ne(ce.target.value),onKeyDown:ce=>{ce.key==="Enter"?se(q.id):ce.key==="Escape"&&Ie();},onBlur:()=>se(q.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:ce=>ce.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:q.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:q.parentId?"13px":"14px",fontWeight:q.isMilestone?600:q.parentId?400:600,letterSpacing:q.parentId?"0":"-0.01em"},title:q.name,children:q.name}),Oe&&!je&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ce=>ce.stopPropagation(),children:[jsx("button",{onClick:ce=>ee(q,ce),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:ce=>{ce.stopPropagation(),We(q);},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 le=_.id==="startDate"?"startDate":"endDate",D=q[le],Q=ct?.taskId===q.id&&ct?.field===le,me=ce=>ce?(typeof ce=="string"?new Date(ce):ce).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ce=>ce.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},onClick:ce=>{if(Q)$t(null);else {let Ze=ce.currentTarget.getBoundingClientRect();$t({taskId:q.id,field:le,month:D?typeof D=="string"?new Date(D):D:new Date,position:{top:Ze.bottom+4,left:Ze.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:me(D)})]}),Q&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>$t(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:ct?.position.top,left:ct?.position.left},onClick:ce=>ce.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ce=new Date,Ze=new Date(ce);Ze.setDate(ce.getDate()+1);let _e=new Date(ce);_e.setDate(ce.getDate()+7);let ar=new Date(ce);return ar.setDate(ce.getDate()+14),[{label:"Hoy",date:ce},{label:"Ma\xF1ana",date:Ze},{label:"Pr\xF3xima semana",date:_e},{label:"2 semanas",date:ar}].map((kr,rr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:or=>or.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:or=>or.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(q.id,{[le]:kr.date}),$t(null);},children:kr.label},rr))})(),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:ce=>ce.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(q.id,{[le]:void 0}),$t(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:()=>$t(ce=>ce?{...ce,month:new Date(ce.month.getFullYear(),ce.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:ct?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>$t(ce=>ce?{...ce,month:new Date(ce.month.getFullYear(),ce.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((ce,Ze)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ce},Ze))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ce=ct?.month||new Date,Ze=ce.getFullYear(),_e=ce.getMonth(),ar=new Date(Ze,_e,1).getDay(),Lo=new Date(Ze,_e+1,0).getDate(),kr=new Date,rr=[];for(let Kt=ar-1;Kt>=0;Kt--)rr.push({day:new Date(Ze,_e,-Kt).getDate(),date:new Date(Ze,_e-1,new Date(Ze,_e,-Kt).getDate()),isCurrentMonth:false});for(let Kt=1;Kt<=Lo;Kt++)rr.push({day:Kt,date:new Date(Ze,_e,Kt),isCurrentMonth:true});let or=42-rr.length;for(let Kt=1;Kt<=or;Kt++)rr.push({day:Kt,date:new Date(Ze,_e+1,Kt),isCurrentMonth:false});return rr.map((Kt,Ts)=>{let Ns=Kt.date.toDateString()===kr.toDateString(),Io=(D?typeof D=="string"?new Date(D):D:null)?.toDateString()===Kt.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:Kt.isCurrentMonth?Io?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Io?"#3B82F6":"transparent",boxShadow:Ns&&!Io?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(q.id,{[le]:Kt.date}),$t(null);},children:Kt.day},Ts)})})()})]})]})]}),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:Ge(q)})});case "assignees":let qe=r.filter(ce=>q.assignees?.some(Ze=>Ze.name===ce.name||Ze.initials===ce.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsx(qr,{assignedUsers:qe,availableUsers:r,onChange:ce=>{let Ze=ce.map(_e=>({id:_e.id,name:_e.name,initials:_e.initials,color:_e.color}));f?.(q.id,{assignees:Ze.length>0?Ze:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsx(Ed,{status:q.status||"todo",onChange:ce=>{f?.(q.id,{status:ce,progress:ce==="completed"?100:q.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",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:`${q.progress}%`,backgroundColor:q.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:[q.progress,"%"]})]});case "priority":let Mt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Zt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Dt=Mt[q.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:ce=>ce.stopPropagation(),children:jsx(Kr,{priority:Dt,onChange:ce=>{ce&&f?.(q.id,{priority:Zt[ce]||"medium"});}})});default:return null}},$e=_=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Je=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{x?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{T?T(_.id,_.name):v?.([_.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{n?.(_);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{x?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{f?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{f?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{f?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{T?T(_.id,_.name):v?.([_.id]);}}],at=c.filter(_=>_.visible),it=at.reduce((_,q)=>_+q.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:it},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${we}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:at.map((_,q)=>{let Pe=q===at.length-1,je=_.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${je?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(je?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Pe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Oe=>{Oe.preventDefault(),W({isOpen:true,x:Oe.clientX,y:Oe.clientY,type:"header",columnId:_.id});},onMouseEnter:Oe=>{Oe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Oe=>{Oe.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:_.label,children:_.label}),_.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ie===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Oe=>{Oe.preventDefault(),Oe.stopPropagation(),ke(_.id),Ae(Oe.clientX),B(_.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"}})})]},_.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(Hn,{columns:c,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>L(!ge),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"})}),ge&&jsxs("div",{ref:re,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:_=>_.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:()=>L(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:Le},children:Y.map(({task:_,level:q},Pe)=>{let je=Z(_.id),Oe=be===_.id,U=Oe&&he==="above",le=Oe&&he==="below",D=Oe&&he==="child",Q={};return D&&(Q.backgroundColor=`${t.accent}15`,Q.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${J===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:je?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:je?t.accentLight:D?`${t.accent}15`:Pe%2===0?t.bgPrimary:t.bgGrid,...Q},onMouseEnter:()=>N(_.id),onMouseLeave:()=>N(null),onClick:me=>{let Mt=Do(e).map(ce=>ce.id),Dt=navigator.platform.toUpperCase().indexOf("MAC")>=0?me.metaKey:me.ctrlKey;ze(_.id,Mt,Dt,me.shiftKey),s?.(_);},onDoubleClick:me=>{me.stopPropagation(),n?.(_);},onContextMenu:me=>{me.preventDefault(),W({isOpen:true,x:me.clientX,y:me.clientY,type:"task",task:_}),l?.(_,me);},whileHover:{backgroundColor:je?t.accentLight:t.hoverBg},children:[U&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),le&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),at.map((me,qe)=>{let Mt=qe===at.length-1,Zt=me.id==="name";return jsx("div",{className:`px-4 flex items-center ${Zt?"justify-start":"justify-center"}`,style:{width:`${me.width}px`,minWidth:`${me.minWidth??(Zt?200:60)}px`,maxWidth:`${me.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Mt?"none":`1px solid ${I===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ye(me,_,Zt?q:0)},`${_.id}-${me.id}`)})]},_.id)})}),jsx(No,{isOpen:E.isOpen,x:E.x,y:E.y,items:E.type==="header"&&E.columnId?$e(E.columnId):E.type==="task"&&E.task?Je(E.task):[],onClose:()=>W({...E,isOpen:false}),theme:t}),Xe&&nt&&J&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:nt.x+12,top:nt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=Y.find(q=>q.task.id===J)?.task;return _?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:_.name})}):null})()}),document.body)]})}function Xc(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[m,i]=useState(t),[c,d]=useState(null),[u,f]=useState(null),[y,k]=useState(null),[g,v]=useState(null),[h,p]=useState(0),[w,x]=useState(0),[S,T]=useState(null),[C,A]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:u,setHoveredTaskId:f,activeZone:y,setActiveZone:k,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:p,segmentDragOffsetX:w,setSegmentDragOffsetX:x,hoveredSegmentIndex:S,setHoveredSegmentIndex:T,isHovered:C,setIsHovered:A,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(V,ne)=>{r("none"),d(null),f(null),l(V),i(ne),x(0),v(null),p(0);}}}function jn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:u,allTaskPositions:f=[],onDragMove:y,onHoverChange:k}){let g=Xc(t,r),v=useRef(null),h=useRef(null),p=useRef(null),{dragMode:w,setDragMode:x,dragOffset:S,setDragOffset:T,ghostX:C,setGhostX:A,ghostWidth:I,setGhostWidth:N,connectionLine:z,setConnectionLine:R,hoveredTaskId:V,setHoveredTaskId:ne,activeZone:ae,setActiveZone:ie,draggedSegmentIndex:ke,setDraggedSegmentIndex:Ne,draggedSegmentStartX:Ae,setDraggedSegmentStartX:F,segmentDragOffsetX:B,setSegmentDragOffsetX:E,hoveredSegmentIndex:W,setHoveredSegmentIndex:J,isHovered:ue,setIsHovered:be,isDragging:G,isResizing:he,isConnecting:j,resetDragState:He}=g,de=32,Be=8,nt=e.endDate&&e.endDate<new Date&&e.progress<100,st=e.isCriticalPath,Xe=o.name==="neutral"||o.today==="#1C1917",kt=e.status==="completed"||e.progress===100,ct={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ge=e.isCriticalPath||nt?"#DC2626":e.color?e.color:e.priority&&ct[e.priority]?ct[e.priority]:o.taskBarPrimary,re=(fe=>fe>=80?20:fe>=60?15:fe>=50?12:10)(r),Te=r<50,ze=r<40;useEffect(()=>{if(k)if(ue&&!G&&!e.segments){let fe=a<100;k({task:e,x:t,y:a,width:r,height:de,showBelow:fe});}else k(null);},[ue,G,e,t,a,r,de,k]);let Z=fe=>fe.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Re=()=>{let fe=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${fe} day${fe!==1?"s":""}`},H=fe=>Math.round(fe/s)*s,Y=fe=>{let Ye=Math.round(fe/s),$e=new Date(n);return $e.setDate($e.getDate()+Ye),$e},we=(fe,Ye)=>{for(let $e of f){if($e.id===e.id)continue;let Je=5;if(fe>=$e.x-Je&&fe<=$e.x+$e.width+Je&&Ye>=$e.y-Je&&Ye<=$e.y+$e.height+Je)return $e.id}return null},Le=useCallback((fe,Ye,$e)=>{fe.preventDefault(),fe.stopPropagation();let Je=v.current?.ownerSVGElement;if(!Je)return;let at=Je.createSVGPoint();at.x=fe.clientX,at.y=fe.clientY;let it=at.matrixTransform(Je.getScreenCTM()?.inverse()),_=$e!==void 0?$e:t,q=Ye;if(!q){let Pe=it.x-_;fe.shiftKey?(q="connect",R({x:t+r,y:a+de/2})):fe.ctrlKey||fe.metaKey?q="move":fe.altKey?q=Pe<r/2?"resize-start":"resize-end":ze?Pe<r/2?q="move":q="resize-end":Te?Pe<=re/2?q="resize-start":Pe>=r-re/2?q="resize-end":q="move":Pe<=re?q="resize-start":Pe>=r-re?q="resize-end":q="move";}x(q),be(false),ie(null),q==="move"?T(it.x-_):q==="connect"?R({x:t+r,y:a+de/2}):T(0),A(_),N(r);},[t,r,a,de]),Ge=useCallback(fe=>{let Ye=v.current?.ownerSVGElement;if(!Ye)return;let $e=Ye.closest(".gantt-timeline-scroll");if(!$e)return;let Je=$e.getBoundingClientRect(),at=60,it=15,_=0;if(fe.clientX<Je.left+at){let q=Je.left+at-fe.clientX;_=-Math.min(it,q/2);}else if(fe.clientX>Je.right-at){let q=fe.clientX-(Je.right-at);_=Math.min(it,q/2);}return _!==0&&($e.scrollLeft+=_),_!==0},[]),We=useCallback(fe=>{if(w==="none")return;p.current=fe;let Ye=v.current?.ownerSVGElement;if(!Ye)return;if(w==="move"||w==="resize-start"||w==="resize-end"){let at=Ge(fe);at&&!h.current?h.current=window.setInterval(()=>{p.current&&(Ge(p.current),We(p.current));},16):!at&&h.current&&(window.clearInterval(h.current),h.current=null);}let $e=Ye.createSVGPoint();$e.x=fe.clientX,$e.y=fe.clientY;let Je=$e.matrixTransform(Ye.getScreenCTM()?.inverse());if(w==="connect"){R({x:Je.x,y:Je.y});let at=we(Je.x,Je.y);ne(at);}else if(w==="move"){let at=Je.x-S,it=H(at);A(it),N(r);let _=Math.round((it-t)/s);if(y?.(e.id,_,true),e.segments&&e.segments.length>0&&ke!==null){let q=it-Ae;E(q);}}else if(w==="resize-start"){let at=Je.x,it=H(at),_=t+r-it;_>=s&&(A(it),N(_));}else if(w==="resize-end"){let at=Je.x,_=H(at)-t;_>=s&&N(_);}},[w,t,r,s,S,e,H,ke,Ae,we,ne,R,A,N,E,y,Ge]),se=useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),p.current=null,w!=="none"){if(w==="connect")V&&u&&u(e,V),R(null),ne(null);else {let fe=e.endDate.getTime()-e.startDate.getTime(),Ye,$e,Je=true;if(w==="move"){if(Ye=Y(C),$e=new Date(Ye.getTime()+fe),e.segments&&e.segments.length>0&&ke!==null){let at=Math.round(B/s),it=e.segments.map((je,Oe)=>{if(Oe===ke){let U=new Date(je.startDate),le=new Date(je.endDate);return U.setDate(U.getDate()+at),le.setDate(le.getDate()+at),{startDate:U,endDate:le}}return je}),_=it.flatMap(je=>[je.startDate,je.endDate]),q=new Date(Math.min(..._.map(je=>je.getTime()))),Pe=new Date(Math.max(..._.map(je=>je.getTime())));d?.({...e,segments:it},q,Pe),He(t,r);return}}else w==="resize-start"?(Ye=Y(C),$e=e.endDate,Ye>$e&&(console.warn("Invalid date range: start date must be before or equal to end date"),Je=false)):w==="resize-end"?(Ye=e.startDate,$e=Y(C+I),$e<Ye&&(console.warn("Invalid date range: end date must be after or equal to start date"),Je=false)):Je=false;Je&&Ye&&$e&&($e.getTime()<Ye.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,Ye,$e));}y?.(e.id,0,false),He(t,r);}},[w,C,I,e,d,V,u,t,r,s,Y,B,ke,He,y]);useEffect(()=>{if(w==="none")return;let fe=$e=>{We($e);},Ye=()=>{se();};return window.addEventListener("mousemove",fe),window.addEventListener("mouseup",Ye),()=>{window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",Ye),h.current&&(window.clearInterval(h.current),h.current=null);}},[w,We,se]);let Ie=G&&!j?C:t,ee=G&&!j?I:r,Ke=l.taskClass(e);return jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!G&&m?.(e),onDoubleClick:fe=>{G||(fe.stopPropagation(),i?.(e));},onContextMenu:fe=>{fe.preventDefault(),c?.(e,fe);},onMouseEnter:()=>!G&&be(true),onMouseLeave:()=>{G||(be(false),ie(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:de,fill:"transparent",style:{pointerEvents:"all"}}),ue&&!G&&!Te&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:re,height:de,fill:ae==="resize-start"?o.accent:"transparent",opacity:ae==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-start"),onMouseDown:fe=>Le(fe,"resize-start")}),jsx("rect",{x:t+re,y:a,width:r-re*2,height:de,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:fe=>Le(fe,"move")}),jsx("rect",{x:t+r-re,y:a,width:re,height:de,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:fe=>Le(fe,"resize-end")})]}),ue&&!G&&ze&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:de,fill:ae==="move"?o.accent:"transparent",opacity:ae==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:fe=>Le(fe,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:de,fill:ae==="resize-end"?o.accent:"transparent",opacity:ae==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:fe=>Le(fe,"resize-end")}),ue&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+de-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),G&&!j&&!e.segments&&jsx(motion.rect,{x:C,y:a,width:I,height:de,rx:Be,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsx(motion.rect,{x:Ie,y:a,width:ee,height:de,rx:Be,fill:ge,"data-task-class":Ke,initial:{opacity:0,scale:.95},animate:{opacity:G&&!j?.15:e.parentId?.6:ue?.9:.8,scale:ue&&!G?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:fe=>Le(fe),style:{cursor:G?j?"crosshair":he?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Ie,y:a,width:ee*(e.progress/100),height:de,rx:Be,fill:ge,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((fe,Ye)=>{let $e=(fe.startDate.getTime()-n.getTime())/864e5*s,at=(fe.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-$e+s,it=G&&w==="move"&&ke===Ye,_=W===Ye,q=it?$e+B:$e;return jsxs("g",{onMouseEnter:()=>!G&&J(Ye),onMouseLeave:()=>!G&&J(null),children:[jsx(motion.rect,{x:q,y:a,width:at,height:de,rx:Be,fill:ge,initial:{opacity:0,scale:.95},animate:{opacity:it||e.parentId?.6:_?.9:.8,scale:_&&!G?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Pe=>{Pe.stopPropagation(),Ne(Ye),F($e),Le(Pe,void 0,$e);},style:{cursor:G?j?"crosshair":he?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:q,y:a,width:at*(e.progress/100),height:de,rx:Be,fill:ge,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ye}`)}),Xe&&(nt||st)&&!e.segments&&jsxs(Fragment,{children:[st&&!nt&&jsx("rect",{x:Ie,y:a,width:ee,height:de,rx:Be,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),nt&&jsx("rect",{x:Ie,y:a,width:ee,height:de,rx:Be,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ee>60&&!e.segments&&(()=>{let fe=l.taskLabel(e),Ye=typeof fe=="string"?fe:e.name,$e=Ye.length>Math.floor(ee/8)?`${Ye.substring(0,Math.floor(ee/8))}...`:Ye;return jsx("text",{x:Ie+12,y:a+de/2,dominantBaseline:"middle",fill:kt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:kt?"line-through":"none"},children:$e})})(),ee>100&&e.progress>0&&e.progress<100&&!G&&!e.segments&&jsxs("text",{x:Ie+ee-12,y:a+de/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,"%"]}),e.status&&ee>80&&!G&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ie+ee-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ie+ee-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ue||he)&&!j&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ie-2,y:a,width:16,height:de,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-start"),onMouseLeave:()=>ie(null),onMouseDown:fe=>{fe.stopPropagation(),Le(fe,"resize-start");}}),jsx(motion.rect,{x:Ie+4,y:a+8,width:3,height:de-16,rx:1.5,fill:ae==="resize-start"||w==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Ie+ee-14,y:a,width:16,height:de,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-end"),onMouseLeave:()=>ie(null),onMouseDown:fe=>{fe.stopPropagation(),Le(fe,"resize-end");}}),jsx(motion.rect,{x:Ie+ee-7,y:a+8,width:3,height:de-16,rx:1.5,fill:ae==="resize-end"||w==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ue&&!G&&!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+de/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ie("connect"),onMouseLeave:()=>ie(null),onMouseDown:fe=>{fe.stopPropagation(),Le(fe,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+de/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ae==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),j&&z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+de/2,x2:z.x,y2:z.y,stroke:V?o.statusCompleted:o.accent,strokeWidth:V?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:V?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:z.x,cy:z.y,r:V?8:6,fill:V?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),V&&jsx(motion.text,{x:z.x+15,y:z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:z.x+10},animate:{opacity:1,x:z.x+15},transition:{duration:.2},children:"Connect"})]}),(ue||G)&&!j&&!e.segments&&jsx(motion.rect,{x:Ie-2,y:a-2,width:ee+4,height:de+4,rx:Be+2,fill:"none",stroke:G?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:G?.6:.4,initial:{opacity:0},animate:{opacity:G?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),he&&jsxs(Fragment,{children:[jsx("line",{x1:C,y1:0,x2:C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:C+I,y1:0,x2:C+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ue&&!G&&!e.segments&&!k&&(()=>{let $e=a<100,Je=$e?a+de+13:a-82-13,at=$e?`M ${Ie+ee/2-6} ${a+de+3} L ${Ie+ee/2} ${a+de+13} L ${Ie+ee/2+6} ${a+de+3}`:`M ${Ie+ee/2-6} ${a-13} L ${Ie+ee/2} ${a-3} L ${Ie+ee/2+6} ${a-13}`,it=Je+22,_=Je+40,q=Je+55,Pe=Je+70,je=$e?Je+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:$e?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:$e?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:at,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Ie+ee/2-120,y:Je,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Ie+ee/2,y:it,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Ie+ee/2-110,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ie+ee/2-70,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Z(e.startDate)}),jsx("text",{x:Ie+ee/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ie+ee/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Z(e.endDate)}),jsx("text",{x:Ie+ee/2+10,y:_,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ie+ee/2+65,y:_,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Re()}),jsx("text",{x:Ie+ee/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ie+ee/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Ie+ee/2-110,y:Pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ie+ee/2-50,y:Pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Oe=>Oe.name).join(", ").substring(0,30),e.assignees.map(Oe=>Oe.name).join(", ").length>30?"...":""]})]}),!$e&&jsx("text",{x:Ie+ee/2,y:je,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ze?"Left: move \u2022 Right: resize":Te?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Qc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:l}=e,m=82,i=13,c=l?o+n+i:o-m-i,d=l?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,u=c+22,f=c+40,y=c+55,k=c+70,g=w=>w.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let w=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${w} day${w!==1?"s":""}`};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:l?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:l?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+s/2-120,y:c,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:u,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(w=>w.name).join(", ").substring(0,30),a.assignees.map(w=>w.name).join(", ").length>30?"...":""]})]})]})})}function qn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false}){let[m,i]=useState(false),[c,d]=useState(null),u=r-t,f=u>0,y=Math.abs(u)<5,k=20,g=!y&&a<=e,v,h,p=a-e,w=e+p/2;if(h=w,n==="squared")if(y)v=`M ${e} ${t} L ${a} ${r}`;else if(g){let ie=e+15,ke=a-k,Ne=f?t+20:t-20;h=ke,v=`M ${e} ${t} L ${ie} ${t} L ${ie} ${Ne} L ${ke} ${Ne} L ${ke} ${r} L ${a} ${r}`;}else h=a-k,v=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else v=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let x=5,S=`M ${a} ${r} L ${a-x} ${r-x*.5} M ${a} ${r} L ${a-x} ${r+x*.5}`,T=o.dependency,C=o.dependencyHover||T,A="#f87171",I="rgba(248, 113, 113, 0.15)",N=h,z=(t+r)/2;if(c)if(y)N=Math.max(e+10,Math.min(a-10,c.x)),z=t;else if(g){let ae=e+15,ie=a-k,ke=f?t+20:t-20,Ne=[[e,t,ae,t],[ae,t,ae,ke],[ae,ke,ie,ke],[ie,ke,ie,r],[ie,r,a,r]],Ae=1/0,F={x:N,y:z};for(let B of Ne){let E=R(c.x,c.y,B[0],B[1],B[2],B[3]),W=Math.hypot(c.x-E.x,c.y-E.y);W<Ae&&(Ae=W,F=E);}N=F.x,z=F.y;}else {let ae=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],ie=1/0,ke={x:N,y:z};for(let Ne of ae){let Ae=R(c.x,c.y,Ne[0],Ne[1],Ne[2],Ne[3]),F=Math.hypot(c.x-Ae.x,c.y-Ae.y);F<ie&&(ie=F,ke=Ae);}N=ke.x,z=ke.y;}function R(ae,ie,ke,Ne,Ae,F){let B=Ae-ke,E=F-Ne,W=B*B+E*E;if(W===0)return {x:ke,y:Ne};let J=((ae-ke)*B+(ie-Ne)*E)/W;return J=Math.max(0,Math.min(1,J)),{x:ke+J*B,y:Ne+J*E}}let V=ae=>{let ie=ae.currentTarget.ownerSVGElement;if(!ie)return;let ke=ie.getBoundingClientRect();d({x:ae.clientX-ke.left,y:ae.clientY-ke.top});},ne=()=>{i(false),d(null);};return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:ne,onMouseMove:V,children:[jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:v,fill:"none",stroke:C,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:v,fill:"none",stroke:C,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:S,fill:"none",stroke:C,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:C,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ae=>{ae.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:N,cy:z,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsx("line",{x1:N-3,y1:z-3,x2:N+3,y2:z+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:N+3,y1:z-3,x2:N-3,y2:z+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:ne,onMouseMove:V,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:v,fill:"none",stroke:m?C:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsx(motion.path,{d:S,fill:"none",stroke:m?C:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?C:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ae=>{ae.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:N,cy:z,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsx("line",{x1:N-3,y1:z-3,x2:N+3,y2:z+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:N+3,y1:z-3,x2:N-3,y2:z+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Jn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),l=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(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 xe={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(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,m=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&m(d))return true;if(l.has(d))return true}}return l.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=xe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=xe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=xe.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=xe.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(`
|
|
112
|
-
`)},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=
|
|
111
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function hi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxs("div",{className:b("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:b("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(m).map(([i,c])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:c.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function vi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[m,i]=useState("json"),[c,d]=useState(null),u=useRef(null);if(!t)return null;let f=async()=>{let k=o?.current||void 0,g=await nd(e,m,k);sd(g,m);},y=async k=>{let g=k.target.files?.[0];if(g){try{let v=await dd(g),h=g.name.endsWith(".json")?"json":"csv",p=ld(v,h);d(p),p.success&&r&&r(p,v);}catch(v){d({success:false,errors:[`Failed to read file: ${v instanceof Error?v.message:"Unknown error"}`]});}u.current&&(u.current.value="");}};return jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:b("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:b("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(k=>jsxs("button",{onClick:()=>i(k),className:b("p-4 rounded-lg border-2 transition-all text-center",m===k?"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:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),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:f,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:u,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxs("button",{onClick:()=>u.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),c&&jsxs("div",{className:b("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:b("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:c.errors.map((k,g)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},g))})]})]})]})]})]})}var Bb=["URGENT","HIGH","MEDIUM","LOW"],Rb=[{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"}],Ob=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function xi({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:u=false,groupBy:f="none",onGroupByChange:y}){let[k,g]=useState(true),v=useCallback(S=>{a({search:S.target.value});},[a]),h=useCallback(S=>{a({dateFilter:S.target.value});},[a]),p=useCallback(S=>{r({by:S.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),x=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 ${u?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>g(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:k?"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"}),x&&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)"]})]}),!k&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:v,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:S=>{let T=S.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Bb.map(S=>jsx("option",{value:S,children:S},S))]})}),m.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let T=S.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),m.map(S=>jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let T=S.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsx("option",{value:S,children:S},S))]})}),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:p,className:"filter-bar__select filter-bar__select--sm",children:Rb.map(S=>jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:f,onChange:S=>y(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Ob.map(S=>jsx("option",{value:S.value,children:S.label},S.value))})}),x&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ki({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:m}){let[i,c]=useState(false),d=useRef(null);useEffect(()=>{let f=y=>{d.current&&!d.current.contains(y.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let u=f=>{f(),c(false);};return jsxs("div",{className:b("relative",r),ref:d,children:[jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(()=>m?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:()=>u(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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 wi={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:"#3B82F6",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"}},Ci={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:"#2563EB",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"}},Ti={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"}},to={dark:wi,light:Ci,neutral:Ti},Rn="dark";var On=createContext(void 0),Kb="asakaa-theme";function Ec({children:e,defaultTheme:t=Rn,storageKey:a=Kb}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,m=to[r];Object.entries(m.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${Yb(c)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([c,d])=>{let u=m.colors[c];u&&l.style.setProperty(d,u);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:to};return jsx(On.Provider,{value:n,children:e})}function wo(){let e=useContext(On);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Yb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Ni({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=wo();return e?jsxs("div",{className:b("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(to).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:b("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 Pc(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing)}}var zn={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"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",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"}},Mc={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"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",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"}},Di={en:zn,es:Mc};function Fc(e){return Di[e]||Di.en}function Si(e,t){let a=Fc(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 To=createContext(zn);function Br(){return useContext(To)}function fh({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,m]=useState(false),[i,c]=useState(null),d=useRef(null),u=Br();if(useEffect(()=>{let g=v=>{d.current&&!d.current.contains(v.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),!(t||a||r||o||s||n))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),k=async(g,v)=>{if(v){c(g);try{await v();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:u.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:l&&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:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:y.map((g,v)=>jsxs(motion.button,{onClick:()=>k(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function bh({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-xs 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 hh({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-xs 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 yh({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=Br();useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=l.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&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 left-0 mt-2 w-36 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((i,c)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:c<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function vh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),m=Br();useEffect(()=>{if(!s)return;let u=setTimeout(()=>{let f=k=>{l.current&&!l.current.contains(k.target)&&n(false);},y=k=>{k.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",y),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(u),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:u=>{u.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":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:m.toolbar.filter||"Filters"}),c&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsx(AnimatePresence,{children:s&&jsxs(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 left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-2",children:i.map(u=>{let f=t===u.value&&!r,y=()=>u.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):u.icon;return jsxs(motion.button,{onClick:()=>{a(u.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx("span",{className:`${f?u.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:u.label}),f&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},u.value)})}),jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"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-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function $n({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:u,taskFilter:f="all",onTaskFilterChange:y,hideCompleted:k=false,onHideCompletedChange:g,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:w,onExportJSON:x,onExportMSProject:S}){let T=Br(),C=v||h||p||w||x||S,A=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],I=[{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"})}];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(hh,{options:A,value:t,onChange:N=>a(N),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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}}),jsx(yh,{theme:e,value:l,onChange:m}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(vh,{theme:e,value:f,onChange:y,hideCompleted:k,onHideCompletedChange:g})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[c&&u&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:u,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||T.toolbar.createTask})]}),(C||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),C&&jsxs(Fragment,{children:[jsx(fh,{theme:e,onExportPNG:v,onExportPDF:h,onExportExcel:p,onExportCSV:w,onExportJSON:x,onExportMSProject:S}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(bh,{options:I,value:s,onChange:N=>n(N),theme:e})]})]})}function Hn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(gt,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxs("button",{onClick:()=>{t(c.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:c.label}),c.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function No({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[l,m]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,u=8,f=window.innerWidth,y=window.innerHeight,k=t,g=a;t+c+u>f&&(k=t-c,k<u&&(k=u)),a+d+u>y&&(g=y-d-u,g<u&&(g=u)),m({x:k,y:g});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=u=>{n.current&&!n.current.contains(u.target)&&o();},d=u=>{u.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(c=>jsxs("div",{children:[c.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Ot={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"}),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 $c({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:u=true}){let f=useRef(false),y=useCallback(p=>{f.current=p;},[]),k=useCallback(p=>{let w=[],x=S=>{for(let T of S)w.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&x(T.subtasks);};return x(p),w},[]),g=useCallback(()=>{let p=k(e);for(let w of p)if(t.has(w.id))return w;return null},[e,t,k]),v=useCallback((p,w)=>{let x=k(e);if(x.length===0)return;let S=g();if(!S){a(x[0].id,false);return}let T=x.findIndex(I=>I.id===S.id);if(T===-1)return;let C=p==="up"?T-1:T+1;if(C<0||C>=x.length)return;let A=x[C];a(A.id,w);},[e,g,k,a]),h=useCallback(p=>{if(!u)return;let w=p.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||f.current){p.key==="Escape"&&(w.blur(),f.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?p.metaKey:p.ctrlKey,C=Array.from(t),A=g();if(p.key==="ArrowUp"){p.preventDefault(),v("up",p.shiftKey);return}if(p.key==="ArrowDown"){p.preventDefault(),v("down",p.shiftKey);return}if(A&&(p.key==="ArrowRight"||p.key==="ArrowLeft")){A.subtasks&&A.subtasks.length>0&&(p.preventDefault(),(p.key==="ArrowRight"&&!A.isExpanded||p.key==="ArrowLeft"&&A.isExpanded)&&c(A.id));return}if(p.altKey&&(p.key==="ArrowUp"||p.key==="ArrowDown")){C.length>0&&(p.preventDefault(),n(C,p.key==="ArrowUp"?"up":"down"));return}if(p.key==="Tab"&&!p.shiftKey){C.length>0&&(p.preventDefault(),l(C));return}if(p.key==="Tab"&&p.shiftKey){C.length>0&&(p.preventDefault(),m(C));return}if(p.key==="Enter"&&!p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"below"));return}if(p.key==="Enter"&&p.shiftKey&&!T){A&&(p.preventDefault(),r(A.id,"above"));return}if(p.key==="Enter"&&T){A&&(p.preventDefault(),d(A.id));return}if(p.key==="F2"){A&&(p.preventDefault(),i(A.id));return}if(p.key==="Delete"||p.key==="Backspace"&&T){C.length>0&&(p.preventDefault(),o(C));return}if(p.key==="d"&&T&&!p.shiftKey){C.length>0&&(p.preventDefault(),s(C));return}},[u,t,g,v,r,o,s,n,l,m,i,c,d]);return useEffect(()=>{if(u)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[u,h]),{setIsEditing:y}}function Wc(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(u=>{let f=new Set(u);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=useCallback((d,u)=>{if(!a){o(d);return}let f=u.indexOf(a),y=u.indexOf(d);if(f===-1||y===-1){o(d);return}let k=Math.min(f,y),g=Math.max(f,y),v=u.slice(k,g+1);t(new Set(v)),r(d);},[a,o]),l=useCallback((d,u,f,y)=>{y?n(d,u):f?s(d):o(d);},[o,s,n]),m=useCallback((d,u)=>{u?t(f=>{let y=new Set(f);return y.add(d),y}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Do(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let l={...r[n],parentId:o,level:s,position:n};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&a(l.subtasks,l.id,s+1);}};return a(e),t}function Gc(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Gc(a.subtasks,t);if(r)return r}}return null}function Ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ii(a.subtasks,t);if(r)return r}return null}function Bi(e,t){if(t.length===0)return e;let a=Do(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,u)=>{let f=[];return {tasks:d.filter(k=>{if(u.has(k.id))return f.push(k),false;if(k.subtasks){let g=n(k.subtasks,u);k.subtasks=g.tasks,f.push(...g.removed);}return true}),removed:f}},l=(d,u,f)=>d.map(y=>y.id===u?{...y,subtasks:[...y.subtasks||[],...f],isExpanded:true}:y.subtasks?{...y,subtasks:l(y.subtasks,u,f)}:y),m=new Set(t),{tasks:i,removed:c}=n(e,m);return l(i,s.id,c)}function Ri(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ii(a,r);if(!o)continue;let s=Ii(a,o.id),n=(i,c,d)=>{for(let u=0;u<i.length;u++){let f=i[u];if(f.id===c&&f.subtasks){let y=f.subtasks.findIndex(k=>k.id===d);if(y!==-1){let[k]=f.subtasks.splice(y,1);return k}}if(f.subtasks){let y=n(f.subtasks,c,d);if(y)return y}}return null},l=(i,c,d)=>{let u=i.findIndex(f=>f.id===c);if(u!==-1)return i.splice(u+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,c,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?l(s.subtasks,o.id,m):l(a,o.id,m));}return a}function Oi(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,m)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function zi(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 Ui(e,t){let a=[...e];for(let r of t){let o=n=>{let l=n.findIndex(c=>c.id===r);if(l===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[l],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(l+1,0,i),true},s=n=>n.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?s(l.subtasks):void 0}));o(a);}return a}function _c(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:"#6366F1"},l=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function $i(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:$i(r.subtasks,t,a)}:r)}function Hi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Hi(a.subtasks,t)}:a)}function Wi(e,t){let a=c=>{for(let d of c){if(d.id===t)return d;if(d.subtasks){let u=a(d.subtasks);if(u)return u}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6"},i=c=>c.map(d=>{if(d.id===t){let u=d.subtasks||[];return {...d,subtasks:[...u,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function Vc(e,t,a,r){if(t===a)return e;let o=Gc(e,t);if(!o)return e;if(a){let l=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>l.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,u=[...c];return u.splice(d,0,{...o,parentId:a}),{...i,subtasks:u,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function _n({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:u,onTaskUpdate:f,onTaskIndent:y,onTaskOutdent:k,onTaskMove:g,onMultiTaskDelete:v,onTaskDuplicate:h,onTaskCreate:p,onTaskRename:w,onCreateSubtask:x,onOpenTaskModal:S,onDeleteRequest:T,onTaskReparent:C}){let A=useContext(To),[I,N]=useState(null),[z,R]=useState(null),[_,se]=useState(""),te=useRef(null),[ie,xe]=useState(null),[Ne,Ae]=useState(0),[F,B]=useState(0),[E,W]=useState({isOpen:false,x:0,y:0,type:"header"}),[J,ue]=useState(null),[be,Ce]=useState(null),[Y,V]=useState(null),Oe=useRef(0),pe=5,Le=useRef(false),[Je,st]=useState(null),[Ge,bt]=useState(false),[ut,Pt]=useState(null),[ge,L]=useState(false),re=useRef(null);useEffect(()=>{function G(q){re.current&&!re.current.contains(q.target)&&L(false);}if(ge)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[ge]),useEffect(()=>{z&&te.current&&(te.current.focus(),te.current.select());},[z]),useEffect(()=>{if(!ie)return;let G=Pe=>{let Ke=Pe.clientX-Ne,ze=F+Ke;u?.(ie,ze);},q=()=>{xe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[ie,Ne,F,u]);let{selectedTaskIds:Te,handleTaskClick:Ue,isTaskSelected:Z}=Wc(),{setIsEditing:Re}=$c({tasks:e,selectedTaskIds:Te,onTaskSelect:(G,q)=>{let Ke=Do(e).map(ze=>ze.id);Ue(G,Ke,q||false,false);},onTaskCreate:p||(()=>{}),onTaskDelete:v||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:G=>{let q=Do(e).find(Pe=>Pe.id===G);q&&We(q);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:G=>{let q=Do(e).find(Pe=>Pe.id===G);q&&S&&S(q);},enableKeyboard:true}),H=(G,q=0)=>{let Pe=[];for(let Ke of G)Pe.push({task:Ke,level:q}),Ke.subtasks&&Ke.subtasks.length>0&&Ke.isExpanded&&Pe.push(...H(Ke.subtasks,q+1));return Pe},K=H(e),ke=48,Ie=Math.max(K.length*a,600-ke),_e=G=>!G.startDate||!G.endDate?"-":`${Math.ceil((G.endDate.getTime()-G.startDate.getTime())/(1e3*60*60*24))}d`,We=G=>{R(G.id),se(G.name),Re(true);},ne=G=>{_.trim()&&_!==e.find(q=>q.id===G)?.name&&w?.(G,_.trim()),R(null),se(""),Re(false);},Be=()=>{R(null),se(""),Re(false);},ee=(G,q)=>{q.stopPropagation(),x?.(G.id);},Ye=(G,q)=>{q.preventDefault(),Oe.current=q.clientY,ue(G),Le.current=false,bt(false),st({x:q.clientX,y:q.clientY});},Pa=G=>{if(!J||(Math.abs(G.clientY-Oe.current)>pe&&!Le.current&&(Le.current=true,bt(true)),st({x:G.clientX,y:G.clientY}),!Le.current))return;let Pe=document.querySelectorAll("[data-task-row]"),Ke=null,ze=null;Pe.forEach(U=>{let le=U.getBoundingClientRect(),D=U.getAttribute("data-task-row");if(D&&D!==J&&G.clientY>=le.top&&G.clientY<=le.bottom){Ke=D;let Q=G.clientY-le.top,ce=le.height;Q<ce*.25?ze="above":Q>ce*.75?ze="below":ze="child";}}),Ce(Ke),V(ze);},fe=()=>{if(Le.current&&J&&be&&Y){if(Y==="child")C?.(J,be);else if(Y==="above"||Y==="below"){let G=(Ke,ze,U=null)=>{for(let le of Ke){if(le.id===ze)return U;if(le.subtasks){let D=G(le.subtasks,ze,le.id);if(D!==void 0)return D}}},q=G(e,be,null),Pe=(Ke,ze)=>{let U=Ke.findIndex(le=>le.id===ze);return Y==="below"?U+1:U};if(q===null){let Ke=Pe(e,be);C?.(J,null,Ke);}else {let Ke=K.find(ze=>ze.task.id===q)?.task;if(Ke?.subtasks){let ze=Pe(Ke.subtasks,be);C?.(J,q,ze);}}}}ue(null),Ce(null),V(null),st(null),Le.current=false,bt(false);};useEffect(()=>{if(J)return document.addEventListener("mousemove",Pa),document.addEventListener("mouseup",fe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Pa),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[J,be,Y]);let qe=(G,q,Pe)=>{switch(G.id){case "name":let Ke=z===q.id,ze=I===q.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Pe*20}px`},children:[C&&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:ze?1:.3},onMouseDown:de=>Ye(q.id,de),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),q.subtasks&&q.subtasks.length>0?jsx("button",{onClick:de=>{de.stopPropagation(),m?.(q.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:q.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 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:q.color||"#3B82F6",opacity:q.parentId?.6:1,borderColor:q.isMilestone?t.accent:"transparent",borderWidth:q.isMilestone?"2px":"0px"},title:q.isMilestone?"Milestone":q.parentId?"Subtask":"Task"})}),Ke?jsx("input",{ref:te,type:"text",value:_,onChange:de=>se(de.target.value),onKeyDown:de=>{de.key==="Enter"?ne(q.id):de.key==="Escape"&&Be();},onBlur:()=>ne(q.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:de=>de.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:q.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:q.parentId?"13px":"14px",fontWeight:q.isMilestone?600:q.parentId?400:600,letterSpacing:q.parentId?"0":"-0.01em"},title:q.name,children:q.name}),ze&&!Ke&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:de=>de.stopPropagation(),children:[jsx("button",{onClick:de=>ee(q,de),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:de=>{de.stopPropagation(),We(q);},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 le=G.id==="startDate"?"startDate":"endDate",D=q[le],Q=ut?.taskId===q.id&&ut?.field===le,ce=de=>de?(typeof de=="string"?new Date(de):de).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:de=>de.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},onClick:de=>{if(Q)Pt(null);else {let Qe=de.currentTarget.getBoundingClientRect();Pt({taskId:q.id,field:le,month:D?typeof D=="string"?new Date(D):D:new Date,position:{top:Qe.bottom+4,left:Qe.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:ce(D)})]}),Q&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Pt(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:ut?.position.top,left:ut?.position.left},onClick:de=>de.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let de=new Date,Qe=new Date(de);Qe.setDate(de.getDate()+1);let Ve=new Date(de);Ve.setDate(de.getDate()+7);let ar=new Date(de);return ar.setDate(de.getDate()+14),[{label:"Hoy",date:de},{label:"Ma\xF1ana",date:Qe},{label:"Pr\xF3xima semana",date:Ve},{label:"2 semanas",date:ar}].map((kr,rr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:or=>or.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:or=>or.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(q.id,{[le]:kr.date}),Pt(null);},children:kr.label},rr))})(),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:de=>de.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(q.id,{[le]:void 0}),Pt(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:()=>Pt(de=>de?{...de,month:new Date(de.month.getFullYear(),de.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:ut?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Pt(de=>de?{...de,month:new Date(de.month.getFullYear(),de.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((de,Qe)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:de},Qe))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let de=ut?.month||new Date,Qe=de.getFullYear(),Ve=de.getMonth(),ar=new Date(Qe,Ve,1).getDay(),Lo=new Date(Qe,Ve+1,0).getDate(),kr=new Date,rr=[];for(let Kt=ar-1;Kt>=0;Kt--)rr.push({day:new Date(Qe,Ve,-Kt).getDate(),date:new Date(Qe,Ve-1,new Date(Qe,Ve,-Kt).getDate()),isCurrentMonth:false});for(let Kt=1;Kt<=Lo;Kt++)rr.push({day:Kt,date:new Date(Qe,Ve,Kt),isCurrentMonth:true});let or=42-rr.length;for(let Kt=1;Kt<=or;Kt++)rr.push({day:Kt,date:new Date(Qe,Ve+1,Kt),isCurrentMonth:false});return rr.map((Kt,Ts)=>{let Ns=Kt.date.toDateString()===kr.toDateString(),Io=(D?typeof D=="string"?new Date(D):D:null)?.toDateString()===Kt.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:Kt.isCurrentMonth?Io?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Io?"#3B82F6":"transparent",boxShadow:Ns&&!Io?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(q.id,{[le]:Kt.date}),Pt(null);},children:Kt.day},Ts)})})()})]})]})]}),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:_e(q)})});case "assignees":let Xe=r.filter(de=>q.assignees?.some(Qe=>Qe.name===de.name||Qe.initials===de.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsx(qr,{assignedUsers:Xe,availableUsers:r,onChange:de=>{let Qe=de.map(Ve=>({id:Ve.id,name:Ve.name,initials:Ve.initials,color:Ve.color}));f?.(q.id,{assignees:Qe.length>0?Qe:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsx(Ed,{status:q.status||"todo",onChange:de=>{f?.(q.id,{status:de,progress:de==="completed"?100:q.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",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:`${q.progress}%`,backgroundColor:q.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:[q.progress,"%"]})]});case "priority":let Ft={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Zt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Dt=Ft[q.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:de=>de.stopPropagation(),children:jsx(Kr,{priority:Dt,onChange:de=>{de&&f?.(q.id,{priority:Zt[de]||"medium"});}})});default:return null}},He=G=>[{id:"hide",label:"Hide Column",icon:Ot.Hide,onClick:()=>d(G),disabled:G==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ot.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ot.SortDesc,onClick:()=>{}}],Ze=G=>G.subtasks&&G.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{x?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{T?T(G.id,G.name):v?.([G.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Ot.Pencil,onClick:()=>{n?.(G);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{x?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ot.MarkIncomplete,onClick:()=>{f?.(G.id,{status:"todo",progress:0});},disabled:G.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Ot.SetInProgress,onClick:()=>{f?.(G.id,{status:"in-progress"});},disabled:G.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Ot.MarkComplete,onClick:()=>{f?.(G.id,{status:"completed",progress:100});},disabled:G.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Ot.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{T?T(G.id,G.name):v?.([G.id]);}}],rt=c.filter(G=>G.visible),it=rt.reduce((G,q)=>G+q.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:it},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${ke}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:rt.map((G,q)=>{let Pe=q===rt.length-1,Ke=G.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ke?"":"justify-center"}`,style:{width:`${G.width}px`,minWidth:`${G.minWidth??(Ke?200:60)}px`,maxWidth:`${G.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Pe?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ze=>{ze.preventDefault(),W({isOpen:true,x:ze.clientX,y:ze.clientY,type:"header",columnId:G.id});},onMouseEnter:ze=>{ze.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ze=>{ze.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:G.label,children:G.label}),G.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ie===G.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ze=>{ze.preventDefault(),ze.stopPropagation(),xe(G.id),Ae(ze.clientX),B(G.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"}})})]},G.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(Hn,{columns:c,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>L(!ge),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"})}),ge&&jsxs("div",{ref:re,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:G=>G.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:()=>L(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:Ie},children:K.map(({task:G,level:q},Pe)=>{let Ke=Z(G.id),ze=be===G.id,U=ze&&Y==="above",le=ze&&Y==="below",D=ze&&Y==="child",Q={};return D&&(Q.backgroundColor=`${t.accent}15`,Q.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":G.id,className:`flex items-center cursor-pointer group ${J===G.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ke?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ke?t.accentLight:D?`${t.accent}15`:Pe%2===0?t.bgPrimary:t.bgGrid,...Q},onMouseEnter:()=>N(G.id),onMouseLeave:()=>N(null),onClick:ce=>{let Ft=Do(e).map(de=>de.id),Dt=navigator.platform.toUpperCase().indexOf("MAC")>=0?ce.metaKey:ce.ctrlKey;Ue(G.id,Ft,Dt,ce.shiftKey),s?.(G);},onDoubleClick:ce=>{ce.stopPropagation(),n?.(G);},onContextMenu:ce=>{ce.preventDefault(),W({isOpen:true,x:ce.clientX,y:ce.clientY,type:"task",task:G}),l?.(G,ce);},whileHover:{backgroundColor:Ke?t.accentLight:t.hoverBg},children:[U&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),le&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),rt.map((ce,Xe)=>{let Ft=Xe===rt.length-1,Zt=ce.id==="name";return jsx("div",{className:`px-4 flex items-center ${Zt?"justify-start":"justify-center"}`,style:{width:`${ce.width}px`,minWidth:`${ce.minWidth??(Zt?200:60)}px`,maxWidth:`${ce.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ft?"none":`1px solid ${I===G.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:qe(ce,G,Zt?q:0)},`${G.id}-${ce.id}`)})]},G.id)})}),jsx(No,{isOpen:E.isOpen,x:E.x,y:E.y,items:E.type==="header"&&E.columnId?He(E.columnId):E.type==="task"&&E.task?Ze(E.task):[],onClose:()=>W({...E,isOpen:false}),theme:t}),Ge&&Je&&J&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Je.x+12,top:Je.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let G=K.find(q=>q.task.id===J)?.task;return G?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:G.name})}):null})()}),document.body)]})}function Xc(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[m,i]=useState(t),[c,d]=useState(null),[u,f]=useState(null),[y,k]=useState(null),[g,v]=useState(null),[h,p]=useState(0),[w,x]=useState(0),[S,T]=useState(null),[C,A]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:u,setHoveredTaskId:f,activeZone:y,setActiveZone:k,draggedSegmentIndex:g,setDraggedSegmentIndex:v,draggedSegmentStartX:h,setDraggedSegmentStartX:p,segmentDragOffsetX:w,setSegmentDragOffsetX:x,hoveredSegmentIndex:S,setHoveredSegmentIndex:T,isHovered:C,setIsHovered:A,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(_,se)=>{r("none"),d(null),f(null),l(_),i(se),x(0),v(null),p(0);}}}function jn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:u,allTaskPositions:f=[],onDragMove:y,onHoverChange:k}){let g=Xc(t,r),v=useRef(null),h=useRef(null),p=useRef(null),{dragMode:w,setDragMode:x,dragOffset:S,setDragOffset:T,ghostX:C,setGhostX:A,ghostWidth:I,setGhostWidth:N,connectionLine:z,setConnectionLine:R,hoveredTaskId:_,setHoveredTaskId:se,activeZone:te,setActiveZone:ie,draggedSegmentIndex:xe,setDraggedSegmentIndex:Ne,draggedSegmentStartX:Ae,setDraggedSegmentStartX:F,segmentDragOffsetX:B,setSegmentDragOffsetX:E,hoveredSegmentIndex:W,setHoveredSegmentIndex:J,isHovered:ue,setIsHovered:be,isDragging:Ce,isResizing:Y,isConnecting:V,resetDragState:Oe}=g,pe=32,Le=8,Je=e.endDate&&e.endDate<new Date&&e.progress<100,st=e.isCriticalPath,Ge=o.name==="neutral"||o.today==="#1C1917",bt=e.status==="completed"||e.progress===100,ut={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ge=e.isCriticalPath||Je?"#DC2626":e.color?e.color:e.priority&&ut[e.priority]?ut[e.priority]:o.taskBarPrimary,re=(fe=>fe>=80?20:fe>=60?15:fe>=50?12:10)(r),Te=r<50,Ue=r<40;useEffect(()=>{if(k)if(ue&&!Ce&&!e.segments){let fe=a<100;k({task:e,x:t,y:a,width:r,height:pe,showBelow:fe});}else k(null);},[ue,Ce,e,t,a,r,pe,k]);let Z=fe=>fe.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Re=()=>{let fe=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${fe} day${fe!==1?"s":""}`},H=fe=>Math.round(fe/s)*s,K=fe=>{let qe=Math.round(fe/s),He=new Date(n);return He.setDate(He.getDate()+qe),He},ke=(fe,qe)=>{for(let He of f){if(He.id===e.id)continue;let Ze=5;if(fe>=He.x-Ze&&fe<=He.x+He.width+Ze&&qe>=He.y-Ze&&qe<=He.y+He.height+Ze)return He.id}return null},Ie=useCallback((fe,qe,He)=>{fe.preventDefault(),fe.stopPropagation();let Ze=v.current?.ownerSVGElement;if(!Ze)return;let rt=Ze.createSVGPoint();rt.x=fe.clientX,rt.y=fe.clientY;let it=rt.matrixTransform(Ze.getScreenCTM()?.inverse()),G=He!==void 0?He:t,q=qe;if(!q){let Pe=it.x-G;fe.shiftKey?(q="connect",R({x:t+r,y:a+pe/2})):fe.ctrlKey||fe.metaKey?q="move":fe.altKey?q=Pe<r/2?"resize-start":"resize-end":Ue?Pe<r/2?q="move":q="resize-end":Te?Pe<=re/2?q="resize-start":Pe>=r-re/2?q="resize-end":q="move":Pe<=re?q="resize-start":Pe>=r-re?q="resize-end":q="move";}x(q),be(false),ie(null),q==="move"?T(it.x-G):q==="connect"?R({x:t+r,y:a+pe/2}):T(0),A(G),N(r);},[t,r,a,pe]),_e=useCallback(fe=>{let qe=v.current?.ownerSVGElement;if(!qe)return;let He=qe.closest(".gantt-timeline-scroll");if(!He)return;let Ze=He.getBoundingClientRect(),rt=60,it=15,G=0;if(fe.clientX<Ze.left+rt){let q=Ze.left+rt-fe.clientX;G=-Math.min(it,q/2);}else if(fe.clientX>Ze.right-rt){let q=fe.clientX-(Ze.right-rt);G=Math.min(it,q/2);}return G!==0&&(He.scrollLeft+=G),G!==0},[]),We=useCallback(fe=>{if(w==="none")return;p.current=fe;let qe=v.current?.ownerSVGElement;if(!qe)return;if(w==="move"||w==="resize-start"||w==="resize-end"){let rt=_e(fe);rt&&!h.current?h.current=window.setInterval(()=>{p.current&&(_e(p.current),We(p.current));},16):!rt&&h.current&&(window.clearInterval(h.current),h.current=null);}let He=qe.createSVGPoint();He.x=fe.clientX,He.y=fe.clientY;let Ze=He.matrixTransform(qe.getScreenCTM()?.inverse());if(w==="connect"){R({x:Ze.x,y:Ze.y});let rt=ke(Ze.x,Ze.y);se(rt);}else if(w==="move"){let rt=Ze.x-S,it=H(rt);A(it),N(r);let G=Math.round((it-t)/s);if(y?.(e.id,G,true),e.segments&&e.segments.length>0&&xe!==null){let q=it-Ae;E(q);}}else if(w==="resize-start"){let rt=Ze.x,it=H(rt),G=t+r-it;G>=s&&(A(it),N(G));}else if(w==="resize-end"){let rt=Ze.x,G=H(rt)-t;G>=s&&N(G);}},[w,t,r,s,S,e,H,xe,Ae,ke,se,R,A,N,E,y,_e]),ne=useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),p.current=null,w!=="none"){if(w==="connect")_&&u&&u(e,_),R(null),se(null);else {let fe=e.endDate.getTime()-e.startDate.getTime(),qe,He,Ze=true;if(w==="move"){if(qe=K(C),He=new Date(qe.getTime()+fe),e.segments&&e.segments.length>0&&xe!==null){let rt=Math.round(B/s),it=e.segments.map((Ke,ze)=>{if(ze===xe){let U=new Date(Ke.startDate),le=new Date(Ke.endDate);return U.setDate(U.getDate()+rt),le.setDate(le.getDate()+rt),{startDate:U,endDate:le}}return Ke}),G=it.flatMap(Ke=>[Ke.startDate,Ke.endDate]),q=new Date(Math.min(...G.map(Ke=>Ke.getTime()))),Pe=new Date(Math.max(...G.map(Ke=>Ke.getTime())));d?.({...e,segments:it},q,Pe),Oe(t,r);return}}else w==="resize-start"?(qe=K(C),He=e.endDate,qe>He&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ze=false)):w==="resize-end"?(qe=e.startDate,He=K(C+I),He<qe&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ze=false)):Ze=false;Ze&&qe&&He&&(He.getTime()<qe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,qe,He));}y?.(e.id,0,false),Oe(t,r);}},[w,C,I,e,d,_,u,t,r,s,K,B,xe,Oe,y]);useEffect(()=>{if(w==="none")return;let fe=He=>{We(He);},qe=()=>{ne();};return window.addEventListener("mousemove",fe),window.addEventListener("mouseup",qe),()=>{window.removeEventListener("mousemove",fe),window.removeEventListener("mouseup",qe),h.current&&(window.clearInterval(h.current),h.current=null);}},[w,We,ne]);let Be=Ce&&!V?C:t,ee=Ce&&!V?I:r,Ye=l.taskClass(e);return jsxs("g",{ref:v,"data-task-bar":"true",onClick:()=>!Ce&&m?.(e),onDoubleClick:fe=>{Ce||(fe.stopPropagation(),i?.(e));},onContextMenu:fe=>{fe.preventDefault(),c?.(e,fe);},onMouseEnter:()=>!Ce&&be(true),onMouseLeave:()=>{Ce||(be(false),ie(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:pe,fill:"transparent",style:{pointerEvents:"all"}}),ue&&!Ce&&!Te&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:re,height:pe,fill:te==="resize-start"?o.accent:"transparent",opacity:te==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-start"),onMouseDown:fe=>Ie(fe,"resize-start")}),jsx("rect",{x:t+re,y:a,width:r-re*2,height:pe,fill:te==="move"?o.accent:"transparent",opacity:te==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:fe=>Ie(fe,"move")}),jsx("rect",{x:t+r-re,y:a,width:re,height:pe,fill:te==="resize-end"?o.accent:"transparent",opacity:te==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:fe=>Ie(fe,"resize-end")})]}),ue&&!Ce&&Ue&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:pe,fill:te==="move"?o.accent:"transparent",opacity:te==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:fe=>Ie(fe,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:pe,fill:te==="resize-end"?o.accent:"transparent",opacity:te==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:fe=>Ie(fe,"resize-end")}),ue&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+pe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ce&&!V&&!e.segments&&jsx(motion.rect,{x:C,y:a,width:I,height:pe,rx:Le,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsx(motion.rect,{x:Be,y:a,width:ee,height:pe,rx:Le,fill:ge,"data-task-class":Ye,initial:{opacity:0,scale:.95},animate:{opacity:Ce&&!V?.15:e.parentId?.6:ue?.9:.8,scale:ue&&!Ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:fe=>Ie(fe),style:{cursor:Ce?V?"crosshair":Y?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Be,y:a,width:ee*(e.progress/100),height:pe,rx:Le,fill:ge,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((fe,qe)=>{let He=(fe.startDate.getTime()-n.getTime())/864e5*s,rt=(fe.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-He+s,it=Ce&&w==="move"&&xe===qe,G=W===qe,q=it?He+B:He;return jsxs("g",{onMouseEnter:()=>!Ce&&J(qe),onMouseLeave:()=>!Ce&&J(null),children:[jsx(motion.rect,{x:q,y:a,width:rt,height:pe,rx:Le,fill:ge,initial:{opacity:0,scale:.95},animate:{opacity:it||e.parentId?.6:G?.9:.8,scale:G&&!Ce?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Pe=>{Pe.stopPropagation(),Ne(qe),F(He),Ie(Pe,void 0,He);},style:{cursor:Ce?V?"crosshair":Y?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:q,y:a,width:rt*(e.progress/100),height:pe,rx:Le,fill:ge,opacity:1,style:{pointerEvents:"none"}})]},`segment-${qe}`)}),Ge&&(Je||st)&&!e.segments&&jsxs(Fragment,{children:[st&&!Je&&jsx("rect",{x:Be,y:a,width:ee,height:pe,rx:Le,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Je&&jsx("rect",{x:Be,y:a,width:ee,height:pe,rx:Le,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ee>60&&!e.segments&&(()=>{let fe=l.taskLabel(e),qe=typeof fe=="string"?fe:e.name,He=qe.length>Math.floor(ee/8)?`${qe.substring(0,Math.floor(ee/8))}...`:qe;return jsx("text",{x:Be+12,y:a+pe/2,dominantBaseline:"middle",fill:bt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:bt?"line-through":"none"},children:He})})(),ee>100&&e.progress>0&&e.progress<100&&!Ce&&!e.segments&&jsxs("text",{x:Be+ee-12,y:a+pe/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,"%"]}),e.status&&ee>80&&!Ce&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Be+ee-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Be+ee-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ue||Y)&&!V&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Be-2,y:a,width:16,height:pe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-start"),onMouseLeave:()=>ie(null),onMouseDown:fe=>{fe.stopPropagation(),Ie(fe,"resize-start");}}),jsx(motion.rect,{x:Be+4,y:a+8,width:3,height:pe-16,rx:1.5,fill:te==="resize-start"||w==="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:Be+ee-14,y:a,width:16,height:pe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-end"),onMouseLeave:()=>ie(null),onMouseDown:fe=>{fe.stopPropagation(),Ie(fe,"resize-end");}}),jsx(motion.rect,{x:Be+ee-7,y:a+8,width:3,height:pe-16,rx:1.5,fill:te==="resize-end"||w==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ue&&!Ce&&!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+pe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ie("connect"),onMouseLeave:()=>ie(null),onMouseDown:fe=>{fe.stopPropagation(),Ie(fe,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+pe/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:te==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),V&&z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+pe/2,x2:z.x,y2:z.y,stroke:_?o.statusCompleted:o.accent,strokeWidth:_?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:_?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:z.x,cy:z.y,r:_?8:6,fill:_?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),_&&jsx(motion.text,{x:z.x+15,y:z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:z.x+10},animate:{opacity:1,x:z.x+15},transition:{duration:.2},children:"Connect"})]}),(ue||Ce)&&!V&&!e.segments&&jsx(motion.rect,{x:Be-2,y:a-2,width:ee+4,height:pe+4,rx:Le+2,fill:"none",stroke:Ce?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:Ce?.6:.4,initial:{opacity:0},animate:{opacity:Ce?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Y&&jsxs(Fragment,{children:[jsx("line",{x1:C,y1:0,x2:C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:C+I,y1:0,x2:C+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ue&&!Ce&&!e.segments&&!k&&(()=>{let He=a<100,Ze=He?a+pe+13:a-82-13,rt=He?`M ${Be+ee/2-6} ${a+pe+3} L ${Be+ee/2} ${a+pe+13} L ${Be+ee/2+6} ${a+pe+3}`:`M ${Be+ee/2-6} ${a-13} L ${Be+ee/2} ${a-3} L ${Be+ee/2+6} ${a-13}`,it=Ze+22,G=Ze+40,q=Ze+55,Pe=Ze+70,Ke=He?Ze+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:He?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:He?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:rt,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Be+ee/2-120,y:Ze,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:Be+ee/2,y:it,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:Be+ee/2-110,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Be+ee/2-70,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Z(e.startDate)}),jsx("text",{x:Be+ee/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Be+ee/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Z(e.endDate)}),jsx("text",{x:Be+ee/2+10,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Be+ee/2+65,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Re()}),jsx("text",{x:Be+ee/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Be+ee/2+65,y:q,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:Be+ee/2-110,y:Pe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Be+ee/2-50,y:Pe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ze=>ze.name).join(", ").substring(0,30),e.assignees.map(ze=>ze.name).join(", ").length>30?"...":""]})]}),!He&&jsx("text",{x:Be+ee/2,y:Ke,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ue?"Left: move \u2022 Right: resize":Te?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Qc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:l}=e,m=82,i=13,c=l?o+n+i:o-m-i,d=l?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,u=c+22,f=c+40,y=c+55,k=c+70,g=w=>w.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),v=()=>{if(!a.startDate||!a.endDate)return "N/A";let w=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${w} day${w!==1?"s":""}`};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:l?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:l?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+s/2-120,y:c,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:u,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?g(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?g(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:v()}),jsx("text",{x:r+s/2+10,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(w=>w.name).join(", ").substring(0,30),a.assignees.map(w=>w.name).join(", ").length>30?"...":""]})]})]})})}function qn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false}){let[m,i]=useState(false),[c,d]=useState(null),u=r-t,f=u>0,y=Math.abs(u)<5,k=20,g=!y&&a<=e,v,h,p=a-e,w=e+p/2;if(h=w,n==="squared")if(y)v=`M ${e} ${t} L ${a} ${r}`;else if(g){let ie=e+15,xe=a-k,Ne=f?t+20:t-20;h=xe,v=`M ${e} ${t} L ${ie} ${t} L ${ie} ${Ne} L ${xe} ${Ne} L ${xe} ${r} L ${a} ${r}`;}else h=a-k,v=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else v=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let x=5,S=`M ${a} ${r} L ${a-x} ${r-x*.5} M ${a} ${r} L ${a-x} ${r+x*.5}`,T=o.dependency,C=o.dependencyHover||T,A="#f87171",I="rgba(248, 113, 113, 0.15)",N=h,z=(t+r)/2;if(c)if(y)N=Math.max(e+10,Math.min(a-10,c.x)),z=t;else if(g){let te=e+15,ie=a-k,xe=f?t+20:t-20,Ne=[[e,t,te,t],[te,t,te,xe],[te,xe,ie,xe],[ie,xe,ie,r],[ie,r,a,r]],Ae=1/0,F={x:N,y:z};for(let B of Ne){let E=R(c.x,c.y,B[0],B[1],B[2],B[3]),W=Math.hypot(c.x-E.x,c.y-E.y);W<Ae&&(Ae=W,F=E);}N=F.x,z=F.y;}else {let te=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],ie=1/0,xe={x:N,y:z};for(let Ne of te){let Ae=R(c.x,c.y,Ne[0],Ne[1],Ne[2],Ne[3]),F=Math.hypot(c.x-Ae.x,c.y-Ae.y);F<ie&&(ie=F,xe=Ae);}N=xe.x,z=xe.y;}function R(te,ie,xe,Ne,Ae,F){let B=Ae-xe,E=F-Ne,W=B*B+E*E;if(W===0)return {x:xe,y:Ne};let J=((te-xe)*B+(ie-Ne)*E)/W;return J=Math.max(0,Math.min(1,J)),{x:xe+J*B,y:Ne+J*E}}let _=te=>{let ie=te.currentTarget.ownerSVGElement;if(!ie)return;let xe=ie.getBoundingClientRect();d({x:te.clientX-xe.left,y:te.clientY-xe.top});},se=()=>{i(false),d(null);};return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:se,onMouseMove:_,children:[jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:v,fill:"none",stroke:C,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:v,fill:"none",stroke:C,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:S,fill:"none",stroke:C,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:C,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:te=>{te.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:N,cy:z,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsx("line",{x1:N-3,y1:z-3,x2:N+3,y2:z+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:N+3,y1:z-3,x2:N-3,y2:z+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:se,onMouseMove:_,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:v,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:v,fill:"none",stroke:m?C:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsx(motion.path,{d:S,fill:"none",stroke:m?C:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?C:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:te=>{te.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:N,cy:z,r:9,fill:I,stroke:A,strokeWidth:1.5}),jsx("line",{x1:N-3,y1:z-3,x2:N+3,y2:z+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:N+3,y1:z-3,x2:N-3,y2:z+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Jn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),l=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(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 ve={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(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,m=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&m(d))return true;if(l.has(d))return true}}return l.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ve.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ve.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ve.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=ve.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(`
|
|
112
|
+
`)},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=ve.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=ve.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)=>ve.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ve.findTaskById(e,t);return !a||!a.dependencies?[]:ve.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ve.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ve.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=ve.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=>ve.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=ve.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(m=>{let i=m.startDate&&m.endDate?ve.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?ve.formatDate(m.startDate):"N/A",m.endDate?ve.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ve.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?ve.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?ve.formatDate(m.startDate):"","End Date":m.endDate?ve.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(c=>c.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let l=a.utils.book_new();a.utils.book_append_sheet(l,s,"Gantt Tasks"),a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ve.flattenTasks(e),o=new Map;r.forEach((u,f)=>{o.set(u.id,f+1);});let s=u=>u.toISOString().replace("Z",""),n=ve.getEarliestStartDate(e)||new Date,l=ve.getLatestEndDate(e)||new Date,m=r.map((u,f)=>{let y=o.get(u.id),k=u.startDate&&u.endDate?ve.calculateDuration(u.startDate,u.endDate):0,g=(u.dependencies||[]).filter(v=>o.has(v)).map(v=>`
|
|
113
113
|
<PredecessorLink>
|
|
114
114
|
<PredecessorUID>${o.get(v)}</PredecessorUID>
|
|
115
115
|
<Type>1</Type>
|
|
@@ -339,9 +339,9 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
339
339
|
</Calendars>
|
|
340
340
|
<Tasks>${m}
|
|
341
341
|
</Tasks>
|
|
342
|
-
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=xe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let y=t.find(k=>k.id===f);if(y){o(y);let k=r.get(f)?.ef||0;d=Math.max(d,k);}}let u=d+c;r.set(i.id,{es:d,ef:u});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),u=s;if(d.length>0)for(let y of d){l(y);let k=n.get(y.id)?.ls||0;u=Math.min(u,k);}let f=u-c;n.set(i.id,{ls:f,lf:u});};a.forEach(l);let m=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let u=d.ls-c.es;Math.abs(u)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=xe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(xe.calculateCriticalPath(e).includes(t))return 0;let o=xe.getDependentTasks(e,t);if(o.length===0){let l=xe.getLatestEndDate(e);if(!l)return null;let m=xe.calculateDuration(a.endDate,l);return Math.max(0,m)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,m)=>l-m)[0];if(!s)return null;let n=xe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>xe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=xe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=xe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=xe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=xe.calculateEndDate(m,l),c=d=>d.map(u=>u.id===n.id?{...u,startDate:m,endDate:i}:u.subtasks?{...u,subtasks:c(u.subtasks)}:u);s=c(s),s=xe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,d=xe.findTaskById(e,t);if(!d||!d.endDate)return [];let u=(f,y,k=new Set)=>{if(k.has(f))return;k.add(f);let g=xe.getDependentTasks(e,f);for(let v of g){if(!v.startDate||!v.endDate)continue;let h=r.findIndex(N=>N.id===v.id);if(h===-1)continue;let p=v.startDate.getTime(),x=(v.endDate.getTime()-p)/c,T=(p-i)/c*s,C=T+y*s,A=Math.max(x*s,s),I=l+h*n+12;m.push({taskId:v.id,taskName:v.name,originalX:T,previewX:C,width:A,y:I,rowIndex:h,daysDelta:y,color:v.color}),u(v.id,y,k);}};return u(t,a),m},splitTask:(e,t,a,r=3)=>{let o=xe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Qn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:u,onTaskDateChange:f,onDependencyCreate:y,onDependencyDelete:k}){let v=Br(),[h,p]=useState([]),[w,x]=useState(null),S=useCallback(F=>{x(F);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),C=r==="day"?60:r==="week"?20:8,A=T*C*n,I=F=>{let B=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),E=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-E);let W=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-W.getTime())/864e5+1)/7)},N=F=>{let B=F.getDay();return B===0||B===6},z=useCallback(F=>{let B=Math.round(F/(C*n)),E=new Date(o);return E.setDate(E.getDate()+B),E},[o,C,n]),R=useCallback((F,B)=>{if(B.startDate&&B.endDate)return;let E=F.currentTarget.ownerSVGElement;if(!E)return;let W=E.createSVGPoint();W.x=F.clientX,W.y=F.clientY;let J=W.matrixTransform(E.getScreenCTM()?.inverse()),ue=z(J.x),be=new Date(ue);be.setDate(be.getDate()+1),f?.(B,ue,be);},[z,f]),V=useMemo(()=>{let F=J=>J.map(ue=>{if(ue.subtasks&&ue.subtasks.length>0){let be=F(ue.subtasks),G=be.filter(he=>he.startDate&&he.endDate);if(G.length>0){let he=G.map(Be=>Be.startDate.getTime()),j=G.map(Be=>Be.endDate.getTime()),He=new Date(Math.min(...he)),de=new Date(Math.max(...j));return {...ue,subtasks:be,startDate:He,endDate:de}}return {...ue,subtasks:be}}return ue}),B=(J,ue=[])=>{for(let be of J)ue.push(be),be.subtasks&&be.subtasks.length>0&&(be.isExpanded===void 0||be.isExpanded)&&B(be.subtasks,ue);return ue},E=F(e);return B(E)},[e]),ne=useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let B=F.startDate.getTime(),E=F.endDate.getTime(),W=o.getTime(),J=(B-W)/(1e3*60*60*24),ue=(E-B)/(1e3*60*60*24),be=J*C*n,G=Math.max(C*n,40),he=Math.max(ue*C*n,G);return {x:be,width:he}},[o,C,n]),ae=useMemo(()=>V.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:B,width:E}=ne(F),J=V.findIndex(ue=>ue.id===F.id)*a+12;return {id:F.id,x:B,y:J,width:E,height:32}}),[V,ne]),ie=useCallback((F,B,E)=>{if(!E||B===0){p([]);return}let W=xe.calculateCascadePreview(e,F,B,V,o,C*n,a,48);p(W);},[e,V,o,C,n,a,48]),ke=useMemo(()=>{let F=[],B=new Date(o);for(;B<=s;){let J=(B.getTime()-o.getTime())/864e5*C*n;if(r==="day")F.push({date:new Date(B),label:B.toLocaleDateString(l,{day:"numeric",month:"short"}),x:J}),B.setDate(B.getDate()+1);else if(r==="week"){let ue=I(B);F.push({date:new Date(B),label:`${v.labels.week} ${ue}`,x:J}),B.setDate(B.getDate()+7);}else F.push({date:new Date(B),label:B.toLocaleDateString(l,{month:"short",year:"numeric"}),x:J}),B.setMonth(B.getMonth()+1);}return F},[o,s,r,C,n,l,v.labels.week]),Ne=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*C*n,[o,C,n]),Ae=Math.max(V.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.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(A,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(A,1e3),height:48,fill:t.bgGrid}),ke.map((F,B)=>jsxs("g",{children:[B>0&&jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${B}`)),Ne>=0&&Ne<=A&&jsx("circle",{cx:Ne,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(A,1e3),height:Ae,style:{display:"block",flexShrink:0,overflow:"visible"},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("rect",{x:0,y:0,width:Math.max(A,1e3),height:Ae,fill:t.bgPrimary}),ke.map((F,B)=>{let E=ke[B+1]?.x||A,W=N(F.date);return jsxs("g",{children:[W&&jsx("rect",{x:F.x,y:0,width:E-F.x,height:V.length*a,fill:t.bgWeekend,opacity:1}),B>0&&jsx("line",{x1:F.x,y1:0,x2:F.x,y2:V.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),V.map((F,B)=>{let E=F.startDate&&F.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:B*a,width:A,height:a,fill:B%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!E&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:B*a,width:A,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:W=>R(W,F),onMouseEnter:W=>{W.currentTarget.setAttribute("fill",t.accentLight),W.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:W=>{W.currentTarget.setAttribute("fill","transparent"),W.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsx("text",{x:Ne>0?Ne:100,y:B*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${F.id}`)]})]},`row-group-${F.id}`)}),V.map((F,B)=>{if(!F.startDate||!F.endDate)return null;let{x:E,width:W}=ne(F),J=B*a+12,ue=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsx(Jn,{task:F,x:E+W/2,y:J+16,theme:t,onClick:c},F.id):ue?jsxs("g",{onClick:()=>c?.(F),onContextMenu:be=>{be.preventDefault(),be.stopPropagation(),u?.(F,be);},style:{cursor:"default"},children:[jsx("rect",{x:E,y:J,width:W,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:E,y1:J,x2:E+W,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E,y1:J,x2:E,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E+W,y1:J,x2:E+W,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E,y1:J+32,x2:E+W,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),W>60&&jsx("text",{x:E+12,y:J+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsx(jn,{task:F,x:E,y:J,width:W,theme:t,dayWidth:C*n,startDate:o,templates:m,onClick:c,onDoubleClick:d,onContextMenu:u,onDateChange:f,onDependencyCreate:y,allTaskPositions:ae,onDragMove:ie,onHoverChange:S},F.id)}),V.map((F,B)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(E=>{let W=V.find(de=>de.id===E);if(!W||!W.startDate||!W.endDate)return null;let J=V.findIndex(de=>de.id===E),ue=ne(W),be=ne(F),G=ue.x+ue.width,he=J*a+28,j=be.x,He=B*a+28;return jsx(qn,{x1:G,y1:he,x2:j,y2:He,theme:t,lineStyle:i,onDelete:()=>k?.(F.id,E)},`dep-${E}-${F.id}`)})),h.map(F=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),Ne>=0&&Ne<=A&&jsx("line",{x1:Ne,y1:0,x2:Ne,y2:Ae,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),w&&jsx(Qc,{tooltipData:w,theme:t})]})]})}var l0=['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"'],rm=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),d0=()=>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"})}),c0=()=>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"})}),m0=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),p0=()=>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 es({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:m}){let[i,c]=useState(false),[d,u]=useState(false),[f,y]=useState([]),[k,g]=useState(""),[v,h]=useState(false),[p,w]=useState(true),x=useRef(null),S=useRef(null),T=useRef(null),{enabled:C=true,placeholder:A='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:N,suggestions:z=l0,maxHistory:R=50,persistHistory:V}=a,ne=V?.storageKey||"gantt-ai-history",ae=V?.maxMessages??5;useEffect(()=>{if(V?.enabled)try{let B=localStorage.getItem(ne);if(B){let W=JSON.parse(B).map(J=>({...J,timestamp:new Date(J.timestamp)}));y(W.slice(-ae));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[V?.enabled,ne,ae]),useEffect(()=>{if(V?.enabled&&f.length>0)try{let B=f.filter(E=>!E.isLoading).slice(-ae);localStorage.setItem(ne,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[f,V?.enabled,ne,ae]),useEffect(()=>{S.current&&S.current.scrollIntoView({behavior:"smooth"});},[f]),useEffect(()=>{i&&!d&&x.current&&setTimeout(()=>x.current?.focus(),100);},[i,d]);let ie=useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&o?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&n?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&l?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&m?.(B.taskId,B.dependencyFrom);break}},[o,s,n,l,m]),ke=useCallback(async B=>{if(!B.trim()||v)return;let E={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};y(J=>[...J.slice(-(R-1)),E]),g(""),w(false),h(true);let W={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(J=>[...J,W]);try{if(N){let J=await N(B,e);y(ue=>{let be=ue.filter(he=>!he.isLoading),G={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...be,G]}),ie(J);}else y(J=>[...J.filter(be=>!be.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(J){y(ue=>[...ue.filter(G=>!G.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[v,R,N,e,ie]),Ne=B=>{B.preventDefault(),ke(k);},Ae=B=>{g(B),x.current?.focus();};if(useEffect(()=>{let B=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),c(W=>!W),i||u(false)),E.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[i]),useEffect(()=>{if(!i)return;let B=W=>{let J=W.target;T.current&&!T.current.contains(J)&&c(false);},E=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",B);}},[i]),!C)return null;let F={"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(gt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[I]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>c(true),children:[jsx(rm,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[I]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(rm,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>u(B=>!B),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(m0,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(c0,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[f.length===0&&p&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:z.slice(0,4).map((B,E)=>jsx("button",{onClick:()=>Ae(B),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:B.length>30?B.slice(0,30)+"...":B},E))})]}),f.map(B=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:B.role==="user"?"white":t.textPrimary},children:[B.isLoading?jsx(p0,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:B.command.success?"#10B981":"#EF4444"},children:[B.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsx("div",{ref:S})]}),jsxs("form",{onSubmit:Ne,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:x,type:"text",value:k,onChange:B=>g(B.target.value),placeholder:A,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!k.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsx(d0,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function om(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,c=true)=>{r(d=>{let u=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:u};if(!c)return {...d,present:u};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:u,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),m=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function nm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=l?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&m&&n.key==="y"){n.preventDefault(),t();return}if(l&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var b0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${xe.formatDate(e.startDate)} - ${xe.formatDate(e.endDate)}`);let a=xe.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=>xe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function sm(e){return {...b0,...e}}var T0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},dm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:u=true,persistExpandedState:f,persistFilter:y,aiAssistant:k,locale:g="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:p,onCreateTask:w,taskFilter:x,onTaskFilterChange:S,onThemeChange:T,onTaskClick:C,onTaskDblClick:A,onTaskContextMenu:I,onTaskUpdate:N,onProgressChange:z,onTaskEdit:R,onTaskAddSubtask:V,onTaskMarkIncomplete:ne,onTaskSetInProgress:ae,onDependencyCreate:ie,onDependencyDelete:ke,onBeforeTaskAdd:Ne,onAfterTaskAdd:Ae,onBeforeTaskUpdate:F,onAfterTaskUpdate:B,onBeforeTaskDelete:E,onAfterTaskDelete:W}=a,ue=useContext(On)?.theme,[be,G]=useState(ue||s||"dark"),[he,j]=useState(n),[He,de]=useState(l),[Be,nt]=useState(1),st=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Xe,kt]=useState(()=>{if(!y)return "all";try{let P=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(P);if(M){let $=JSON.parse(M);if($.taskFilter)return $.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),ct=x??Xe,$t=S??kt,[ge,L]=useState(()=>{if(!y)return false;try{let P=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(P);if(M){let $=JSON.parse(M);if(typeof $.hideCompleted=="boolean")return $.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});useEffect(()=>{let P=st();if(P)try{let M={taskFilter:ct,hideCompleted:ge};localStorage.setItem(P,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[ct,ge,st]);let[re,Te]=useState(0),[ze,Z]=useState(false),[Re,H]=useState(null),[Y,we]=useState({isOpen:false,x:0,y:0,task:null}),[Le,Ge]=useState(null),[We,se]=useState(null);useEffect(()=>{ue&&ue!==be&&G(ue);},[ue]),useEffect(()=>{s&&s!==be&&G(s);},[s]);let Ie=useCallback(P=>{G(P),T?.(P);},[T]),{state:ee,setState:Ke,undo:Pa,redo:fe,canUndo:Ye,canRedo:$e,clearHistory:Je}=om(t,50),at=useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),it=useRef(new Map),_=useRef(false);if(!_.current&&f){_.current=true;let P=typeof f=="string"?f:"gantt-expanded-tasks";try{let M=localStorage.getItem(P);if(M){let $=JSON.parse(M);Array.isArray($)&&(it.current=new Map($));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let q=useCallback(()=>{let P=at();if(P)try{let M=Array.from(it.current.entries());localStorage.setItem(P,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[at]);useEffect(()=>{let P=$=>{let te=new Map;for(let pe of $){let ve=pe.name.toLowerCase().trim(),bt=te.get(ve);bt?bt.id.startsWith("subtask-")&&!pe.id.startsWith("subtask-")&&te.set(ve,pe):te.set(ve,pe);}return Array.from(te.values())},M=$=>$.map(te=>{let pe=it.current.get(te.id),ve=pe!==void 0?{...te,isExpanded:pe}:te;if(ve.subtasks?.length){let bt=P(ve.subtasks);return {...ve,subtasks:M(bt)}}return ve});if(it.current.size>0)Ke(M(t));else {let $=te=>te.map(pe=>pe.subtasks?.length?{...pe,subtasks:P($(pe.subtasks))}:pe);Ke($(t));}},[t,Ke]);let Pe=useRef(t),je=useRef(true);useEffect(()=>{if(je.current){je.current=false,Pe.current=ee;return}if(!r)return;let P=JSON.stringify(Pe.current),M=JSON.stringify(ee);P!==M&&(Pe.current=ee,r(ee));},[ee,r]);let Oe=useMemo(()=>Si(g,v),[g,v]),U=useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[le,D]=useState(()=>U(Oe));useEffect(()=>{D(P=>P.map(M=>({...M,label:Oe.columns[M.id==="name"?"taskName":M.id]||M.label})));},[Oe]);let Q=useMemo(()=>le.filter(M=>M.visible).reduce((M,$)=>M+$.width,0),[le]),me=useRef(le.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=le.filter(te=>te.visible),M=P.map(te=>te.id).join(","),$=me.current;if(M!==$){let te=P.some(ve=>ve.id!=="name"),pe=$.includes(",");te?!pe&&te&&H(null):H(null),me.current=M;}},[le]);let qe=60,Mt=.6,Zt=useMemo(()=>{let M=Q+qe,$=typeof window<"u"?window.innerWidth*Mt:800,te=Math.max(M,$);return Re!==null?Math.max(200,Math.min(Re,te)):Math.max(200,M)},[Re,Q]),Dt=useRef(null),ce=useRef(null),Ze=useRef(null),_e=useMemo(()=>Pc(be),[be]),ar=useMemo(()=>({theme:_e,themeName:be}),[_e,be]),Lo=useMemo(()=>sm(d),[d]),kr=useMemo(()=>{if(!u)return ee;let P=xe.calculateCriticalPath(ee),M=$=>$.map(te=>({...te,isCriticalPath:P.includes(te.id),subtasks:te.subtasks?M(te.subtasks):void 0}));return M(ee)},[ee,u]),rr=useMemo(()=>{if(ct==="all"&&!ge)return kr;let P=M=>{let $=[];for(let te of M){let pe=te.subtasks?.length?P(te.subtasks):void 0,ve=false;if(ge)ve=te.progress<100;else switch(ct){case "all":ve=true;break;case "incomplete":ve=te.progress<100;break;case "in_progress":ve=te.progress>0&&te.progress<100;break;case "completed":ve=te.progress===100;break}(ve||pe&&pe.length>0)&&$.push({...te,subtasks:pe});}return $};return P(kr)},[kr,ct,ge]),or=T0(He);nm({undo:Pa,redo:fe,canUndo:Ye,canRedo:$e,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>xe.findTaskById(ee,P),addTask:(P,M)=>{Ke($=>{if(!M)return [...$,{...P,level:0}];let te=pe=>pe.map(ve=>ve.id===M?{...ve,subtasks:[...ve.subtasks||[],{...P,parentId:M,level:(ve.level||0)+1}],isExpanded:true}:ve.subtasks?{...ve,subtasks:te(ve.subtasks)}:ve);return te($)});},updateTask:(P,M)=>{Ke($=>{let te=pe=>pe.map(ve=>ve.id===P?{...ve,...M}:ve.subtasks?{...ve,subtasks:te(ve.subtasks)}:ve);return te($)});},deleteTask:P=>{Ke(M=>{let $=te=>te.filter(pe=>pe.id===P?false:(pe.subtasks&&(pe.subtasks=$(pe.subtasks)),true));return $(M)});},deleteTasks:P=>{Ke(M=>zi(M,P));},duplicateTask:P=>{Ke(M=>Ui(M,[P]));},splitTask:(P,M,$=3)=>{Ke(te=>xe.splitTask(te,P,M,$));},calculateEndDate:xe.calculateEndDate,calculateDuration:xe.calculateDuration,validateDependency:(P,M)=>!xe.validateDependencies(ee,P,M),getAllTasks:()=>xe.flattenTasks(ee),getTasksByStatus:P=>xe.flattenTasks(ee).filter(M=>M.status===P),getTasksByParent:P=>P?xe.findTaskById(ee,P)?.subtasks||[]:ee.filter($=>!$.parentId),getCriticalPath:()=>xe.flattenTasks(ee).filter(P=>P.isCriticalPath),indentTask:P=>{Ke(M=>Bi(M,[P]));},outdentTask:P=>{Ke(M=>Ri(M,[P]));},moveTask:(P,M)=>{Ke($=>Oi($,[P],M));},createSubtask:async P=>{let{tasks:M,newTask:$}=Wi(ee,P);if(Ne){let te=Ne({...$,parentId:P});if((te instanceof Promise?await te:te)===false)return}Ke(M),Ae&&Ae({...$,parentId:P});},scrollToTask:P=>{let $=xe.flattenTasks(ee).findIndex(te=>te.id===P);if($!==-1&&Dt.current){let te=$*or;Dt.current.scrollTo({top:te,behavior:"smooth"}),ce.current&&ce.current.scrollTo({top:te,behavior:"smooth"});}},highlightTask:(P,M=2e3)=>{},expandTask:P=>{Ke(M=>{let $=te=>te.map(pe=>pe.id===P?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:$(pe.subtasks)}:pe);return $(M)});},collapseTask:P=>{Ke(M=>{let $=te=>te.map(pe=>pe.id===P?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:$(pe.subtasks)}:pe);return $(M)});},expandAll:()=>{Ke(P=>{let M=$=>$.map(te=>({...te,isExpanded:true,subtasks:te.subtasks?M(te.subtasks):void 0}));return M(P)});},collapseAll:()=>{Ke(P=>{let M=$=>$.map(te=>({...te,isExpanded:false,subtasks:te.subtasks?M(te.subtasks):void 0}));return M(P)});},undo:Pa,redo:fe,canUndo:()=>Ye,canRedo:()=>$e,clearHistory:Je,exportToPNG:async()=>{if(!Ze.current||!Dt.current||!ce.current)throw new Error("Gantt container not found");let P=Ze.current,M=Dt.current.querySelector(".gantt-grid-scroll"),$=ce.current,te=M?.scrollTop||0,pe=$.scrollTop,ve=P.style.overflow,bt=P.style.height;try{let mt=M?.querySelector(".gantt-taskgrid-content"),Ht=$.querySelector("svg"),fa=mt?.scrollHeight||M?.scrollHeight||600,ha=Ht?.getBoundingClientRect().height||$.scrollHeight,_r=(P.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(fa,ha)+20;M&&(M.scrollTop=0),$.scrollTop=0,P.style.overflow="visible",P.style.height=`${_r}px`,await new Promise(Cr=>setTimeout(Cr,100));let nr=await lm(P,{backgroundColor:_e.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Cr=>{let po=window.getComputedStyle(Cr),Vr=parseInt(po.zIndex,10);return !isNaN(Vr)&&Vr>=50||po.position==="fixed"}});return new Promise((Cr,po)=>{nr.toBlob(Vr=>{Vr?Cr(Vr):po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{P.style.overflow=ve,P.style.height=bt,M&&(M.scrollTop=te),$.scrollTop=pe;}},exportToPDF:async P=>{await xe.exportToPDF(ee,P);},exportToExcel:async P=>{await xe.exportToExcel(ee,P);},exportToJSON:()=>xe.exportToJSON(ee),exportToCSV:()=>xe.exportToCSV(ee),importFromJSON:P=>{let M=xe.importFromJSON(P);Ke(M);},getTasks:()=>ee,refresh:()=>{Ke(P=>[...P]);},clearAll:()=>{Ke([]);}}),[ee,Pa,fe,Ye,$e,Je,_e,or]);let Kt=useCallback(P=>{D(M=>M.map($=>$.id===P?{...$,visible:!$.visible}:$));},[]),Ts=useCallback((P,M)=>{D($=>$.map(te=>{if(te.id!==P)return te;let pe=te.minWidth??100,ve=te.maxWidth??800,bt=Math.max(pe,Math.min(ve,M));return {...te,width:bt}}));},[]),Ns=useCallback(P=>{Ke(M=>{let $=Hi(M,P),te=pe=>{for(let ve of pe){if(ve.id===P){it.current.set(P,ve.isExpanded??true);return}ve.subtasks?.length&&te(ve.subtasks);}};return te($),q(),$}),a.onTaskToggleExpand?.(P);},[a,q]),Gr=useCallback((P,M)=>{if(F&&F(P,M)===false)return;let te=xe.findTaskById(ee,P)?.progress,pe=bt=>bt.map(mt=>mt.id===P?{...mt,...M}:mt.subtasks?{...mt,subtasks:pe(mt.subtasks)}:mt);Ke(pe(ee));let ve=xe.findTaskById(pe(ee),P);ve&&(N?.(ve),B?.(ve),M.progress!==void 0&&te!==void 0&&M.progress!==te&&z?.(P,te,M.progress));},[ee,N,F,B,z]),Io=useCallback(P=>{P.length!==0&&(Ke(M=>Bi(M,P)),a.onTaskIndent?.(P[0]));},[a]),wu=useCallback(P=>{P.length!==0&&(Ke(M=>Ri(M,P)),a.onTaskOutdent?.(P[0]));},[a]),Cu=useCallback((P,M,$)=>{Ke(te=>Vc(te,P,M,$)),a.onTaskReparent?.(P,M,$);},[a]),Tu=useCallback((P,M)=>{P.length!==0&&(Ke($=>Oi($,P,M)),a.onTaskMove?.(P[0],M));},[a]),Ds=useCallback(async P=>{let M=[];for(let $ of P)E&&await Promise.resolve(E($))===false||M.push($);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(Ke($=>zi($,M)),M.forEach($=>a.onTaskDelete?.($))),W&&M.forEach($=>W($)));},[a,E,W]),Nu=useCallback(P=>{Ke(M=>Ui(M,P)),P.forEach(M=>a.onTaskDuplicate?.(M));},[a]),Du=useCallback((P,M)=>{Ke($=>{let{tasks:te,newTask:pe}=_c($,P,M);return Ne&&Ne(pe)===false?$:(a.onTaskCreate?.(pe.parentId,pe.position||0),Ae?.(pe),te)});},[a,Ne,Ae]),Su=useCallback((P,M)=>{Ke($=>$i($,P,M)),a.onTaskRename?.(P,M);},[a]),Ss=useCallback(P=>{Ke(M=>{let{tasks:$}=Wi(M,P);return a.onTaskCreate?.(P,0),$});},[a]),Eu=useCallback((P,M,$)=>{let te=P.startDate?Math.round((M.getTime()-P.startDate.getTime())/864e5):0,pe=mt=>mt.map(Ht=>Ht.id===P.id?{...Ht,startDate:M,endDate:$,...P.segments&&{segments:P.segments}}:Ht.subtasks?{...Ht,subtasks:pe(Ht.subtasks)}:Ht),ve=pe(ee);ve=xe.autoScheduleDependents(ve,P.id,te),Ke(ve);let bt={...P,startDate:M,endDate:$};N?.(bt);},[ee,N]),Pu=useCallback((P,M)=>{I?.(P,M),we({isOpen:true,x:M.clientX,y:M.clientY,task:P});},[I]),Mu=useCallback((P,M)=>{let $=xe.splitTask(ee,P.id,M);Ke($),we({isOpen:false,x:0,y:0,task:null});},[ee]),jl=useCallback(P=>{let M=xe.findTaskById(ee,P.id)||P;A?.(M),R||Ge(M);},[ee,A,R]),Kl=useCallback((P,M,$)=>{let te=new Map,pe=fa=>{fa.forEach(ha=>{ha.dependencies&&te.set(ha.id,ha.dependencies),ha.subtasks&&pe(ha.subtasks);});};pe($);let ve=te.get(M)||[];te.set(M,[...ve,P]);let bt=new Set,mt=new Set,Ht=fa=>{if(!bt.has(fa)){bt.add(fa),mt.add(fa);let ha=te.get(fa)||[];for(let wr of ha){if(!bt.has(wr)&&Ht(wr))return true;if(mt.has(wr))return true}}return mt.delete(fa),false};return Ht(M)},[]),Yl=useCallback((P,M)=>{if(Kl(P.id,M,ee)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
342
|
+
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ve.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?ve.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let y=t.find(k=>k.id===f);if(y){o(y);let k=r.get(f)?.ef||0;d=Math.max(d,k);}}let u=d+c;r.set(i.id,{es:d,ef:u});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?ve.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),u=s;if(d.length>0)for(let y of d){l(y);let k=n.get(y.id)?.ls||0;u=Math.min(u,k);}let f=u-c;n.set(i.id,{ls:f,lf:u});};a.forEach(l);let m=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let u=d.ls-c.es;Math.abs(u)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=ve.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ve.calculateCriticalPath(e).includes(t))return 0;let o=ve.getDependentTasks(e,t);if(o.length===0){let l=ve.getLatestEndDate(e);if(!l)return null;let m=ve.calculateDuration(a.endDate,l);return Math.max(0,m)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,m)=>l-m)[0];if(!s)return null;let n=ve.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ve.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ve.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ve.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=ve.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=ve.calculateEndDate(m,l),c=d=>d.map(u=>u.id===n.id?{...u,startDate:m,endDate:i}:u.subtasks?{...u,subtasks:c(u.subtasks)}:u);s=c(s),s=ve.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,d=ve.findTaskById(e,t);if(!d||!d.endDate)return [];let u=(f,y,k=new Set)=>{if(k.has(f))return;k.add(f);let g=ve.getDependentTasks(e,f);for(let v of g){if(!v.startDate||!v.endDate)continue;let h=r.findIndex(N=>N.id===v.id);if(h===-1)continue;let p=v.startDate.getTime(),x=(v.endDate.getTime()-p)/c,T=(p-i)/c*s,C=T+y*s,A=Math.max(x*s,s),I=l+h*n+12;m.push({taskId:v.id,taskName:v.name,originalX:T,previewX:C,width:A,y:I,rowIndex:h,daysDelta:y,color:v.color}),u(v.id,y,k);}};return u(t,a),m},splitTask:(e,t,a,r=3)=>{let o=ve.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Qn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:u,onTaskDateChange:f,onDependencyCreate:y,onDependencyDelete:k}){let v=Br(),[h,p]=useState([]),[w,x]=useState(null),S=useCallback(F=>{x(F);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),C=r==="day"?60:r==="week"?20:8,A=T*C*n,I=F=>{let B=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),E=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-E);let W=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-W.getTime())/864e5+1)/7)},N=F=>{let B=F.getDay();return B===0||B===6},z=useCallback(F=>{let B=Math.round(F/(C*n)),E=new Date(o);return E.setDate(E.getDate()+B),E},[o,C,n]),R=useCallback((F,B)=>{if(B.startDate&&B.endDate)return;let E=F.currentTarget.ownerSVGElement;if(!E)return;let W=E.createSVGPoint();W.x=F.clientX,W.y=F.clientY;let J=W.matrixTransform(E.getScreenCTM()?.inverse()),ue=z(J.x),be=new Date(ue);be.setDate(be.getDate()+1),f?.(B,ue,be);},[z,f]),_=useMemo(()=>{let F=J=>J.map(ue=>{if(ue.subtasks&&ue.subtasks.length>0){let be=F(ue.subtasks),Ce=be.filter(Y=>Y.startDate&&Y.endDate);if(Ce.length>0){let Y=Ce.map(Le=>Le.startDate.getTime()),V=Ce.map(Le=>Le.endDate.getTime()),Oe=new Date(Math.min(...Y)),pe=new Date(Math.max(...V));return {...ue,subtasks:be,startDate:Oe,endDate:pe}}return {...ue,subtasks:be}}return ue}),B=(J,ue=[])=>{for(let be of J)ue.push(be),be.subtasks&&be.subtasks.length>0&&(be.isExpanded===void 0||be.isExpanded)&&B(be.subtasks,ue);return ue},E=F(e);return B(E)},[e]),se=useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let B=F.startDate.getTime(),E=F.endDate.getTime(),W=o.getTime(),J=(B-W)/(1e3*60*60*24),ue=(E-B)/(1e3*60*60*24),be=J*C*n,Ce=Math.max(C*n,40),Y=Math.max(ue*C*n,Ce);return {x:be,width:Y}},[o,C,n]),te=useMemo(()=>_.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:B,width:E}=se(F),J=_.findIndex(ue=>ue.id===F.id)*a+12;return {id:F.id,x:B,y:J,width:E,height:32}}),[_,se]),ie=useCallback((F,B,E)=>{if(!E||B===0){p([]);return}let W=ve.calculateCascadePreview(e,F,B,_,o,C*n,a,48);p(W);},[e,_,o,C,n,a,48]),xe=useMemo(()=>{let F=[],B=new Date(o);for(;B<=s;){let J=(B.getTime()-o.getTime())/864e5*C*n;if(r==="day")F.push({date:new Date(B),label:B.toLocaleDateString(l,{day:"numeric",month:"short"}),x:J}),B.setDate(B.getDate()+1);else if(r==="week"){let ue=I(B);F.push({date:new Date(B),label:`${v.labels.week} ${ue}`,x:J}),B.setDate(B.getDate()+7);}else F.push({date:new Date(B),label:B.toLocaleDateString(l,{month:"short",year:"numeric"}),x:J}),B.setMonth(B.getMonth()+1);}return F},[o,s,r,C,n,l,v.labels.week]),Ne=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*C*n,[o,C,n]),Ae=Math.max(_.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.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(A,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(A,1e3),height:48,fill:t.bgGrid}),xe.map((F,B)=>jsxs("g",{children:[B>0&&jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${B}`)),Ne>=0&&Ne<=A&&jsx("circle",{cx:Ne,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(A,1e3),height:Ae,style:{display:"block",flexShrink:0,overflow:"visible"},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("rect",{x:0,y:0,width:Math.max(A,1e3),height:Ae,fill:t.bgPrimary}),xe.map((F,B)=>{let E=xe[B+1]?.x||A,W=N(F.date);return jsxs("g",{children:[W&&jsx("rect",{x:F.x,y:0,width:E-F.x,height:_.length*a,fill:t.bgWeekend,opacity:1}),B>0&&jsx("line",{x1:F.x,y1:0,x2:F.x,y2:_.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),_.map((F,B)=>{let E=F.startDate&&F.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:B*a,width:A,height:a,fill:B%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!E&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:B*a,width:A,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:W=>R(W,F),onMouseEnter:W=>{W.currentTarget.setAttribute("fill",t.accentLight),W.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:W=>{W.currentTarget.setAttribute("fill","transparent"),W.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsx("text",{x:Ne>0?Ne:100,y:B*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:v.labels.clickToSetDates},`placeholder-${F.id}`)]})]},`row-group-${F.id}`)}),_.map((F,B)=>{if(!F.startDate||!F.endDate)return null;let{x:E,width:W}=se(F),J=B*a+12,ue=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsx(Jn,{task:F,x:E+W/2,y:J+16,theme:t,onClick:c},F.id):ue?jsxs("g",{onClick:()=>c?.(F),onContextMenu:be=>{be.preventDefault(),be.stopPropagation(),u?.(F,be);},style:{cursor:"default"},children:[jsx("rect",{x:E,y:J,width:W,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:E,y1:J,x2:E+W,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E,y1:J,x2:E,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E+W,y1:J,x2:E+W,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E,y1:J+32,x2:E+W,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),W>60&&jsx("text",{x:E+12,y:J+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsx(jn,{task:F,x:E,y:J,width:W,theme:t,dayWidth:C*n,startDate:o,templates:m,onClick:c,onDoubleClick:d,onContextMenu:u,onDateChange:f,onDependencyCreate:y,allTaskPositions:te,onDragMove:ie,onHoverChange:S},F.id)}),_.map((F,B)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(E=>{let W=_.find(pe=>pe.id===E);if(!W||!W.startDate||!W.endDate)return null;let J=_.findIndex(pe=>pe.id===E),ue=se(W),be=se(F),Ce=ue.x+ue.width,Y=J*a+28,V=be.x,Oe=B*a+28;return jsx(qn,{x1:Ce,y1:Y,x2:V,y2:Oe,theme:t,lineStyle:i,onDelete:()=>k?.(F.id,E)},`dep-${E}-${F.id}`)})),h.map(F=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),Ne>=0&&Ne<=A&&jsx("line",{x1:Ne,y1:0,x2:Ne,y2:Ae,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),w&&jsx(Qc,{tooltipData:w,theme:t})]})]})}var l0=['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"'],rm=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),d0=()=>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"})}),c0=()=>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"})}),m0=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),p0=()=>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 es({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:m}){let[i,c]=useState(false),[d,u]=useState(false),[f,y]=useState([]),[k,g]=useState(""),[v,h]=useState(false),[p,w]=useState(true),x=useRef(null),S=useRef(null),T=useRef(null),{enabled:C=true,placeholder:A='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:N,suggestions:z=l0,maxHistory:R=50,persistHistory:_}=a,se=_?.storageKey||"gantt-ai-history",te=_?.maxMessages??5;useEffect(()=>{if(_?.enabled)try{let B=localStorage.getItem(se);if(B){let W=JSON.parse(B).map(J=>({...J,timestamp:new Date(J.timestamp)}));y(W.slice(-te));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[_?.enabled,se,te]),useEffect(()=>{if(_?.enabled&&f.length>0)try{let B=f.filter(E=>!E.isLoading).slice(-te);localStorage.setItem(se,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[f,_?.enabled,se,te]),useEffect(()=>{S.current&&S.current.scrollIntoView({behavior:"smooth"});},[f]),useEffect(()=>{i&&!d&&x.current&&setTimeout(()=>x.current?.focus(),100);},[i,d]);let ie=useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&o?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&n?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&l?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&m?.(B.taskId,B.dependencyFrom);break}},[o,s,n,l,m]),xe=useCallback(async B=>{if(!B.trim()||v)return;let E={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};y(J=>[...J.slice(-(R-1)),E]),g(""),w(false),h(true);let W={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(J=>[...J,W]);try{if(N){let J=await N(B,e);y(ue=>{let be=ue.filter(Y=>!Y.isLoading),Ce={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...be,Ce]}),ie(J);}else y(J=>[...J.filter(be=>!be.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(J){y(ue=>[...ue.filter(Ce=>!Ce.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[v,R,N,e,ie]),Ne=B=>{B.preventDefault(),xe(k);},Ae=B=>{g(B),x.current?.focus();};if(useEffect(()=>{let B=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),c(W=>!W),i||u(false)),E.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[i]),useEffect(()=>{if(!i)return;let B=W=>{let J=W.target;T.current&&!T.current.contains(J)&&c(false);},E=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",B);}},[i]),!C)return null;let F={"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(gt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${F[I]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>c(true),children:[jsx(rm,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${F[I]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(rm,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>u(B=>!B),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(m0,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(c0,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[f.length===0&&p&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:z.slice(0,4).map((B,E)=>jsx("button",{onClick:()=>Ae(B),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:B.length>30?B.slice(0,30)+"...":B},E))})]}),f.map(B=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:B.role==="user"?"white":t.textPrimary},children:[B.isLoading?jsx(p0,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:B.command.success?"#10B981":"#EF4444"},children:[B.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsx("div",{ref:S})]}),jsxs("form",{onSubmit:Ne,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:x,type:"text",value:k,onChange:B=>g(B.target.value),placeholder:A,disabled:v,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!k.trim()||v,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsx(d0,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function om(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,c=true)=>{r(d=>{let u=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:u};if(!c)return {...d,present:u};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:u,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),m=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function nm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=l?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&m&&n.key==="y"){n.preventDefault(),t();return}if(l&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var b0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ve.formatDate(e.startDate)} - ${ve.formatDate(e.endDate)}`);let a=ve.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=>ve.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function sm(e){return {...b0,...e}}var T0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},dm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:u=true,persistExpandedState:f,persistFilter:y,aiAssistant:k,locale:g="en",customTranslations:v,showCreateTaskButton:h=false,createTaskLabel:p,onCreateTask:w,taskFilter:x,onTaskFilterChange:S,onThemeChange:T,onTaskClick:C,onTaskDblClick:A,onTaskContextMenu:I,onTaskUpdate:N,onProgressChange:z,onTaskEdit:R,onTaskAddSubtask:_,onTaskMarkIncomplete:se,onTaskSetInProgress:te,onDependencyCreate:ie,onDependencyDelete:xe,onBeforeTaskAdd:Ne,onAfterTaskAdd:Ae,onBeforeTaskUpdate:F,onAfterTaskUpdate:B,onBeforeTaskDelete:E,onAfterTaskDelete:W}=a,ue=useContext(On)?.theme,[be,Ce]=useState(ue||s||"dark"),[Y,V]=useState(n),[Oe,pe]=useState(l),[Le,Je]=useState(1),st=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Ge,bt]=useState(()=>{if(!y)return "all";try{let P=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(P);if(M){let $=JSON.parse(M);if($.taskFilter)return $.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),ut=x??Ge,Pt=S??bt,[ge,L]=useState(()=>{if(!y)return false;try{let P=typeof y=="string"?y:"gantt-filter-state",M=localStorage.getItem(P);if(M){let $=JSON.parse(M);if(typeof $.hideCompleted=="boolean")return $.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});useEffect(()=>{let P=st();if(P)try{let M={taskFilter:ut,hideCompleted:ge};localStorage.setItem(P,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[ut,ge,st]);let[re,Te]=useState(0),[Ue,Z]=useState(false),[Re,H]=useState(null),[K,ke]=useState({isOpen:false,x:0,y:0,task:null}),[Ie,_e]=useState(null),[We,ne]=useState(null);useEffect(()=>{ue&&ue!==be&&Ce(ue);},[ue]),useEffect(()=>{s&&s!==be&&Ce(s);},[s]);let Be=useCallback(P=>{Ce(P),T?.(P);},[T]),{state:ee,setState:Ye,undo:Pa,redo:fe,canUndo:qe,canRedo:He,clearHistory:Ze}=om(t,50),rt=useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),it=useRef(new Map),G=useRef(false);if(!G.current&&f){G.current=true;let P=typeof f=="string"?f:"gantt-expanded-tasks";try{let M=localStorage.getItem(P);if(M){let $=JSON.parse(M);Array.isArray($)&&(it.current=new Map($));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let q=useCallback(()=>{let P=rt();if(P)try{let M=Array.from(it.current.entries());localStorage.setItem(P,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[rt]);useEffect(()=>{let P=$=>{let ae=new Map;for(let me of $){let ye=me.name.toLowerCase().trim(),ht=ae.get(ye);ht?ht.id.startsWith("subtask-")&&!me.id.startsWith("subtask-")&&ae.set(ye,me):ae.set(ye,me);}return Array.from(ae.values())},M=$=>$.map(ae=>{let me=it.current.get(ae.id),ye=me!==void 0?{...ae,isExpanded:me}:ae;if(ye.subtasks?.length){let ht=P(ye.subtasks);return {...ye,subtasks:M(ht)}}return ye});if(it.current.size>0)Ye(M(t));else {let $=ae=>ae.map(me=>me.subtasks?.length?{...me,subtasks:P($(me.subtasks))}:me);Ye($(t));}},[t,Ye]);let Pe=useRef(t),Ke=useRef(true);useEffect(()=>{if(Ke.current){Ke.current=false,Pe.current=ee;return}if(!r)return;let P=JSON.stringify(Pe.current),M=JSON.stringify(ee);P!==M&&(Pe.current=ee,r(ee));},[ee,r]);let ze=useMemo(()=>Si(g,v),[g,v]),U=useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[le,D]=useState(()=>U(ze));useEffect(()=>{D(P=>P.map(M=>({...M,label:ze.columns[M.id==="name"?"taskName":M.id]||M.label})));},[ze]);let Q=useMemo(()=>le.filter(M=>M.visible).reduce((M,$)=>M+$.width,0),[le]),ce=useRef(le.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=le.filter(ae=>ae.visible),M=P.map(ae=>ae.id).join(","),$=ce.current;if(M!==$){let ae=P.some(ye=>ye.id!=="name"),me=$.includes(",");ae?!me&&ae&&H(null):H(null),ce.current=M;}},[le]);let Xe=60,Ft=.6,Zt=useMemo(()=>{let M=Q+Xe,$=typeof window<"u"?window.innerWidth*Ft:800,ae=Math.max(M,$);return Re!==null?Math.max(200,Math.min(Re,ae)):Math.max(200,M)},[Re,Q]),Dt=useRef(null),de=useRef(null),Qe=useRef(null),Ve=useMemo(()=>Pc(be),[be]),ar=useMemo(()=>({theme:Ve,themeName:be}),[Ve,be]),Lo=useMemo(()=>sm(d),[d]),kr=useMemo(()=>{if(!u)return ee;let P=ve.calculateCriticalPath(ee),M=$=>$.map(ae=>({...ae,isCriticalPath:P.includes(ae.id),subtasks:ae.subtasks?M(ae.subtasks):void 0}));return M(ee)},[ee,u]),rr=useMemo(()=>{if(ut==="all"&&!ge)return kr;let P=M=>{let $=[];for(let ae of M){let me=ae.subtasks?.length?P(ae.subtasks):void 0,ye=false;if(ge)ye=ae.progress<100;else switch(ut){case "all":ye=true;break;case "incomplete":ye=ae.progress<100;break;case "in_progress":ye=ae.progress>0&&ae.progress<100;break;case "completed":ye=ae.progress===100;break}(ye||me&&me.length>0)&&$.push({...ae,subtasks:me});}return $};return P(kr)},[kr,ut,ge]),or=T0(Oe);nm({undo:Pa,redo:fe,canUndo:qe,canRedo:He,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>ve.findTaskById(ee,P),addTask:(P,M)=>{Ye($=>{if(!M)return [...$,{...P,level:0}];let ae=me=>me.map(ye=>ye.id===M?{...ye,subtasks:[...ye.subtasks||[],{...P,parentId:M,level:(ye.level||0)+1}],isExpanded:true}:ye.subtasks?{...ye,subtasks:ae(ye.subtasks)}:ye);return ae($)});},updateTask:(P,M)=>{Ye($=>{let ae=me=>me.map(ye=>ye.id===P?{...ye,...M}:ye.subtasks?{...ye,subtasks:ae(ye.subtasks)}:ye);return ae($)});},deleteTask:P=>{Ye(M=>{let $=ae=>ae.filter(me=>me.id===P?false:(me.subtasks&&(me.subtasks=$(me.subtasks)),true));return $(M)});},deleteTasks:P=>{Ye(M=>zi(M,P));},duplicateTask:P=>{Ye(M=>Ui(M,[P]));},splitTask:(P,M,$=3)=>{Ye(ae=>ve.splitTask(ae,P,M,$));},calculateEndDate:ve.calculateEndDate,calculateDuration:ve.calculateDuration,validateDependency:(P,M)=>!ve.validateDependencies(ee,P,M),getAllTasks:()=>ve.flattenTasks(ee),getTasksByStatus:P=>ve.flattenTasks(ee).filter(M=>M.status===P),getTasksByParent:P=>P?ve.findTaskById(ee,P)?.subtasks||[]:ee.filter($=>!$.parentId),getCriticalPath:()=>ve.flattenTasks(ee).filter(P=>P.isCriticalPath),indentTask:P=>{Ye(M=>Bi(M,[P]));},outdentTask:P=>{Ye(M=>Ri(M,[P]));},moveTask:(P,M)=>{Ye($=>Oi($,[P],M));},createSubtask:async P=>{let{tasks:M,newTask:$}=Wi(ee,P);if(Ne){let ae=Ne({...$,parentId:P});if((ae instanceof Promise?await ae:ae)===false)return}Ye(M),Ae&&Ae({...$,parentId:P});},scrollToTask:P=>{let $=ve.flattenTasks(ee).findIndex(ae=>ae.id===P);if($!==-1&&Dt.current){let ae=$*or;Dt.current.scrollTo({top:ae,behavior:"smooth"}),de.current&&de.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(P,M=2e3)=>{},expandTask:P=>{Ye(M=>{let $=ae=>ae.map(me=>me.id===P?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:$(me.subtasks)}:me);return $(M)});},collapseTask:P=>{Ye(M=>{let $=ae=>ae.map(me=>me.id===P?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:$(me.subtasks)}:me);return $(M)});},expandAll:()=>{Ye(P=>{let M=$=>$.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?M(ae.subtasks):void 0}));return M(P)});},collapseAll:()=>{Ye(P=>{let M=$=>$.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?M(ae.subtasks):void 0}));return M(P)});},undo:Pa,redo:fe,canUndo:()=>qe,canRedo:()=>He,clearHistory:Ze,exportToPNG:async()=>{if(!Qe.current||!Dt.current||!de.current)throw new Error("Gantt container not found");let P=Qe.current,M=Dt.current.querySelector(".gantt-grid-scroll"),$=de.current,ae=M?.scrollTop||0,me=$.scrollTop,ye=P.style.overflow,ht=P.style.height;try{let ct=M?.querySelector(".gantt-taskgrid-content"),Ht=$.querySelector("svg"),fa=ct?.scrollHeight||M?.scrollHeight||600,ha=Ht?.getBoundingClientRect().height||$.scrollHeight,_r=(P.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(fa,ha)+20;M&&(M.scrollTop=0),$.scrollTop=0,P.style.overflow="visible",P.style.height=`${_r}px`,await new Promise(Cr=>setTimeout(Cr,100));let nr=await lm(P,{backgroundColor:Ve.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Cr=>{let po=window.getComputedStyle(Cr),Vr=parseInt(po.zIndex,10);return !isNaN(Vr)&&Vr>=50||po.position==="fixed"}});return new Promise((Cr,po)=>{nr.toBlob(Vr=>{Vr?Cr(Vr):po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{P.style.overflow=ye,P.style.height=ht,M&&(M.scrollTop=ae),$.scrollTop=me;}},exportToPDF:async P=>{await ve.exportToPDF(ee,P);},exportToExcel:async P=>{await ve.exportToExcel(ee,P);},exportToJSON:()=>ve.exportToJSON(ee),exportToCSV:()=>ve.exportToCSV(ee),importFromJSON:P=>{let M=ve.importFromJSON(P);Ye(M);},getTasks:()=>ee,refresh:()=>{Ye(P=>[...P]);},clearAll:()=>{Ye([]);}}),[ee,Pa,fe,qe,He,Ze,Ve,or]);let Kt=useCallback(P=>{D(M=>M.map($=>$.id===P?{...$,visible:!$.visible}:$));},[]),Ts=useCallback((P,M)=>{D($=>$.map(ae=>{if(ae.id!==P)return ae;let me=ae.minWidth??100,ye=ae.maxWidth??800,ht=Math.max(me,Math.min(ye,M));return {...ae,width:ht}}));},[]),Ns=useCallback(P=>{Ye(M=>{let $=Hi(M,P),ae=me=>{for(let ye of me){if(ye.id===P){it.current.set(P,ye.isExpanded??true);return}ye.subtasks?.length&&ae(ye.subtasks);}};return ae($),q(),$}),a.onTaskToggleExpand?.(P);},[a,q]),Gr=useCallback((P,M)=>{if(F&&F(P,M)===false)return;let ae=ve.findTaskById(ee,P)?.progress,me=ht=>ht.map(ct=>ct.id===P?{...ct,...M}:ct.subtasks?{...ct,subtasks:me(ct.subtasks)}:ct);Ye(me(ee));let ye=ve.findTaskById(me(ee),P);ye&&(N?.(ye),B?.(ye),M.progress!==void 0&&ae!==void 0&&M.progress!==ae&&z?.(P,ae,M.progress));},[ee,N,F,B,z]),Io=useCallback(P=>{P.length!==0&&(Ye(M=>Bi(M,P)),a.onTaskIndent?.(P[0]));},[a]),wu=useCallback(P=>{P.length!==0&&(Ye(M=>Ri(M,P)),a.onTaskOutdent?.(P[0]));},[a]),Cu=useCallback((P,M,$)=>{Ye(ae=>Vc(ae,P,M,$)),a.onTaskReparent?.(P,M,$);},[a]),Tu=useCallback((P,M)=>{P.length!==0&&(Ye($=>Oi($,P,M)),a.onTaskMove?.(P[0],M));},[a]),Ds=useCallback(async P=>{let M=[];for(let $ of P)E&&await Promise.resolve(E($))===false||M.push($);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(Ye($=>zi($,M)),M.forEach($=>a.onTaskDelete?.($))),W&&M.forEach($=>W($)));},[a,E,W]),Nu=useCallback(P=>{Ye(M=>Ui(M,P)),P.forEach(M=>a.onTaskDuplicate?.(M));},[a]),Du=useCallback((P,M)=>{Ye($=>{let{tasks:ae,newTask:me}=_c($,P,M);return Ne&&Ne(me)===false?$:(a.onTaskCreate?.(me.parentId,me.position||0),Ae?.(me),ae)});},[a,Ne,Ae]),Su=useCallback((P,M)=>{Ye($=>$i($,P,M)),a.onTaskRename?.(P,M);},[a]),Ss=useCallback(P=>{Ye(M=>{let{tasks:$}=Wi(M,P);return a.onTaskCreate?.(P,0),$});},[a]),Eu=useCallback((P,M,$)=>{let ae=P.startDate?Math.round((M.getTime()-P.startDate.getTime())/864e5):0,me=ct=>ct.map(Ht=>Ht.id===P.id?{...Ht,startDate:M,endDate:$,...P.segments&&{segments:P.segments}}:Ht.subtasks?{...Ht,subtasks:me(Ht.subtasks)}:Ht),ye=me(ee);ye=ve.autoScheduleDependents(ye,P.id,ae),Ye(ye);let ht={...P,startDate:M,endDate:$};N?.(ht);},[ee,N]),Pu=useCallback((P,M)=>{I?.(P,M),ke({isOpen:true,x:M.clientX,y:M.clientY,task:P});},[I]),Mu=useCallback((P,M)=>{let $=ve.splitTask(ee,P.id,M);Ye($),ke({isOpen:false,x:0,y:0,task:null});},[ee]),jl=useCallback(P=>{let M=ve.findTaskById(ee,P.id)||P;A?.(M),R||_e(M);},[ee,A,R]),Kl=useCallback((P,M,$)=>{let ae=new Map,me=fa=>{fa.forEach(ha=>{ha.dependencies&&ae.set(ha.id,ha.dependencies),ha.subtasks&&me(ha.subtasks);});};me($);let ye=ae.get(M)||[];ae.set(M,[...ye,P]);let ht=new Set,ct=new Set,Ht=fa=>{if(!ht.has(fa)){ht.add(fa),ct.add(fa);let ha=ae.get(fa)||[];for(let wr of ha){if(!ht.has(wr)&&Ht(wr))return true;if(ct.has(wr))return true}}return ct.delete(fa),false};return Ht(M)},[]),Yl=useCallback((P,M)=>{if(Kl(P.id,M,ee)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
343
343
|
|
|
344
|
-
Task dependencies must flow in one direction only.`);return}let $=te=>te.map(pe=>{if(pe.id===M){let ve=pe.dependencies||[];if(!ve.includes(P.id))return {...pe,dependencies:[...ve,P.id]}}return pe.subtasks?{...pe,subtasks:$(pe.subtasks)}:pe});Ke($(ee)),ie?.(P.id,M);},[ee,ie,Kl]),ql=useCallback((P,M)=>{let $=te=>te.map(pe=>{if(pe.id===P&&pe.dependencies){let ve=pe.dependencies.filter(bt=>bt!==M);return {...pe,dependencies:ve}}return pe.subtasks?{...pe,subtasks:$(pe.subtasks)}:pe});Ke($(ee)),ke?.(P,M);},[ee,ke]),{startDate:pn,endDate:Fu}=useMemo(()=>{let P=ee.filter(ve=>ve.startDate&&ve.endDate);if(P.length===0){let ve=new Date,bt=new Date(ve);bt.setDate(bt.getDate()-30);let mt=new Date(ve);return mt.setDate(mt.getDate()+60),{startDate:bt,endDate:mt}}let M=P.flatMap(ve=>[ve.startDate,ve.endDate]).filter(ve=>ve!==void 0),$=new Date(Math.min(...M.map(ve=>ve.getTime()))),te=new Date(Math.max(...M.map(ve=>ve.getTime()))),pe=he==="day"?7:he==="week"?14:30;return $.setDate($.getDate()-pe),te.setDate(te.getDate()+pe),{startDate:$,endDate:te}},[ee,he]),Au=useCallback(async()=>{if(!Ze.current||!Dt.current||!ce.current)return;await new Promise(_r=>setTimeout(_r,200));let P=Ze.current,M=Dt.current.querySelector(".gantt-grid-scroll"),$=ce.current,te=M?.scrollTop||0,pe=M?.scrollLeft||0,ve=$.scrollTop,bt=$.scrollLeft,mt=P.style.overflow,Ht=P.style.height,fa=M?.style.overflow||"",ha=$.style.overflow,wr=P.style.width,un=$.style.width;try{let _r=M?.querySelector(".gantt-taskgrid-content"),nr=$.querySelector("svg"),Cr=nr?.getAttribute("height")?parseInt(nr.getAttribute("height"),10):nr?.getBoundingClientRect().height||0,po=_r?.scrollHeight||M?.scrollHeight||600,Vr=Math.max(Cr,$.scrollHeight),Zl=nr?.getAttribute("width")?parseInt(nr.getAttribute("width"),10):nr?.getBoundingClientRect().width||$.scrollWidth,$u=P.querySelector('[class*="h-12"]')?.offsetHeight||48,Ps=Math.max(po,Vr,Cr),Ms=$u+Ps+50,Fs=(M?.offsetWidth||300)+Zl+10;M&&(M.scrollTop=0,M.scrollLeft=0),$.scrollTop=0,$.scrollLeft=0,P.style.overflow="visible",P.style.height=`${Ms}px`,P.style.width=`${Fs}px`,M&&(M.style.overflow="visible",M.style.height=`${Ps+50}px`),$.style.overflow="visible",$.style.height=`${Ps+50}px`,$.style.width=`${Zl+10}px`,await new Promise(Ls=>setTimeout(Ls,150));let Hu=await lm(P,{backgroundColor:_e.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Fs,height:Ms,windowWidth:Fs+100,windowHeight:Ms+100,scrollX:0,scrollY:0,ignoreElements:Ls=>{let Ql=window.getComputedStyle(Ls),ed=parseInt(Ql.zIndex,10);return !isNaN(ed)&&ed>=50||Ql.position==="fixed"}}),As=document.createElement("a");As.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,As.href=Hu.toDataURL("image/png"),As.click();}finally{P.style.overflow=mt,P.style.height=Ht,P.style.width=wr,M&&(M.style.overflow=fa,M.style.height="",M.scrollTop=te,M.scrollLeft=pe),$.style.overflow=ha,$.style.height="",$.style.width=un,$.scrollTop=ve,$.scrollLeft=bt;}},[_e]),Lu=useCallback(async()=>{await xe.exportToPDF(ee);},[ee]),Iu=useCallback(async()=>{await xe.exportToExcel(ee);},[ee]),Bu=useCallback(()=>{let P=xe.exportToCSV(ee),M=new Blob([P],{type:"text/csv;charset=utf-8;"}),$=document.createElement("a");$.href=URL.createObjectURL(M),$.download="gantt-chart.csv",$.click(),URL.revokeObjectURL($.href);},[ee]),Ru=useCallback(()=>{let P=xe.exportToJSON(ee),M=new Blob([P],{type:"application/json;charset=utf-8;"}),$=document.createElement("a");$.href=URL.createObjectURL(M),$.download="gantt-chart.json",$.click(),URL.revokeObjectURL($.href);},[ee]),Ou=useCallback(()=>{xe.exportToMSProject(ee,"Gantt Project","project.xml");},[ee]),zu=P=>{P.preventDefault(),Z(true);},mo=useRef(false),[Es,Xl]=useState(false),Bo=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=ce.current,M=Dt.current?.querySelector(".gantt-grid-scroll");if(!P||!M)return;let $=()=>{if(mo.current)return;mo.current=true;let mt=P.scrollTop;Te(mt),M.scrollTop=mt,requestAnimationFrame(()=>{mo.current=false;});},te=()=>{if(mo.current)return;mo.current=true;let mt=M.scrollTop;Te(mt),P.scrollTop=mt,requestAnimationFrame(()=>{mo.current=false;});},pe=mt=>{if(ze&&M){let fa=M.parentElement?.getBoundingClientRect()?.left||0,ha=mt.clientX-fa,wr=200,un=Q+qe,_r=window.innerWidth*Mt,nr=Math.max(un,_r);ha>=wr&&ha<=nr&&H(ha);}if(Es&&P){let Ht=mt.clientX-Bo.current.x,fa=mt.clientY-Bo.current.y;P.scrollLeft=Bo.current.scrollLeft-Ht,P.scrollTop=Bo.current.scrollTop-fa;}},ve=()=>{Z(false),Xl(false);},bt=mt=>{if(mt.button!==0)return;let Ht=mt.target;Ht.closest("[data-task-bar]")||Ht.closest("[data-dependency-line]")||Ht.closest("button")||Ht.closest('[role="button"]')||Ht.tagName==="rect"&&Ht.getAttribute("data-clickable")==="true"||(Xl(true),Bo.current={x:mt.clientX,y:mt.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},mt.preventDefault());};return P.addEventListener("scroll",$),M.addEventListener("scroll",te),P.addEventListener("mousedown",bt),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",ve),()=>{P.removeEventListener("scroll",$),M.removeEventListener("scroll",te),P.removeEventListener("mousedown",bt),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",ve);}},[ze,Es,Q]);let Jl=useRef(false),Uu=useRef(null);return useLayoutEffect(()=>{if(Jl.current||ee.length===0||!ce.current)return;Jl.current=true,Uu.current=pn;let P=ce.current,M=new Date,$=he==="day"?60:he==="week"?20:8,te=(M.getTime()-pn.getTime())/(1e3*60*60*24),pe=P.clientWidth,bt=te*$*Be-pe/2;te>=0&&pe>0&&(P.scrollLeft=Math.max(0,bt));},[ee.length,pn,he,Be]),jsx(To.Provider,{value:Oe,children:jsx(zs.Provider,{value:ar,children:jsxs("div",{ref:Ze,className:"flex flex-col h-full w-full",style:{backgroundColor:_e.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx($n,{theme:_e,timeScale:he,onTimeScaleChange:j,zoom:Be,onZoomChange:nt,currentTheme:be,onThemeChange:Ie,rowDensity:He,onRowDensityChange:de,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:p,onCreateTask:w,taskFilter:ct,onTaskFilterChange:$t,hideCompleted:ge,onHideCompletedChange:L,onExportPNG:i?Au:void 0,onExportPDF:i?Lu:void 0,onExportExcel:i?Iu:void 0,onExportCSV:i?Bu:void 0,onExportJSON:i?Ru:void 0,onExportMSProject:i?Ou:void 0}),jsxs("div",{ref:Dt,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Zt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(_n,{tasks:rr,theme:_e,rowHeight:or,availableUsers:c,templates:Lo,onTaskClick:C,onTaskDblClick:jl,onTaskContextMenu:I,onTaskToggle:Ns,scrollTop:re,columns:le,onToggleColumn:Kt,onColumnResize:Ts,onTaskUpdate:Gr,onTaskIndent:Io,onTaskOutdent:wu,onTaskMove:Tu,onMultiTaskDelete:Ds,onTaskDuplicate:Nu,onTaskCreate:Du,onTaskRename:Su,onCreateSubtask:Ss,onOpenTaskModal:C?P=>C(P):void 0,onDeleteRequest:(P,M)=>se({taskId:P,taskName:M}),onTaskReparent:Cu})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:_e.border,zIndex:15},onMouseDown:zu}),jsx("div",{ref:ce,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Es?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Qn,{tasks:rr,theme:_e,rowHeight:or,timeScale:he,startDate:pn,endDate:Fu,zoom:Be,locale:g,templates:Lo,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:C,onTaskDblClick:jl,onTaskContextMenu:Pu,onTaskDateChange:Eu,onDependencyCreate:Yl,onDependencyDelete:ql})})]}),Y.task&&jsx(No,{isOpen:Y.isOpen,x:Y.x,y:Y.y,theme:_e,onClose:()=>we({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Y.task;if(!P)return [];let M=xe.findTaskById(ee,P.id)||P;return M.subtasks&&M.subtasks.length>0?[{id:"addSubtask",label:Oe.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{V?V(M):Ss(M.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Oe.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{se({taskId:M.id,taskName:M.name});}}]:[{id:"edit",label:Oe.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{R?R(M):Ge(M);}},{id:"addSubtask",label:Oe.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{V?V(M):Ss(M.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Oe.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{ne?ne(M):Gr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"},{id:"setInProgress",label:Oe.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{ae?ae(M):Gr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"},{id:"markComplete",label:Oe.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{Gr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Oe.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{if(!M.startDate||!M.endDate){console.warn("Cannot split task without dates");return}let te=M.startDate.getTime(),pe=M.endDate.getTime(),ve=te+(pe-te)/2,bt=new Date(ve);Mu(M,bt);},disabled:!M.startDate||!M.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Oe.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{se({taskId:M.id,taskName:M.name});}}]})()}),jsx(fr,{task:Le,isOpen:!!Le,onClose:()=>Ge(null),onTaskUpdate:P=>{Le&&(Gr(Le.id,P),Ge(null));},theme:be==="light"?"light":"dark",locale:g==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsx(AnimatePresence,{children:We&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>se(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:_e.bgSecondary,border:`1px solid ${_e.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${_e.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:_e.textPrimary,fontFamily:"Inter, sans-serif"},children:[Oe.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:_e.textSecondary,fontFamily:"Inter, sans-serif"},children:g==="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:_e.textSecondary,fontFamily:"Inter, sans-serif"},children:[g==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:_e.textPrimary},children:['"',We.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:_e.bgPrimary,borderTop:`1px solid ${_e.border}`},children:[jsx("button",{onClick:()=>se(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:_e.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=_e.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:g==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Ds([We.taskId]),se(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),g==="es"?"Eliminar":"Delete"]})]})]})})}),k?.enabled&&jsx(es,{tasks:ee,theme:_e,config:k,onTasksUpdate:Ke,onTaskUpdate:Gr,onTaskCreate:P=>{Ke(M=>[...M,P]);},onTaskDelete:P=>{Ds([P]);},onDependencyCreate:(P,M)=>{let $=xe.findTaskById(ee,P);$&&Yl($,M);},onDependencyDelete:ql})]})})})});var Ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Yi=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function um({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:u=[],onUploadAttachments:f,onDeleteAttachment:y}){let k=[...Ki,...i.filter(L=>!Ki.some(re=>re.id===L.id))],g=Qe[m]||Qe.dark,[v,h]=useState(false),[p,w]=useState(false),[x,S]=useState(false),[T,C]=useState(false),[A,I]=useState({top:0,left:0}),[N,z]=useState(null),[R,V]=useState(new Date),[ne,ae]=useState({top:0,left:0}),[ie,ke]=useState(false),[Ne,Ae]=useState([]),[F,B]=useState(false),[E,W]=useState(""),J=useRef(null),ue=useRef(null),be=useRef(null),G=useRef(null),he=useRef(null),[j,He]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[de,Be]=useState({});useEffect(()=>{a?(He({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||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&ke(true)):(He({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),ke(false),Ae([]));},[a,e]),useEffect(()=>{let L=re=>{J.current&&!J.current.contains(re.target)&&h(false),ue.current&&!ue.current.contains(re.target)&&w(false),be.current&&!be.current.contains(re.target)&&S(false),G.current&&!G.current.contains(re.target)&&C(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let nt=()=>{let L={};return j.name.trim()||(L.name="El nombre es requerido"),j.startDate&&j.endDate&&j.startDate>j.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),Be(L),Object.keys(L).length===0},st=async L=>{if(L.preventDefault(),!!nt())try{let re=l==="create"&&Ne.length>0?{...j,pendingFiles:Ne}:j;await s(re),Ae([]),t();}catch(re){console.error("Error submitting task:",re);}},Xe=(L,re)=>{He(Te=>{let ze={...Te,[L]:re};if(L==="status"){let Z=re;Z==="todo"?ze.progress=0:Z==="in-progress"?(Te.progress===0||Te.progress===100)&&(ze.progress=50):Z==="completed"||Z==="closed"?ze.progress=100:(Z==="in-review"||Z==="review")&&(ze.progress=75);}if(L==="progress"){let Z=typeof re=="number"?re:parseInt(re,10);Z===100&&Te.status!=="completed"?ze.status="completed":Z>0&&Z<100&&Te.status==="todo"?ze.status="in-progress":Z===0&&Te.status!=="todo"&&(ze.status="todo");}return ze}),de[L]&&Be(Te=>{let ze={...Te};return delete ze[L],ze});},kt=k.find(L=>L.id===j.status)??Ki[0],ct=Yi.find(L=>L.id===j.priority)??Yi[1],$t=Jr.find(L=>L.value===j.color)??Jr[0],ge={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.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 bg-black/60 z-50",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 shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:kt.color||g.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:L=>{L.currentTarget.style.backgroundColor=g.hoverBg,L.currentTarget.style.color=g.textPrimary;},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent",L.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:st,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:j.name,onChange:L=>Xe("name",L.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),de.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),de.name]})]}),jsx("div",{children:jsx("textarea",{value:j.description||"",onChange:L=>Xe("description",L.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:J,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&h(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ge,borderColor:kt.color,backgroundColor:`${kt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:kt.color}}),jsx("span",{style:{color:kt.color},children:kt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:kt.color}})]}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:k.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("status",L.id),h(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,j.status===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},L.id))})})]}),jsxs("div",{ref:ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ge,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsx("span",{children:ct.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:p&&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 shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Yi.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("priority",L.id),w(false);},children:[jsx("span",{children:L.icon}),L.label,j.priority===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},L.id))})})]}),o.length>0&&jsxs("div",{ref:be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&S(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ge,disabled:n,children:[j.assignees&&j.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:j.assignees.slice(0,3).map((L,re)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:L.color||g.accent,borderColor:g.bgSecondary},children:L.initials},re))}),j.assignees.length>3&&jsxs("span",{style:{color:g.textTertiary},children:["+",j.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:x&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(L=>{let re=j.assignees?.some(Te=>Te.name===L.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Te=re?(j.assignees||[]).filter(ze=>ze.name!==L.name):[...j.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(ze=>ze[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Xe("assignees",Te);},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:g.accent},children:L.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:L.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:re&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},L.id)})})})]}),jsxs("div",{ref:G,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)C(false);else {if(G.current){let L=G.current.getBoundingClientRect(),re=window.innerHeight,Te=120,Z=re-L.bottom<Te?L.top-Te-8:L.bottom+8;I({top:Z,left:L.left});}C(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ge,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:j.color}}),jsx("span",{children:$t.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(gt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>C(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:`${A.top}px`,left:`${A.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:L=>L.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Jr.slice(0,18).map(L=>{let re=j.color===L.value;return jsx("button",{type:"button",onClick:Te=>{Te.preventDefault(),Te.stopPropagation(),Xe("color",L.value),C(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:L.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:L.value,outline:re?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),c.length>0||d?jsx(Sr,{selectedTags:j.tags||[],availableTags:c,onChange:L=>Xe("tags",L),onCreateTag:d,theme:g,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{ref:he,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!j.isMilestone)if(N==="start")z(null);else {if(he.current){let L=he.current.getBoundingClientRect(),re=window.innerHeight,Te=320,Z=re-L.bottom<Te?L.top-Te-8:L.bottom+8;ae({top:Z,left:L.left});}z("start"),V(j.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ge,opacity:j.isMilestone?.5:1,cursor:j.isMilestone?"not-allowed":"pointer"},disabled:n||j.isMilestone,children:j.startDate?j.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!j.isMilestone)if(N==="end")z(null);else {if(he.current){let L=he.current.getBoundingClientRect(),re=window.innerHeight,Te=320,Z=re-L.bottom<Te?L.top-Te-8:L.bottom+8;ae({top:Z,left:L.left});}z("end"),V(j.endDate||j.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ge,opacity:j.isMilestone?.5:1,cursor:j.isMilestone?"not-allowed":"pointer"},disabled:n||j.isMilestone,children:j.endDate?j.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:N&&jsxs(gt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>z(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:`${ne.top}px`,left:`${ne.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let L=new Date,re=new Date(L);re.setDate(L.getDate()+1);let Te=new Date(L);Te.setDate(L.getDate()+7);let ze=new Date(L);return ze.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:re},{label:"Pr\xF3xima semana",date:Te},{label:"2 semanas",date:ze}].map((Re,H)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:Y=>Y.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(Xe("startDate",Re.date),(!j.endDate||Re.date>j.endDate)&&Xe("endDate",Re.date),z("end")):(Xe("endDate",Re.date),(!j.startDate||Re.date<j.startDate)&&Xe("startDate",Re.date),z(null));},children:Re.label},H))})(),jsx("div",{style:{borderTop:`1px solid ${g.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:L=>L.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("startDate",void 0),Xe("endDate",void 0),z(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:()=>V(new Date(R.getFullYear(),R.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:R.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>V(new Date(R.getFullYear(),R.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,re)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:L},re))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=R.getFullYear(),re=R.getMonth(),Te=new Date(L,re,1).getDay(),ze=new Date(L,re+1,0).getDate(),Z=new Date,Re=[];for(let Y=Te-1;Y>=0;Y--)Re.push({day:new Date(L,re,-Y).getDate(),date:new Date(L,re-1,new Date(L,re,-Y).getDate()),isCurrentMonth:false});for(let Y=1;Y<=ze;Y++)Re.push({day:Y,date:new Date(L,re,Y),isCurrentMonth:true});let H=42-Re.length;for(let Y=1;Y<=H;Y++)Re.push({day:Y,date:new Date(L,re+1,Y),isCurrentMonth:false});return Re.map((Y,we)=>{let Le=Y.date.toDateString()===Z.toDateString(),Ge=j.startDate?.toDateString()===Y.date.toDateString(),We=j.endDate?.toDateString()===Y.date.toDateString(),se=j.startDate&&j.endDate&&Y.date>=j.startDate&&Y.date<=j.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Y.isCurrentMonth?Ge||We?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:Ge?"#3B82F6":We?"#7C3AED":se?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Le&&!Ge&&!We?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(Xe("startDate",Y.date),j.endDate&&Y.date>j.endDate&&Xe("endDate",Y.date),z("end")):(Xe("endDate",Y.date),j.startDate&&Y.date<j.startDate&&Xe("startDate",Y.date),z(null));},children:Y.day},we)})})()})]})]})]})})]}),de.endDate&&jsx("span",{className:"text-xs text-red-400",children:de.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:j.progress,onChange:L=>Xe("progress",parseInt(L.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:j.progress<30?"#EF4444":j.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:`${j.progress<30?"#EF4444":j.progress<70?"#F59E0B":"#10B981"}20`,color:j.progress<30?"#EF4444":j.progress<70?"#F59E0B":"#10B981"},children:[j.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>ke(!ie),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${ie?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:ie&&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:[(f||u.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.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:g.textTertiary},children:["Adjuntos ",l==="create"?Ne.length>0&&`(${Ne.length})`:u.length>0&&`(${u.length})`]})]}),l==="create"?jsx(dr,{cardId:"pending",attachments:Ne.map((L,re)=>({id:`pending-${re}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>Ae(re=>[...re,...L]),onDelete:L=>{let re=parseInt(L.replace("pending-",""),10);Ae(Te=>Te.filter((ze,Z)=>Z!==re));},maxSizeMB:10,maxFiles:20}):jsx(dr,{cardId:a?.id||"new",attachments:u,onUpload:f&&a?.id?L=>f(a.id,L):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&Ne.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Ne.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 hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:j.isMilestone,onChange:L=>Xe("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:g.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:g.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),j.dependencies&&j.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:j.dependencies.map(L=>{let re=r.find(Te=>Te.id===L);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[re?.name||L.slice(0,8),jsx("button",{type:"button",onClick:()=>{let Te=(j.dependencies||[]).filter(ze=>ze!==L);Xe("dependencies",Te);},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"})})]},L)})}),jsxs("button",{type:"button",onClick:()=>{B(!F),W("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:F&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{B(false),W("");}}),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 shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsx("input",{type:"text",value:E,onChange:L=>W(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(L=>L.id!==a?.id).filter(L=>E===""||L.name.toLowerCase().includes(E.toLowerCase())).map(L=>{let re=j.dependencies?.includes(L.id);return jsxs("button",{type:"button",onClick:()=>{let Te=j.dependencies||[],ze;re?ze=Te.filter(Z=>Z!==L.id):ze=[...Te,L.id],Xe("dependencies",ze);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:re?`${g.accent}10`:"transparent"},onMouseEnter:Te=>{re||(Te.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:Te=>{Te.currentTarget.style.backgroundColor=re?`${g.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:re?g.accent:"transparent",borderColor:re?g.accent:g.borderLight},children:re&&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:g.textPrimary},children:L.name}),jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),r.filter(L=>L.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:L=>L.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:L=>!n&&(L.currentTarget.style.opacity="0.9"),onMouseLeave:L=>!n&&(L.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var gm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
344
|
+
Task dependencies must flow in one direction only.`);return}let $=ae=>ae.map(me=>{if(me.id===M){let ye=me.dependencies||[];if(!ye.includes(P.id))return {...me,dependencies:[...ye,P.id]}}return me.subtasks?{...me,subtasks:$(me.subtasks)}:me});Ye($(ee)),ie?.(P.id,M);},[ee,ie,Kl]),ql=useCallback((P,M)=>{let $=ae=>ae.map(me=>{if(me.id===P&&me.dependencies){let ye=me.dependencies.filter(ht=>ht!==M);return {...me,dependencies:ye}}return me.subtasks?{...me,subtasks:$(me.subtasks)}:me});Ye($(ee)),xe?.(P,M);},[ee,xe]),{startDate:pn,endDate:Fu}=useMemo(()=>{let P=ee.filter(ye=>ye.startDate&&ye.endDate);if(P.length===0){let ye=new Date,ht=new Date(ye);ht.setDate(ht.getDate()-30);let ct=new Date(ye);return ct.setDate(ct.getDate()+60),{startDate:ht,endDate:ct}}let M=P.flatMap(ye=>[ye.startDate,ye.endDate]).filter(ye=>ye!==void 0),$=new Date(Math.min(...M.map(ye=>ye.getTime()))),ae=new Date(Math.max(...M.map(ye=>ye.getTime()))),me=Y==="day"?7:Y==="week"?14:30;return $.setDate($.getDate()-me),ae.setDate(ae.getDate()+me),{startDate:$,endDate:ae}},[ee,Y]),Au=useCallback(async()=>{if(!Qe.current||!Dt.current||!de.current)return;await new Promise(_r=>setTimeout(_r,200));let P=Qe.current,M=Dt.current.querySelector(".gantt-grid-scroll"),$=de.current,ae=M?.scrollTop||0,me=M?.scrollLeft||0,ye=$.scrollTop,ht=$.scrollLeft,ct=P.style.overflow,Ht=P.style.height,fa=M?.style.overflow||"",ha=$.style.overflow,wr=P.style.width,un=$.style.width;try{let _r=M?.querySelector(".gantt-taskgrid-content"),nr=$.querySelector("svg"),Cr=nr?.getAttribute("height")?parseInt(nr.getAttribute("height"),10):nr?.getBoundingClientRect().height||0,po=_r?.scrollHeight||M?.scrollHeight||600,Vr=Math.max(Cr,$.scrollHeight),Zl=nr?.getAttribute("width")?parseInt(nr.getAttribute("width"),10):nr?.getBoundingClientRect().width||$.scrollWidth,$u=P.querySelector('[class*="h-12"]')?.offsetHeight||48,Ps=Math.max(po,Vr,Cr),Ms=$u+Ps+50,Fs=(M?.offsetWidth||300)+Zl+10;M&&(M.scrollTop=0,M.scrollLeft=0),$.scrollTop=0,$.scrollLeft=0,P.style.overflow="visible",P.style.height=`${Ms}px`,P.style.width=`${Fs}px`,M&&(M.style.overflow="visible",M.style.height=`${Ps+50}px`),$.style.overflow="visible",$.style.height=`${Ps+50}px`,$.style.width=`${Zl+10}px`,await new Promise(Ls=>setTimeout(Ls,150));let Hu=await lm(P,{backgroundColor:Ve.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:Fs,height:Ms,windowWidth:Fs+100,windowHeight:Ms+100,scrollX:0,scrollY:0,ignoreElements:Ls=>{let Ql=window.getComputedStyle(Ls),ed=parseInt(Ql.zIndex,10);return !isNaN(ed)&&ed>=50||Ql.position==="fixed"}}),As=document.createElement("a");As.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,As.href=Hu.toDataURL("image/png"),As.click();}finally{P.style.overflow=ct,P.style.height=Ht,P.style.width=wr,M&&(M.style.overflow=fa,M.style.height="",M.scrollTop=ae,M.scrollLeft=me),$.style.overflow=ha,$.style.height="",$.style.width=un,$.scrollTop=ye,$.scrollLeft=ht;}},[Ve]),Lu=useCallback(async()=>{await ve.exportToPDF(ee);},[ee]),Iu=useCallback(async()=>{await ve.exportToExcel(ee);},[ee]),Bu=useCallback(()=>{let P=ve.exportToCSV(ee),M=new Blob([P],{type:"text/csv;charset=utf-8;"}),$=document.createElement("a");$.href=URL.createObjectURL(M),$.download="gantt-chart.csv",$.click(),URL.revokeObjectURL($.href);},[ee]),Ru=useCallback(()=>{let P=ve.exportToJSON(ee),M=new Blob([P],{type:"application/json;charset=utf-8;"}),$=document.createElement("a");$.href=URL.createObjectURL(M),$.download="gantt-chart.json",$.click(),URL.revokeObjectURL($.href);},[ee]),Ou=useCallback(()=>{ve.exportToMSProject(ee,"Gantt Project","project.xml");},[ee]),zu=P=>{P.preventDefault(),Z(true);},mo=useRef(false),[Es,Xl]=useState(false),Bo=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=de.current,M=Dt.current?.querySelector(".gantt-grid-scroll");if(!P||!M)return;let $=()=>{if(mo.current)return;mo.current=true;let ct=P.scrollTop;Te(ct),M.scrollTop=ct,requestAnimationFrame(()=>{mo.current=false;});},ae=()=>{if(mo.current)return;mo.current=true;let ct=M.scrollTop;Te(ct),P.scrollTop=ct,requestAnimationFrame(()=>{mo.current=false;});},me=ct=>{if(Ue&&M){let fa=M.parentElement?.getBoundingClientRect()?.left||0,ha=ct.clientX-fa,wr=200,un=Q+Xe,_r=window.innerWidth*Ft,nr=Math.max(un,_r);ha>=wr&&ha<=nr&&H(ha);}if(Es&&P){let Ht=ct.clientX-Bo.current.x,fa=ct.clientY-Bo.current.y;P.scrollLeft=Bo.current.scrollLeft-Ht,P.scrollTop=Bo.current.scrollTop-fa;}},ye=()=>{Z(false),Xl(false);},ht=ct=>{if(ct.button!==0)return;let Ht=ct.target;Ht.closest("[data-task-bar]")||Ht.closest("[data-dependency-line]")||Ht.closest("button")||Ht.closest('[role="button"]')||Ht.tagName==="rect"&&Ht.getAttribute("data-clickable")==="true"||(Xl(true),Bo.current={x:ct.clientX,y:ct.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},ct.preventDefault());};return P.addEventListener("scroll",$),M.addEventListener("scroll",ae),P.addEventListener("mousedown",ht),document.addEventListener("mousemove",me),document.addEventListener("mouseup",ye),()=>{P.removeEventListener("scroll",$),M.removeEventListener("scroll",ae),P.removeEventListener("mousedown",ht),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",ye);}},[Ue,Es,Q]);let Jl=useRef(false),Uu=useRef(null);return useLayoutEffect(()=>{if(Jl.current||ee.length===0||!de.current)return;Jl.current=true,Uu.current=pn;let P=de.current,M=new Date,$=Y==="day"?60:Y==="week"?20:8,ae=(M.getTime()-pn.getTime())/(1e3*60*60*24),me=P.clientWidth,ht=ae*$*Le-me/2;ae>=0&&me>0&&(P.scrollLeft=Math.max(0,ht));},[ee.length,pn,Y,Le]),jsx(To.Provider,{value:ze,children:jsx(zs.Provider,{value:ar,children:jsxs("div",{ref:Qe,className:"flex flex-col h-full w-full",style:{backgroundColor:Ve.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx($n,{theme:Ve,timeScale:Y,onTimeScaleChange:V,zoom:Le,onZoomChange:Je,currentTheme:be,onThemeChange:Be,rowDensity:Oe,onRowDensityChange:pe,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:p,onCreateTask:w,taskFilter:ut,onTaskFilterChange:Pt,hideCompleted:ge,onHideCompletedChange:L,onExportPNG:i?Au:void 0,onExportPDF:i?Lu:void 0,onExportExcel:i?Iu:void 0,onExportCSV:i?Bu:void 0,onExportJSON:i?Ru:void 0,onExportMSProject:i?Ou:void 0}),jsxs("div",{ref:Dt,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Zt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(_n,{tasks:rr,theme:Ve,rowHeight:or,availableUsers:c,templates:Lo,onTaskClick:C,onTaskDblClick:jl,onTaskContextMenu:I,onTaskToggle:Ns,scrollTop:re,columns:le,onToggleColumn:Kt,onColumnResize:Ts,onTaskUpdate:Gr,onTaskIndent:Io,onTaskOutdent:wu,onTaskMove:Tu,onMultiTaskDelete:Ds,onTaskDuplicate:Nu,onTaskCreate:Du,onTaskRename:Su,onCreateSubtask:Ss,onOpenTaskModal:C?P=>C(P):void 0,onDeleteRequest:(P,M)=>ne({taskId:P,taskName:M}),onTaskReparent:Cu})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Ve.border,zIndex:15},onMouseDown:zu}),jsx("div",{ref:de,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Es?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Qn,{tasks:rr,theme:Ve,rowHeight:or,timeScale:Y,startDate:pn,endDate:Fu,zoom:Le,locale:g,templates:Lo,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:C,onTaskDblClick:jl,onTaskContextMenu:Pu,onTaskDateChange:Eu,onDependencyCreate:Yl,onDependencyDelete:ql})})]}),K.task&&jsx(No,{isOpen:K.isOpen,x:K.x,y:K.y,theme:Ve,onClose:()=>ke({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=K.task;if(!P)return [];let M=ve.findTaskById(ee,P.id)||P;return M.subtasks&&M.subtasks.length>0?[{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{_?_(M):Ss(M.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{ne({taskId:M.id,taskName:M.name});}}]:[{id:"edit",label:ze.contextMenu?.editTask||"Edit Task",icon:Ot.Pencil,onClick:()=>{R?R(M):_e(M);}},{id:"addSubtask",label:ze.contextMenu?.addSubtask||"Add Subtask",icon:Ot.Add,onClick:()=>{_?_(M):Ss(M.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ze.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ot.MarkIncomplete,onClick:()=>{se?se(M):Gr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"},{id:"setInProgress",label:ze.contextMenu?.setInProgress||"Set In Progress",icon:Ot.SetInProgress,onClick:()=>{te?te(M):Gr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"},{id:"markComplete",label:ze.contextMenu?.markComplete||"Mark Complete",icon:Ot.MarkComplete,onClick:()=>{Gr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ze.contextMenu?.splitTask||"Split Task",icon:Ot.Split,onClick:()=>{if(!M.startDate||!M.endDate){console.warn("Cannot split task without dates");return}let ae=M.startDate.getTime(),me=M.endDate.getTime(),ye=ae+(me-ae)/2,ht=new Date(ye);Mu(M,ht);},disabled:!M.startDate||!M.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ze.contextMenu?.deleteTask||"Delete Task",icon:Ot.Delete,onClick:()=>{ne({taskId:M.id,taskName:M.name});}}]})()}),jsx(fr,{task:Ie,isOpen:!!Ie,onClose:()=>_e(null),onTaskUpdate:P=>{Ie&&(Gr(Ie.id,P),_e(null));},theme:be==="light"?"light":"dark",locale:g==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsx(AnimatePresence,{children:We&&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:()=>ne(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Ve.bgSecondary,border:`1px solid ${Ve.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Ve.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:Ve.textPrimary,fontFamily:"Inter, sans-serif"},children:[ze.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Ve.textSecondary,fontFamily:"Inter, sans-serif"},children:g==="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:Ve.textSecondary,fontFamily:"Inter, sans-serif"},children:[g==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Ve.textPrimary},children:['"',We.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Ve.bgPrimary,borderTop:`1px solid ${Ve.border}`},children:[jsx("button",{onClick:()=>ne(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Ve.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Ve.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:g==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Ds([We.taskId]),ne(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),g==="es"?"Eliminar":"Delete"]})]})]})})}),k?.enabled&&jsx(es,{tasks:ee,theme:Ve,config:k,onTasksUpdate:Ye,onTaskUpdate:Gr,onTaskCreate:P=>{Ye(M=>[...M,P]);},onTaskDelete:P=>{Ds([P]);},onDependencyCreate:(P,M)=>{let $=ve.findTaskById(ee,P);$&&Yl($,M);},onDependencyDelete:ql})]})})})});var Ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Yi=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function um({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:u=[],onUploadAttachments:f,onDeleteAttachment:y}){let k=[...Ki,...i.filter(L=>!Ki.some(re=>re.id===L.id))],g=et[m]||et.dark,[v,h]=useState(false),[p,w]=useState(false),[x,S]=useState(false),[T,C]=useState(false),[A,I]=useState({top:0,left:0}),[N,z]=useState(null),[R,_]=useState(new Date),[se,te]=useState({top:0,left:0}),[ie,xe]=useState(false),[Ne,Ae]=useState([]),[F,B]=useState(false),[E,W]=useState(""),J=useRef(null),ue=useRef(null),be=useRef(null),Ce=useRef(null),Y=useRef(null),[V,Oe]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[pe,Le]=useState({});useEffect(()=>{a?(Oe({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||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&xe(true)):(Oe({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),xe(false),Ae([]));},[a,e]),useEffect(()=>{let L=re=>{J.current&&!J.current.contains(re.target)&&h(false),ue.current&&!ue.current.contains(re.target)&&w(false),be.current&&!be.current.contains(re.target)&&S(false),Ce.current&&!Ce.current.contains(re.target)&&C(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let Je=()=>{let L={};return V.name.trim()||(L.name="El nombre es requerido"),V.startDate&&V.endDate&&V.startDate>V.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),Le(L),Object.keys(L).length===0},st=async L=>{if(L.preventDefault(),!!Je())try{let re=l==="create"&&Ne.length>0?{...V,pendingFiles:Ne}:V;await s(re),Ae([]),t();}catch(re){console.error("Error submitting task:",re);}},Ge=(L,re)=>{Oe(Te=>{let Ue={...Te,[L]:re};if(L==="status"){let Z=re;Z==="todo"?Ue.progress=0:Z==="in-progress"?(Te.progress===0||Te.progress===100)&&(Ue.progress=50):Z==="completed"||Z==="closed"?Ue.progress=100:(Z==="in-review"||Z==="review")&&(Ue.progress=75);}if(L==="progress"){let Z=typeof re=="number"?re:parseInt(re,10);Z===100&&Te.status!=="completed"?Ue.status="completed":Z>0&&Z<100&&Te.status==="todo"?Ue.status="in-progress":Z===0&&Te.status!=="todo"&&(Ue.status="todo");}return Ue}),pe[L]&&Le(Te=>{let Ue={...Te};return delete Ue[L],Ue});},bt=k.find(L=>L.id===V.status)??Ki[0],ut=Yi.find(L=>L.id===V.priority)??Yi[1],Pt=Jr.find(L=>L.value===V.color)??Jr[0],ge={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.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 bg-black/60 z-50",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 shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:bt.color||g.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:L=>{L.currentTarget.style.backgroundColor=g.hoverBg,L.currentTarget.style.color=g.textPrimary;},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent",L.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:st,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:V.name,onChange:L=>Ge("name",L.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),pe.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),pe.name]})]}),jsx("div",{children:jsx("textarea",{value:V.description||"",onChange:L=>Ge("description",L.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:J,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&h(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ge,borderColor:bt.color,backgroundColor:`${bt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:bt.color}}),jsx("span",{style:{color:bt.color},children:bt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:bt.color}})]}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:k.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("status",L.id),h(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,V.status===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},L.id))})})]}),jsxs("div",{ref:ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ge,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ut.color}}),jsx("span",{children:ut.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:p&&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 shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Yi.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("priority",L.id),w(false);},children:[jsx("span",{children:L.icon}),L.label,V.priority===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},L.id))})})]}),o.length>0&&jsxs("div",{ref:be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&S(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ge,disabled:n,children:[V.assignees&&V.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:V.assignees.slice(0,3).map((L,re)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:L.color||g.accent,borderColor:g.bgSecondary},children:L.initials},re))}),V.assignees.length>3&&jsxs("span",{style:{color:g.textTertiary},children:["+",V.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:x&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(L=>{let re=V.assignees?.some(Te=>Te.name===L.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Te=re?(V.assignees||[]).filter(Ue=>Ue.name!==L.name):[...V.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(Ue=>Ue[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Ge("assignees",Te);},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:g.accent},children:L.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:L.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:re&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},L.id)})})})]}),jsxs("div",{ref:Ce,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)C(false);else {if(Ce.current){let L=Ce.current.getBoundingClientRect(),re=window.innerHeight,Te=120,Z=re-L.bottom<Te?L.top-Te-8:L.bottom+8;I({top:Z,left:L.left});}C(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ge,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:V.color}}),jsx("span",{children:Pt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(gt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>C(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:`${A.top}px`,left:`${A.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:L=>L.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Jr.slice(0,18).map(L=>{let re=V.color===L.value;return jsx("button",{type:"button",onClick:Te=>{Te.preventDefault(),Te.stopPropagation(),Ge("color",L.value),C(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:L.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:L.value,outline:re?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),c.length>0||d?jsx(Sr,{selectedTags:V.tags||[],availableTags:c,onChange:L=>Ge("tags",L),onCreateTag:d,theme:g,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{ref:Y,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!V.isMilestone)if(N==="start")z(null);else {if(Y.current){let L=Y.current.getBoundingClientRect(),re=window.innerHeight,Te=320,Z=re-L.bottom<Te?L.top-Te-8:L.bottom+8;te({top:Z,left:L.left});}z("start"),_(V.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ge,opacity:V.isMilestone?.5:1,cursor:V.isMilestone?"not-allowed":"pointer"},disabled:n||V.isMilestone,children:V.startDate?V.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!V.isMilestone)if(N==="end")z(null);else {if(Y.current){let L=Y.current.getBoundingClientRect(),re=window.innerHeight,Te=320,Z=re-L.bottom<Te?L.top-Te-8:L.bottom+8;te({top:Z,left:L.left});}z("end"),_(V.endDate||V.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ge,opacity:V.isMilestone?.5:1,cursor:V.isMilestone?"not-allowed":"pointer"},disabled:n||V.isMilestone,children:V.endDate?V.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:N&&jsxs(gt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>z(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:`${se.top}px`,left:`${se.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let L=new Date,re=new Date(L);re.setDate(L.getDate()+1);let Te=new Date(L);Te.setDate(L.getDate()+7);let Ue=new Date(L);return Ue.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:re},{label:"Pr\xF3xima semana",date:Te},{label:"2 semanas",date:Ue}].map((Re,H)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(Ge("startDate",Re.date),(!V.endDate||Re.date>V.endDate)&&Ge("endDate",Re.date),z("end")):(Ge("endDate",Re.date),(!V.startDate||Re.date<V.startDate)&&Ge("startDate",Re.date),z(null));},children:Re.label},H))})(),jsx("div",{style:{borderTop:`1px solid ${g.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:L=>L.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("startDate",void 0),Ge("endDate",void 0),z(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:()=>_(new Date(R.getFullYear(),R.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:R.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>_(new Date(R.getFullYear(),R.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,re)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:L},re))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=R.getFullYear(),re=R.getMonth(),Te=new Date(L,re,1).getDay(),Ue=new Date(L,re+1,0).getDate(),Z=new Date,Re=[];for(let K=Te-1;K>=0;K--)Re.push({day:new Date(L,re,-K).getDate(),date:new Date(L,re-1,new Date(L,re,-K).getDate()),isCurrentMonth:false});for(let K=1;K<=Ue;K++)Re.push({day:K,date:new Date(L,re,K),isCurrentMonth:true});let H=42-Re.length;for(let K=1;K<=H;K++)Re.push({day:K,date:new Date(L,re+1,K),isCurrentMonth:false});return Re.map((K,ke)=>{let Ie=K.date.toDateString()===Z.toDateString(),_e=V.startDate?.toDateString()===K.date.toDateString(),We=V.endDate?.toDateString()===K.date.toDateString(),ne=V.startDate&&V.endDate&&K.date>=V.startDate&&K.date<=V.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:K.isCurrentMonth?_e||We?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:_e?"#3B82F6":We?"#7C3AED":ne?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ie&&!_e&&!We?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(Ge("startDate",K.date),V.endDate&&K.date>V.endDate&&Ge("endDate",K.date),z("end")):(Ge("endDate",K.date),V.startDate&&K.date<V.startDate&&Ge("startDate",K.date),z(null));},children:K.day},ke)})})()})]})]})]})})]}),pe.endDate&&jsx("span",{className:"text-xs text-red-400",children:pe.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:V.progress,onChange:L=>Ge("progress",parseInt(L.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:V.progress<30?"#EF4444":V.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:`${V.progress<30?"#EF4444":V.progress<70?"#F59E0B":"#10B981"}20`,color:V.progress<30?"#EF4444":V.progress<70?"#F59E0B":"#10B981"},children:[V.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>xe(!ie),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${ie?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:ie&&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:[(f||u.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.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:g.textTertiary},children:["Adjuntos ",l==="create"?Ne.length>0&&`(${Ne.length})`:u.length>0&&`(${u.length})`]})]}),l==="create"?jsx(dr,{cardId:"pending",attachments:Ne.map((L,re)=>({id:`pending-${re}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>Ae(re=>[...re,...L]),onDelete:L=>{let re=parseInt(L.replace("pending-",""),10);Ae(Te=>Te.filter((Ue,Z)=>Z!==re));},maxSizeMB:10,maxFiles:20}):jsx(dr,{cardId:a?.id||"new",attachments:u,onUpload:f&&a?.id?L=>f(a.id,L):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&Ne.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[Ne.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 hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:V.isMilestone,onChange:L=>Ge("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:g.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:g.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),V.dependencies&&V.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:V.dependencies.map(L=>{let re=r.find(Te=>Te.id===L);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[re?.name||L.slice(0,8),jsx("button",{type:"button",onClick:()=>{let Te=(V.dependencies||[]).filter(Ue=>Ue!==L);Ge("dependencies",Te);},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"})})]},L)})}),jsxs("button",{type:"button",onClick:()=>{B(!F),W("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:F&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{B(false),W("");}}),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 shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsx("input",{type:"text",value:E,onChange:L=>W(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(L=>L.id!==a?.id).filter(L=>E===""||L.name.toLowerCase().includes(E.toLowerCase())).map(L=>{let re=V.dependencies?.includes(L.id);return jsxs("button",{type:"button",onClick:()=>{let Te=V.dependencies||[],Ue;re?Ue=Te.filter(Z=>Z!==L.id):Ue=[...Te,L.id],Ge("dependencies",Ue);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:re?`${g.accent}10`:"transparent"},onMouseEnter:Te=>{re||(Te.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:Te=>{Te.currentTarget.style.backgroundColor=re?`${g.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:re?g.accent:"transparent",borderColor:re?g.accent:g.borderLight},children:re&&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:g.textPrimary},children:L.name}),jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),r.filter(L=>L.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:L=>L.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:L=>!n&&(L.currentTarget.style.opacity="0.9"),onMouseLeave:L=>!n&&(L.currentTarget.style.opacity="1"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var gm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
345
345
|
|
|
346
346
|
AVAILABLE COMMANDS:
|
|
347
347
|
1. move_task - Move a task to a different date
|
|
@@ -386,7 +386,7 @@ If ambiguous, ask for clarification in the message field.`;function fm(e){return
|
|
|
386
386
|
${bm(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(`
|
|
387
387
|
`)}
|
|
388
388
|
|
|
389
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function bm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function xr(e,t){let a=bm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let m=l.name.toLowerCase();return n.every(i=>m.includes(i))})}function qi(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 u=new Date(r);return u.setDate(u.getDate()+1),u}if(a==="yesterday"||a==="ayer"){let u=new Date(r);return u.setDate(u.getDate()-1),u}if(a==="next week"||a==="la pr\xF3xima semana"){let u=new Date(r);return u.setDate(u.getDate()+7),u}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 f={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(f!==void 0){let y=new Date(r),k=y.getDay(),g=f-k;return g<=0&&(g+=7),y.setDate(y.getDate()+g),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),f=s[2].toLowerCase(),y=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?y.setDate(y.getDate()+u):f==="week"||f==="semana"||f==="semanas"?y.setDate(y.getDate()+u*7):(f==="month"||f==="mes"||f==="meses")&&y.setMonth(y.getMonth()+u),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let u=parseInt(l[1],10),f=parseInt(l[2],10)-1,y=parseInt(l[3],10);return new Date(y,f,u)}let m={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 u=parseInt(i[1],10),f=m[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(y,f,u)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let u=c[d[1].toLowerCase()],f=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,f)}return null}function Xi(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 Ji(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 hm(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 ym(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),c=r[2].trim(),d=xr(t,i),u=qi(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(u);return y.setDate(y.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:u,endDate:y},message:`Moved "${d.name}" to ${u.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),d=xr(t,i),u=Xi(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+u),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${u} days. New end date: ${f.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),d=xr(t,i),u=Ji(c);return d?u===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:u},message:`Set "${d.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),d=xr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=xr(t,i),u=xr(t,c);return d?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:d.id,dependencyTo:u.id,message:`Linked "${d.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),c=xr(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function vm(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 B0(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 R0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function rs(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(u=>u.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>rs(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},l=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||l&&m&&Math.abs(m.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:m,progress:e.progress||0,status:B0(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 xm(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:R0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function km(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>rs(r,e,t))}var Zi={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",elapsedTime:"Time Spent",tags:"Tags"},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"}},Qi={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",elapsedTime:"Tiempo",tags:"Etiquetas"},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"}},os={en:Zi,es:Qi};function el(e){return os[e]||os.en}function ns(e,t){let a=el(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 tl=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function wm(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 Cm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let f=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let m=wm(e),i=tl[0],c=tl.find(f=>f.value===m)??i,d=c.icon,u=f=>{switch(wm(f)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:b("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:b("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:u(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(d,{className:b("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:b("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:u(e)}),jsx(ChevronDown,{className:b("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:b("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:tl.map(f=>{let y=f.icon;return jsxs("button",{onClick:k=>{k.stopPropagation(),t(f.value),n(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",m===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(y,{className:b("w-4 h-4",f.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u(f.value)})]},f.value)})})]})}var al=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Nm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=al.find(c=>c.value===e)??al[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:b("w-4 h-4",m.color)}),jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:b("w-4 h-4",m.color)}),jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsx(ChevronDown,{className:b("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:b("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:al.map(c=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:b("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function ls(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ds(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Sm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=useState(false),[m,i]=useState(""),c=useRef(null);useEffect(()=>{let y=k=>{c.current&&!c.current.contains(k.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]);let d=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())||y.email?.toLowerCase().includes(m.toLowerCase())),u=y=>e.some(k=>k.name===y),f=y=>{if(a)if(u(y.name))a(e.filter(k=>k.name!==y.name));else {let k={name:y.name,initials:ls(y.name),color:y.color||ds(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl};a([...e,k]);}};return s||!a?e.length===0?jsx("span",{className:b("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((y,k)=>jsx("div",{className:b("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!y.avatar&&ds(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||ls(y.name)},`${y.name}-${k}`)),e.length>3&&jsxs("div",{className:b("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:c,className:"relative",children:[jsx("button",{onClick:y=>{y.stopPropagation(),l(!n);},className:b("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:b("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:b("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((y,k)=>jsx("div",{className:b("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!y.avatar&&ds(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||ls(y.name)},`${y.name}-${k}`)),e.length>2&&jsxs("span",{className:b("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:b("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:b("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:y=>y.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:d.length===0?jsx("p",{className:b("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):d.map(y=>jsxs("button",{onClick:k=>{k.stopPropagation(),f(y);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:b("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!y.avatarUrl&&ds(y.name)),children:y.avatarUrl?jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):ls(y.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:y.name}),y.email&&jsx("div",{className:b("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:y.email})]}),u(y.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},y.id))}),e.length>0&&jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((y,k)=>jsxs("span",{className:b("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[y.name,jsx("button",{onClick:g=>{g.stopPropagation(),a(e.filter(v=>v.name!==y.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${y.name}-${k}`))})]})]})}var sy={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},iy={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function cs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(()=>{if(e){let g=e instanceof Date?e:new Date(e);return new Date(g.getFullYear(),g.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=useRef(null),c=e?e instanceof Date?e:new Date(e):null,d=r==="es"?"es":"en";useEffect(()=>{let g=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=g=>g?g.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",f=(g,v)=>new Date(g,v+1,0).getDate(),y=(g,v)=>new Date(g,v,1).getDay(),k=()=>{let g=l.getFullYear(),v=l.getMonth(),h=f(g,v),p=y(g,v),w=new Date,x=[];for(let S=0;S<p;S++)x.push(jsx("div",{className:"w-8 h-8"},`empty-${S}`));for(let S=1;S<=h;S++){let T=new Date(g,v,S),C=c&&c.getDate()===S&&c.getMonth()===v&&c.getFullYear()===g,A=w.getDate()===S&&w.getMonth()===v&&w.getFullYear()===g;x.push(jsx("button",{onClick:I=>{I.stopPropagation(),t?.(T),n(false);},className:b("w-8 h-8 rounded-full text-sm transition-colors",C?"bg-[#3B82F6] text-white":A?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:S},S));}return x};return o||!t?jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:b("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)})]}),s&&jsxs("div",{className:b("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(l.getFullYear(),l.getMonth()-1,1));},className:b("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:b("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxs("span",{className:b("text-sm font-medium",a?"text-white":"text-gray-900"),children:[sy[d][l.getMonth()]," ",l.getFullYear()]}),jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(l.getFullYear(),l.getMonth()+1,1));},className:b("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:b("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:iy[d].map(g=>jsx("div",{className:b("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:g},g))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:k()}),jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsx("button",{onClick:g=>{g.stopPropagation(),t?.(new Date),n(false);},className:b("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsx("button",{onClick:g=>{g.stopPropagation();let v=new Date;v.setDate(v.getDate()+1),t?.(v),n(false);},className:b("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Fm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),l=s.clientX-n.left,m=Math.round(l/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:b("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:b("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxs("span",{className:b("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Im({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{m(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=u=>{u.key==="Enter"?c():u.key==="Escape"&&(m(e),n(false));};return o||!t?jsx("span",{className:b("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:u=>m(u.target.value),onBlur:c,onKeyDown:d,onClick:u=>u.stopPropagation(),className:b("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:u=>{u.stopPropagation(),n(true);},className:b("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Om({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[l,m]=useState(false),[i,c]=useState(e?.toString()||""),d=useRef(null);useEffect(()=>{l&&d.current&&(d.current.focus(),d.current.select());},[l]),useEffect(()=>{c(e?.toString()||"");},[e]);let u=()=>{let y=parseFloat(i);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);}m(false);},f=y=>{y.key==="Enter"?u():y.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):l?jsx("input",{ref:d,type:"number",value:i,onChange:y=>c(y.target.value),onBlur:u,onKeyDown:f,onClick:y=>y.stopPropagation(),min:o,max:s,className:b("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:y=>{y.stopPropagation(),m(true);},className:b("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function zm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),m=useRef(null);return useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:b("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("span",{className:b("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:b("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsx("div",{className:b("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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:b("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:b("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"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-[#3B82F6]"})]},i))})]})}function $m({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:b("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsx(Check,{className:"w-3 h-3 text-white"})})}function Gm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:b("text-sm",t?"text-[#6B7280]":"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-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:b("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function hy(e,t="en"){if(e==null||e===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?t==="es"?`${r}min`:`${r}m`:r===0?`${a}h`:t==="es"?`${a}h ${r}min`:`${a}h ${r}m`}function yy(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a){let l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r){let l=parseFloat(r[1]),m=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+m}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o)return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)?$/);if(s)return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n)}function sl({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false}){let [n,l]=useState(false),[m,i]=useState(""),c=useRef(null),u=hy(e,r);useEffect(()=>{n&&c.current&&(c.current.focus(),c.current.select());},[n]),useEffect(()=>{if(e){let k=Math.floor(e/60),g=e%60;k>0&&g>0?i(`${k}h ${g}m`):k>0?i(`${k}h`):i(`${g}m`);}else i("");},[e,n]);let f=()=>{let k=yy(m);k!==e&&t?.(k),l(false);},y=k=>{k.key==="Enter"?f():k.key==="Escape"&&l(false);};return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e&&e>0&&jsx(Clock,{className:b("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:u})]}):n?jsx("input",{ref:c,type:"text",value:m,onChange:k=>i(k.target.value),onBlur:f,onKeyDown:y,onClick:k=>k.stopPropagation(),placeholder:"1h 30m",className:b("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:k=>{k.stopPropagation(),l(true);},className:b("flex items-center gap-1.5 text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400"),children:[e&&e>0&&jsx(Clock,{className:b("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{children:u})]})}function Ay(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ly(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 Jm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let d=useRef(null),u=r==="es"?qm.es:qm.en;if(useEffect(()=>{let v=p=>{d.current&&!d.current.contains(p.target)&&t();},h=p=>{p.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:u.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),l&&(v.push({id:"status",label:u.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:u.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:u.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:u.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:u.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:u.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:u.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:u.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let p=e.task.assignees||[],x=p.some(S=>S.name===h.name)?p.filter(S=>S.name!==h.name):[...p,{name:h.name,initials:Ay(h.name),color:h.color||Ly(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:x}),t();}}))})),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:u.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:u.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},y=()=>{if(!e.columnId)return [];let v=[];return i&&(v.push({id:"sort-asc",label:u.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:u.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:u.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),v},k=e.type==="task"?f():y(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:d,style:g,className:b("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:k.map(v=>v.separator?jsx("div",{className:b("my-1 h-px",a?"bg-white/10":"bg-gray-200")},v.id):v.submenu?jsx(Iy,{item:v,isDark:a},v.id):jsxs("button",{onClick:v.onClick,className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:b(v.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Iy({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:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:b("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:b("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var qm={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"},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"}};var ep={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"}),elapsedTime:jsx(Timer,{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"})},Zy=["name","status","priority","assignees","startDate","endDate","progress","tags","estimatedTime","elapsedTime"];function ap({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[m,i]=useState(""),c=useRef(null),d=l==="es"?tp.es:tp.en;if(useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let h=w=>{c.current&&!c.current.contains(w.target)&&t();},p=w=>{w.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",p),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let u=v=>d.columns[v]||v,f=v=>{if(v==="name")return;let h=a.map(p=>p.id===v?{...p,visible:!p.visible}:p);o(h);},y=(v,h)=>{let p=a.find(x=>x.type===v&&(!h||x.customFieldId===h));if(p){f(p.id);return}let w={id:h||v,type:v,label:h?r.find(x=>x.id===h)?.name||v:u(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,w]);},k=Zy.filter(v=>u(v).toLowerCase().includes(m.toLowerCase())),g=r.filter(v=>v.name.toLowerCase().includes(m.toLowerCase()));return jsxs("div",{ref:c,className:b("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:b("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:b("font-medium",n?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:b("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:b("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:b("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:m,onChange:v=>i(v.target.value),placeholder:d.searchPlaceholder,className:b("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:b("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.standardFields}),jsx("div",{className:"space-y-1",children:k.map(v=>{let h=a.find(x=>x.type===v&&!x.customFieldId),p=h?.visible??false,w=v==="name";return jsxs("button",{onClick:()=>{w||(h?f(h.id):y(v));},disabled:w,className:b("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",w&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:b("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:ep[v]}),jsx("span",{className:n?"text-white":"text-gray-900",children:u(v)})]},v)})})]}),g.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:b("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.customFields}),jsx("div",{className:"space-y-1",children:g.map(v=>{let p=a.find(w=>w.customFieldId===v.id)?.visible??false;return jsxs("button",{onClick:()=>y(v.type,v.id),className:b("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:b("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:ep[v.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:v.name})]},v.id)})})]}),s&&jsx("div",{className:b("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:s,className:b("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.createField]})})]})}var tp={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",elapsedTime:"Time Spent",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",elapsedTime:"Tiempo",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var iv=[{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 np({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[l,m]=useState("text"),[i,c]=useState([""]),d=o==="es"?op.es:op.en;useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),useEffect(()=>{let g=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let u=()=>{if(!s.trim())return;let g={name:s.trim(),type:l};l==="dropdown"&&(g.options=i.filter(v=>v.trim())),a(g),t();},f=()=>{c([...i,""]);},y=(g,v)=>{let h=[...i];h[g]=v,c(h);},k=g=>{i.length>1&&c(i.filter((v,h)=>h!==g));};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:b("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:b("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsx("h2",{className:b("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:b("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:b("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:b("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:d.fieldNamePlaceholder,className:b("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:b("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:iv.map(g=>jsxs("button",{onClick:()=>m(g.type),className:b("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsx("span",{className:b("text-xs",l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[g.type]})]},g.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:b("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((g,v)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:g,onChange:h=>y(v,h.target.value),placeholder:`${d.option} ${v+1}`,className:b("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>k(v),className:b("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},v)),jsxs("button",{onClick:f,className:b("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:b("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:b("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:u,disabled:!s.trim(),className:b("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var op={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 lp={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 dp({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=useState(false),m=useRef(null),i=useRef(0),c=s==="es"?lp.es:lp.en;useEffect(()=>{if(!n)return;let f=k=>{Date.now()-i.current<100||m.current&&!m.current.contains(k.target)&&l(false);},y=k=>{k.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(y=>!y);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),c.filters,u&&jsx("span",{className:b("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxs("div",{className:b("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:b("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsx("span",{className:b("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(f=>{let y=e===f.value&&!t,k=()=>f.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxs("button",{onClick:()=>{a(f.value),r(false),l(false);},className:b("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:b(y?f.color:"text-gray-400","flex-shrink-0"),children:k()}),jsx("span",{className:b("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),y&&jsx(Check,{className:b("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsx("div",{className:b("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),l(false);},className:b("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsx(EyeOff,{className:b("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:b("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var Tv=[{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 gp(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(...gp(r.subtasks,t+1));return a}function Nv({status:e,progress:t}){return t===100||e==="completed"?jsx(CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsx(PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsx(Circle,{className:"w-5 h-5 text-gray-400"})}function fp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:d,showSearch:u=true,showHierarchy:f=true,tableColumns:y,allowColumnCustomization:k=true,allowColumnResize:g=true,enableContextMenu:v=true,showCreateTaskButton:h=false,onCreateTask:p}=t,w=ns(c,d),x=i==="dark",[S,T]=useState("startDate"),[C,A]=useState("asc"),[I,N]=useState(""),[z,R]=useState("all"),[V,ne]=useState(false),[ae,ie]=useState(y||Tv),[ke,Ne]=useState(false),[Ae,F]=useState(false),[B,E]=useState({isOpen:false,x:0,y:0,type:"task"}),[W,J]=useState(null),[ue,be]=useState(0),[G,he]=useState(0),j=useRef(null);useEffect(()=>{y&&ie(y);},[y]);let He=useMemo(()=>{let H=new Set;function Y(we){for(let Le of we)Le.subtasks?.length&&(Le.isExpanded!==false&&H.add(Le.id),Y(Le.subtasks));}return Y(e),H},[e]),de=useMemo(()=>ae.filter(H=>H.visible),[ae]),Be=useCallback(H=>{a.onTaskToggleExpand?.(H);},[a]),nt=useCallback(H=>{S===H?A(Y=>Y==="asc"?"desc":"asc"):(T(H),A("asc")),a.onSortChange?.({column:H,direction:C==="asc"?"desc":"asc"});},[S,C,a]),st=useCallback(H=>{ie(H),a.onColumnsChange?.(H);},[a]),Xe=useCallback(H=>{let Y=ae.map(we=>we.id===H?{...we,visible:false}:we);st(Y);},[ae,st]),kt=useCallback((H,Y)=>{T(H),A(Y);},[]),ct=useCallback((H,Y,we)=>{v&&(H.preventDefault(),E({isOpen:true,x:H.clientX,y:H.clientY,type:Y?"task":"header",task:Y,columnId:we}));},[v]),$t=useCallback(()=>{E(H=>({...H,isOpen:false}));},[]),ge=useCallback((H,Y)=>{if(!g)return;H.preventDefault(),H.stopPropagation();let we=ae.find(Le=>Le.id===Y);we&&(J(Y),be(H.clientX),he(we.width));},[ae,g]);useEffect(()=>{if(!W)return;let H=we=>{let Le=we.clientX-ue,Ge=Math.max(50,G+Le),We=ae.map(se=>se.id===W?{...se,width:Ge}:se);ie(We);},Y=()=>{W&&a.onColumnsChange?.(ae),J(null);};return document.addEventListener("mousemove",H),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",Y);}},[W,ue,G,ae,a]);let L=useCallback(async H=>{if(a.onCreateCustomField){let Y={...H,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}F(false);},[a]),re=useCallback(H=>H.progress===100||H.status==="completed"?"completed":H.progress&&H.progress>0||H.status==="in-progress"?"in-progress":"todo",[]),Te=useMemo(()=>{let H=gp(e);if(I.trim()){let Y=I.toLowerCase();H=H.filter(we=>we.name.toLowerCase().includes(Y));}return z!=="all"&&(H=H.filter(Y=>re(Y)===z)),V&&(H=H.filter(Y=>re(Y)!=="completed")),H.sort((Y,we)=>{let Le,Ge;switch(S){case "name":Le=Y.name.toLowerCase(),Ge=we.name.toLowerCase();break;case "startDate":Le=Y.startDate?.getTime()||0,Ge=we.startDate?.getTime()||0;break;case "endDate":Le=Y.endDate?.getTime()||0,Ge=we.endDate?.getTime()||0;break;case "progress":Le=Y.progress||0,Ge=we.progress||0;break;case "status":Le=Y.status||"todo",Ge=we.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};Le=We[Y.priority]??4,Ge=We[we.priority]??4;break;default:return 0}return Le<Ge?C==="asc"?-1:1:Le>Ge?C==="asc"?1:-1:0}),H},[e,I,z,V,S,C,re]),ze=useCallback((H,Y)=>{let we=We=>{a.onTaskUpdate?.({...H,...We});},Le=We=>We?H.customFields?.find(Ie=>Ie.fieldId===We)?.value:void 0,Ge=(We,se)=>{if(!We)return;let ee=[...H.customFields||[]],Ke=ee.findIndex(Pa=>Pa.fieldId===We);Ke>=0?ee[Ke]={fieldId:We,value:se}:ee.push({fieldId:We,value:se}),we({customFields:ee});};switch(Y.type){case "name":return null;case "status":return jsx(Cm,{value:H.status||(H.progress===100?"completed":H.progress&&H.progress>0?"in-progress":"todo"),onChange:se=>{we({status:se,progress:se==="completed"?100:se==="in-progress"?50:0});},isDark:x,locale:c,translations:w.status});case "priority":return jsx(Nm,{value:H.priority,onChange:se=>we({priority:se}),isDark:x,locale:c});case "assignees":return jsx(Sm,{value:H.assignees||[],availableUsers:l,onChange:se=>we({assignees:se}),isDark:x,locale:c});case "startDate":return jsx(cs,{value:H.startDate,onChange:se=>we({startDate:se}),isDark:x,locale:c});case "endDate":return jsx(cs,{value:H.endDate,onChange:se=>we({endDate:se}),isDark:x,locale:c});case "progress":return jsx(Fm,{value:H.progress||0,onChange:se=>{let Ie=se===100?"completed":se>0?"in-progress":"todo";we({progress:se,status:Ie});},isDark:x});case "tags":return jsx(Gm,{value:H.tags||[],isDark:x});case "text":return jsx(Im,{value:Le(Y.customFieldId)||"",onChange:se=>Ge(Y.customFieldId,se),isDark:x});case "number":return jsx(Om,{value:Le(Y.customFieldId)||0,onChange:se=>Ge(Y.customFieldId,se),isDark:x});case "date":let We=Le(Y.customFieldId);return jsx(cs,{value:We?new Date(We):void 0,onChange:se=>Ge(Y.customFieldId,se),isDark:x,locale:c});case "dropdown":return jsx(zm,{value:Le(Y.customFieldId)||"",options:Y.options||[],onChange:se=>Ge(Y.customFieldId,se),isDark:x});case "checkbox":return jsx($m,{value:Le(Y.customFieldId)||false,onChange:se=>Ge(Y.customFieldId,se),isDark:x});case "estimatedTime":return jsx(sl,{value:H.estimatedTime,onChange:se=>we({estimatedTime:se}),isDark:x,locale:c});case "elapsedTime":return jsx(sl,{value:H.elapsedTime,onChange:se=>we({elapsedTime:se}),isDark:x,locale:c});default:return jsx("span",{className:b("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,c,l,w]),Z=useCallback(H=>{let we={name:w.columns.name,status:w.columns.status,priority:w.columns.priority,assignees:w.columns.assignees,startDate:w.columns.startDate,endDate:w.columns.endDate,progress:w.columns.progress,tags:w.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:w.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),elapsedTime:w.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent")}[H.type]||H.label;return typeof we=="string"?we:String(we||H.type)},[w,c]),Re=useMemo(()=>de.reduce((H,Y)=>H+Y.width,0)+(k?48:0),[de,k]);return r?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"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-[#3B82F6]"}),jsxs("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[w.empty.noTasks,"..."]})]})}):o?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"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:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"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-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:w.empty.noTasks}),jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:w.empty.addFirstTask})]})}):jsxs("div",{ref:j,className:b("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",W&&"select-none",s),style:n,children:[jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(dp,{value:z,hideCompleted:V,onChange:R,onHideCompletedChange:ne,isDark:x,locale:c}),jsxs("div",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[Te.length," ",w.pagination.tasks]}),u&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:b("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:I,onChange:H=>N(H.target.value),placeholder:w.toolbar.searchPlaceholder,className:b("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),h&&p&&jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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-4 h-4"}),jsx("span",{children:w.toolbar.newTask})]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:Re},children:[jsxs("div",{className:b("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[de.map(H=>jsxs("div",{className:b("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:H.width,minWidth:H.minWidth},onContextMenu:Y=>ct(Y,void 0,H.id),children:[H.sortable?jsxs("button",{onClick:()=>nt(H.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Z(H),jsx(ArrowUpDown,{className:b("w-3 h-3",S===H.id&&"text-[#3B82F6]")})]}):jsx("span",{children:Z(H)}),g&&H.resizable&&jsx("div",{className:b("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",W===H.id&&"bg-[#3B82F6]"),onMouseDown:Y=>ge(Y,H.id)})]},H.id)),k&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:H=>{H.stopPropagation(),Ne(Y=>!Y);},className:b("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ke&&(x?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx(ap,{isOpen:ke,onClose:()=>Ne(false),columns:ae,customFields:m,onColumnsChange:st,onCreateCustomField:()=>{Ne(false),F(true);},isDark:x,locale:c})]})]}),jsx(AnimatePresence,{children:Te.map((H,Y)=>{let we=He.has(H.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:Y*.02},className:b("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(H),onDoubleClick:()=>a.onTaskDoubleClick?.(H),onContextMenu:Le=>ct(Le,H),children:[de.map(Le=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Le.width,minWidth:Le.minWidth},children:Le.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&H.level>0&&jsx("div",{style:{width:`${H.level*24}px`},className:"flex-shrink-0"}),f&&H.hasChildren&&jsx("button",{onClick:Ge=>{Ge.stopPropagation(),Be(H.id);},className:b("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:we?jsx(ChevronDown,{className:b("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:b("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),f&&!H.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("button",{onClick:Ge=>{Ge.stopPropagation(),a.onTaskUpdate?.({...H,progress:H.progress===100?0:100,status:H.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(Nv,{status:H.status,progress:H.progress})}),jsx("span",{className:b("truncate font-medium",x?"text-white":"text-gray-900",H.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:H.name})]}):ze(H,Le)},Le.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},H.id)})}),Te.length===0&&I&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:b("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:b(x?"text-[#9CA3AF]":"text-gray-600"),children:w.empty.noResults})]})})]})}),jsx(Jm,{state:B,onClose:$t,isDark:x,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Xe,onColumnSort:kt,availableUsers:l}),jsx(np,{isOpen:Ae,onClose:()=>F(false),onSave:L,isDark:x,locale:c})]})}var bp=[{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:"estimatedTime",type:"estimatedTime",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"elapsedTime",type:"elapsedTime",label:"Time Spent",width:100,visible:false,sortable:true,resizable:true}],hp=[{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:"estimatedTime",labelKey:"columns.estimatedTime",icon:"Clock"},{type:"elapsedTime",labelKey:"columns.elapsedTime",icon:"Timer"}],yp=[{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 dl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},cl={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"},ml={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"},us={dark:dl,light:cl,neutral:ml};function vp(e){return us[e]||us.dark}var pl={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"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},ul={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"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},gs={en:pl,es:ul};function an(e){return gs[e]||gs.en}function fs(e,t){let a=an(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 xp(e){let t=an(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 kp(e,t=0,a=true){let r=an(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 Dp(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 fl(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 Sp({task:e}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Pp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:u,currentUser:f,mentionableUsers:y,onUploadCommentAttachments:k,onTaskOpen:g}){let{theme:v="dark",locale:h="en",customTranslations:p}=t,w=fs(h,p),x=v==="dark",[S,T]=useState(r||new Date),[C,A]=useState(null),[I,N]=useState(null),[z,R]=useState({}),V=4,ne=3,[ae,ie]=useState(null),[ke,Ne]=useState(""),[Ae,F]=useState(void 0),[B,E]=useState(null),[W,J]=useState(false),[ue,be]=useState(false),[G,he]=useState(null),[j,He]=useState(false),[de,Be]=useState(new Date),nt=useCallback(()=>{T(new Date(S.getFullYear(),S.getMonth()-1,1));},[S]),st=useCallback(()=>{T(new Date(S.getFullYear(),S.getMonth()+1,1));},[S]),Xe=useCallback(()=>{T(new Date);},[]),kt=useMemo(()=>{let ge=S.getFullYear(),L=S.getMonth(),re=new Date(ge,L,1),Te=new Date(ge,L+1,0),ze=re.getDay(),Z=Te.getDate(),Re=Dp(e),H=new Date;H.setHours(0,0,0,0);let Y=[],we=ze,Le=new Date(ge,L,0).getDate();for(let We=we-1;We>=0;We--){let se=new Date(ge,L-1,Le-We);Y.push({date:se,isCurrentMonth:false,isToday:false,isWeekend:se.getDay()===0||se.getDay()===6,events:Re.filter(Ie=>fl(se,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}for(let We=1;We<=Z;We++){let se=new Date(ge,L,We),Ie=se.getTime()===H.getTime();Y.push({date:se,isCurrentMonth:true,isToday:Ie,isWeekend:se.getDay()===0||se.getDay()===6,events:Re.filter(ee=>fl(se,ee)).map(ee=>({id:ee.id,title:ee.name,start:ee.startDate,end:ee.endDate,task:ee}))});}let Ge=42-Y.length;for(let We=1;We<=Ge;We++){let se=new Date(ge,L+1,We);Y.push({date:se,isCurrentMonth:false,isToday:false,isWeekend:se.getDay()===0||se.getDay()===6,events:Re.filter(Ie=>fl(se,Ie)).map(Ie=>({id:Ie.id,title:Ie.name,start:Ie.startDate,end:Ie.endDate,task:Ie}))});}return Y},[S,e]),ct=h==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],$t=S.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[w.labels.noEvents,"..."]})]})}):s?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"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:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:w.labels.noEvents}),jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:w.labels.newTask})]})}):jsxs("div",{className:b("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:b("text-xl font-semibold capitalize",x?"text-white":"text-gray-900"),children:$t}),jsx("button",{onClick:Xe,className:b("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:w.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:nt,className:b("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:b("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:st,className:b("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:b("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:ct.map(ge=>jsx("div",{className:b("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:ge},ge))}),jsx("div",{className:b("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:kt.map((ge,L)=>{let re=ge.date.getDay()===0||ge.date.getDay()===6;return jsxs("div",{className:b("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?re?"bg-[#1C1F26]":ge.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":re?"bg-gray-100":ge.isCurrentMonth?"bg-white":"bg-gray-50",ge.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Te=z[L]||V,ze=ge.events.slice(0,Te),Z=ge.events.length-Te;return jsxs("div",{className:"space-y-1 flex-1",children:[ze.map(Re=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{A(Re.task),a.onEventClick?.(Re),g?.(Re.task.id);},whileHover:{scale:1.02},className:b("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Re.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(Sp,{task:Re.task}),jsx("span",{className:"truncate",children:Re.title})]})},Re.id)),Z>0&&jsxs("button",{onClick:Re=>{Re.stopPropagation(),R(H=>({...H,[L]:Te+ne}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Z," ",h==="es"?"M\xC1S":"MORE"]}),Te>V&&ge.events.length>V&&jsx("button",{onClick:Re=>{Re.stopPropagation(),R(H=>({...H,[L]:V}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:h==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Te=L>=28,ze=L%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Z=>{Z.stopPropagation(),ae===L?ie(null):(ie(L),Ne(""),F(void 0),E(null),he(null),J(false),be(false),He(false),Be(ge.date));},className:b("w-5 h-5 rounded flex items-center justify-center transition-all",ae===L?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:b("w-3.5 h-3.5 transition-transform",ae===L&&"rotate-45")})}),jsx(AnimatePresence,{children:ae===L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ie(null),Ne(""),F(void 0),E(null),he(null),J(false),be(false),He(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Te?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Te?-5:5,scale:.95},transition:{duration:.12},className:b("absolute w-[320px] rounded-lg shadow-2xl z-50",Te?"bottom-full mb-1":"top-full mt-1",ze?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>{Z.stopPropagation(),J(false),be(false),He(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:ke,onChange:Z=>Ne(Z.target.value),placeholder:h==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:b("w-full bg-transparent text-sm outline-none placeholder:opacity-40",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Z=>{if(Z.key==="Enter"&&ke.trim()){let Re=t.availableUsers?.find(Y=>Y.id===B),H=G||ge.date;a.onTaskCreate?.({name:ke.trim(),startDate:H,endDate:H,priority:Ae,assignees:Re?[Re]:void 0}),Ne(""),F(void 0),E(null),he(null),ie(null);}Z.key==="Escape"&&(ie(null),Ne(""),F(void 0),E(null),he(null));}})}),jsxs("div",{className:b("px-2.5 py-2 flex items-center justify-between border-t",x?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:Z=>{Z.stopPropagation(),J(!W),be(false);},className:b("p-1 rounded transition-colors",Ae?Ae==="urgent"||Ae==="high"?"text-red-400 bg-red-500/20":Ae==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:W&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[{id:"urgent",label:h==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:h==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:h==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:h==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:h==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Z=>jsxs("button",{onClick:()=>{F(Z.id),J(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Ae===Z.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:b("w-2 h-2 rounded-full",Z.color)}),jsx("span",{className:x?"text-white":"text-gray-900",children:Z.label})]},Z.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:Z=>{Z.stopPropagation(),He(!j),J(false),be(false),Be(G||ge.date);},className:b("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",G?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(G||ge.date).toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:j&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsx("div",{className:b("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let Z=new Date,Re=new Date(Z);Re.setDate(Z.getDate()+1);let H=new Date(Z);H.setDate(Z.getDate()+((6-Z.getDay()+7)%7||7));let Y=new Date(Z);Y.setDate(Z.getDate()+((1-Z.getDay()+7)%7||7));let we=new Date(Z);we.setDate(Z.getDate()+14);let Le=new Date(Z);return Le.setDate(Z.getDate()+28),[{label:h==="es"?"Hoy":"Today",date:Z,display:Z.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Ma\xF1ana":"Tomorrow",date:Re,display:Re.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Este fin de semana":"This weekend",date:H,display:h==="es"?"s\xE1b.":"sat."},{label:h==="es"?"Pr\xF3xima semana":"Next week",date:Y,display:h==="es"?"lun.":"mon."},{label:h==="es"?"2 semanas":"2 weeks",date:we,display:we.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:h==="es"?"4 semanas":"4 weeks",date:Le,display:Le.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((We,se)=>jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{he(We.date),He(false);},children:[jsx("span",{children:We.label}),jsx("span",{className:b("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:We.display})]},se))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:b("text-xs font-medium",x?"text-white":"text-gray-900"),children:de.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>Be(new Date),className:b("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:h==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Be(new Date(de.getFullYear(),de.getMonth()-1)),className:b("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>Be(new Date(de.getFullYear(),de.getMonth()+1)),className:b("p-0.5 rounded",x?"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:(h==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Z=>jsx("div",{className:b("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:Z},Z))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Z=de.getFullYear(),Re=de.getMonth(),H=new Date(Z,Re,1).getDay(),Y=new Date(Z,Re+1,0).getDate(),we=new Date(Z,Re,0).getDate(),Le=new Date,Ge=[];for(let se=H-1;se>=0;se--)Ge.push({dayNum:we-se,isCurrentMonth:false,date:new Date(Z,Re-1,we-se)});for(let se=1;se<=Y;se++)Ge.push({dayNum:se,isCurrentMonth:true,date:new Date(Z,Re,se)});let We=42-Ge.length;for(let se=1;se<=We;se++)Ge.push({dayNum:se,isCurrentMonth:false,date:new Date(Z,Re+1,se)});return Ge.map((se,Ie)=>{let ee=se.date.toDateString()===Le.toDateString(),Ke=(G||ge.date).toDateString()===se.date.toDateString();return jsx("button",{className:b("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!se.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),se.isCurrentMonth&&(x?"text-white":"text-gray-900"),ee&&"ring-1 ring-[#3B82F6]",Ke&&"bg-[#7C3AED] text-white",!Ke&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{he(se.date),He(false);},children:se.dayNum},Ie)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:Z=>{Z.stopPropagation(),be(!ue),J(false);},className:b("p-1 rounded transition-colors",B?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:B?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(Z=>Z.id===B)?.color||"#7C3AED"},children:t.availableUsers?.find(Z=>Z.id===B)?.initials||t.availableUsers?.find(Z=>Z.id===B)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:ue&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxs("button",{onClick:()=>{E(null),be(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!B&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:b("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:h==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Z=>jsxs("button",{onClick:()=>{E(Z.id),be(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",B===Z.id&&(x?"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-medium",style:{backgroundColor:Z.color||"#7C3AED"},children:Z.initials||Z.name?.slice(0,2).toUpperCase()}),jsx("span",{className:x?"text-white":"text-gray-900",children:Z.name})]},Z.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:b("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:h==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(ke.trim()){let Z=t.availableUsers?.find(H=>H.id===B),Re=G||ge.date;a.onTaskCreate?.({name:ke.trim(),startDate:Re,endDate:Re,priority:Ae,assignees:Z?[Z]:void 0}),Ne(""),F(void 0),E(null),he(null),ie(null);}},disabled:!ke.trim(),className:b("px-2.5 py-1 rounded text-xs font-medium transition-colors",ke.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:h==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:b("text-sm font-medium",ge.isToday?"text-[#3B82F6]":ge.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:ge.date.getDate()})]})]},L)})})]})}),jsx(fr,{task:C,isOpen:!!C,onClose:()=>A(null),onTaskUpdate:ge=>{a.onTaskUpdate?.(ge),A(ge);},theme:v==="dark"?"dark":"light",locale:h,availableUsers:t.availableUsers?.map(ge=>({id:ge.id,name:ge.name,avatar:ge.avatar,initials:ge.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:C?c?.get(C.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Dp(e).filter(ge=>ge.id!==C?.id),comments:d?.filter(ge=>ge.taskId===C?.id).map(ge=>({...ge,createdAt:ge.createdAt instanceof Date?ge.createdAt:new Date(ge.createdAt),updatedAt:ge.updatedAt instanceof Date?ge.updatedAt:ge.updatedAt?new Date(ge.updatedAt):void 0})),onAddComment:u,currentUser:f,mentionableUsers:y,onUploadCommentAttachments:k}),jsx(AnimatePresence,{children:I&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(null),className:"fixed inset-0 bg-black/30 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:b("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",x?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:b("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsx("span",{className:b("font-medium",x?"text-white":"text-gray-900"),children:I.date.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>N(null),className:b("p-1 rounded",x?"hover:bg-white/10 text-[#9CA3AF]":"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-2",children:I.events.map(ge=>jsxs("button",{onClick:()=>{N(null),A(ge.task),g?.(ge.task.id);},className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(Sp,{task:ge.task}),jsx("span",{className:b("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:ge.title}),ge.task.priority==="high"||ge.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},ge.id))})]})]})})]})}var bl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},hl={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"},yl={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"},bs={dark:bl,light:hl,neutral:yl};function Mp(e){return bs[e]||bs.dark}function Bv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[m,i]=useState(false),c=useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=useMemo(()=>{let f=c.length,y=new Set(c.flatMap(v=>v.assignedUserIds||[])).size,k=c.map(v=>v.priority).filter(Boolean),g=new Set(c.flatMap(v=>v.labels||[])).size;return {totalCards:f,uniqueAssignees:y,priorities:k,labels:g}},[c]),u=()=>{o?.(e.id);};return jsxs("div",{className:b("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:u,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:b("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:f=>{f.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:c.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:c.map(f=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsx("h4",{children:f.title}),f.description&&jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Ap={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function on(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 nn(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 Lp(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 Ip({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let m=useMemo(()=>({...Ap,...n}),[n]),[i,c]=useState(new Set),d=useRef(null),u=useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(p=>{let w=p.timestamp.toISOString().split("T")[0],x=h.get(w);x?x.push(p):h.set(w,[p]);}),Array.from(h.entries()).sort((p,w)=>w[0].localeCompare(p[0])).map(([p,w])=>({date:new Date(p),events:w.sort((x,S)=>S.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:f,uniqueTypes:y}=useMemo(()=>{let h=new Set,p=new Set;return e.forEach(w=>{h.add(w.userId),p.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(p)}},[e]),k=h=>{c(p=>{let w=new Set(p);return w.has(h)?w.delete(h):w.add(h),w});},g=h=>{let w=new Date().getTime()-h.getTime(),x=Math.floor(w/6e4),S=Math.floor(w/36e5),T=Math.floor(w/864e5);return x<1?"just now":x<60?`${x}m ago`:S<24?`${S}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},v=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&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:b("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:b("history-timeline",m.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let p=h.target.value;a({...t,types:p?[p]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxs("option",{value:h,children:[nn(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let p=h.target.value;a({...t,users:p?[p]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),f.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})})]}),v>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:u.map(h=>jsxs("div",{className:"history-timeline-group",children:[m.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((p,w)=>{let x=i.has(p.id),S=s===p.id,T=Lp(p.type);return jsxs("div",{"data-event-id":p.id,className:b("history-timeline-event",x&&"expanded",S&&"selected"),onClick:()=>o?.(p),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:nn(p.type)})}),w<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),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:[m.showAvatars&&p.userAvatar&&jsx("img",{src:p.userAvatar,alt:p.userName||p.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:p.userName||p.userId}),jsx("span",{className:"history-timeline-event-action",children:on(p)})]})]}),jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(p.timestamp):p.timestamp.toLocaleString()})]}),Object.keys(p.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),k(p.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(p.changes).map(([C,A])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(A.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},C)),p.metadata&&Object.keys(p.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(p.metadata).map(([C,A])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(A)})]},C))]})]})]})]},p.id)})})]},h.date?.toISOString()||"all"))})]})}function Rp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:b("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:b("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&nn(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&on(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:f=>l(parseInt(f.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((f,y)=>jsx("div",{className:b("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:on(f)},f.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:c.map(f=>jsxs("button",{className:b("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>m(f),children:[f,"x"]},f))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(f=>jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxs("div",{className:b("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 vl(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 xl(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 Op(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 zp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Hv(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let d=a/2,u=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(u-c.y)*o.centerForce*i,n.forEach(f=>{if(c.id===f.id)return;let y=c.x-f.x,k=c.y-f.y,g=Math.sqrt(y*y+k*k)||1,v=o.chargeStrength*i/(g*g);c.vx+=y/g*v,c.vy+=k/g*v;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),u=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!u)return;let f=u.x-d.x,y=u.y-d.y,k=Math.sqrt(f*f+y*y)||1,g=(k-o.linkDistance)/k*o.forceStrength*i;d.vx+=f*g,d.vy+=y*g,u.vx-=f*g,u.vy-=y*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Up({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:m}){let i=useRef(null),[c,d]=useState([]),[u,f]=useState(null),[y,k]=useState(null),[g,v]=useState(null),[h,p]=useState(1),[w,x]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let R=Hv(e,t,a.width,a.height,a,150);d(R);},[e,t,a]);let S=useCallback((R,V)=>{a.enableDragging&&(V.stopPropagation(),f(R));},[a.enableDragging]),T=useCallback(R=>{if(!u||!i.current)return;let ne=i.current.getBoundingClientRect(),ae=(R.clientX-ne.left-w.x)/h,ie=(R.clientY-ne.top-w.y)/h;d(ke=>ke.map(Ne=>Ne.id===u?{...Ne,x:ae,y:ie,fx:ae,fy:ie}:Ne));},[u,h,w]),C=useCallback(()=>{f(null);},[]),A=useCallback((R,V)=>{V.stopPropagation(),l?.({type:"node-click",node:R,position:{x:V.clientX,y:V.clientY}});},[l]),I=useCallback((R,V)=>{V.stopPropagation(),l?.({type:"edge-click",edge:R,position:{x:V.clientX,y:V.clientY}});},[l]),N=useCallback(R=>{let V=c.find(ne=>ne.id===R);return V?{x:V.x,y:V.y}:{x:0,y:0}},[c]),z=useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let V=R.card.priority;return V==="URGENT"?"#ef4444":V==="HIGH"?"#f59e0b":V==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:b("relationships-graph-empty",m),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:b("relationships-graph",m),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:()=>p(R=>Math.min(R+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>p(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{p(1),x({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:vl(R)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Op(R)," ",xl(R)]})]},R))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:C,onMouseLeave:C,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let V=N(typeof R.source=="string"?R.source:R.source.id),ne=N(typeof R.target=="string"?R.target:R.target.id),ae=zp(R.type),ie=g===R.id,ke=R.onCriticalPath;return jsxs("g",{className:b("relationships-graph-edge",ie&&"hovered",ke&&"critical"),onMouseEnter:()=>v(R.id),onMouseLeave:()=>v(null),onClick:Ne=>I(R,Ne),children:[jsx("line",{x1:V.x,y1:V.y,x2:ne.x,y2:ne.y,stroke:vl(R.type),strokeWidth:ke?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ie?1:.6,markerEnd:ae?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ie&&jsx("text",{x:(V.x+ne.x)/2,y:(V.y+ne.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:xl(R.type)})]},R.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(R=>{let V=y===R.id,ne=R.onCriticalPath;return jsxs("g",{className:b("relationships-graph-node",V&&"hovered",ne&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:ae=>S(R.id,ae),onMouseEnter:()=>k(R.id),onMouseLeave:()=>k(null),onClick:ae=>A(R,ae),children:[jsx("circle",{r:ne?a.nodeSize*1.2:a.nodeSize,fill:z(R),stroke:ne?"#fbbf24":"#ffffff",strokeWidth:ne?3:2,opacity:V?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.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 Wp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[l,m]=useState(false),[i,c]=useState(null),[d,u]=useState(null),f=useRef(null),y=l||o;useEffect(()=>{e&&f.current&&f.current.focus();},[e]),useEffect(()=>{let h=p=>{p.key==="Escape"&&!y&&k();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let k=()=>{y||(n(""),c(null),u(null),t());},g=async()=>{if(!(!s.trim()||y)){m(true),c(null),u(null);try{let h=await r(s.trim());u(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{d&&(a(d),k());};return e?jsxs(gt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),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:k,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,p)=>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},p))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,p)=>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})]})},p)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:f,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:y}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,p)=>jsx("button",{onClick:()=>n(h),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},p))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:k,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:g,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var kl={"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 Gv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},_v={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 Vv(e,t,a){let r=kl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function sn(e){return `$${e.toFixed(4)}`}var wl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Vv(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,u)=>d+u.cost,0),s=a.reduce((d,u)=>d+u.inputTokens,0),n=a.reduce((d,u)=>d+u.outputTokens,0),l=a.filter(d=>d.success),m=a.reduce((d,u)=>d+u.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:m,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},so=new wl;function Vp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(so.getStats()),[s,n]=useState(so.checkLimit(a));if(useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(so.getStats()),n(so.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let l=so.getRecentOperations(5);return jsxs(gt,{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:m=>m.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:sn(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(([m,i])=>{let c=r.costsByFeature[m]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.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:sn(c)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(m=>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:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:sn(m.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.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 Yp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[m,i]=useState(""),[c,d]=useState(""),[u,f]=useState(false),[y,k]=useState(null),[g,v]=useState(null),[h,p]=useState(null),w=useRef(null),x=u||o;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let I=N=>{N.key==="Escape"&&!x&&S();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,x]);let S=()=>{x||(l(""),i(""),d(""),k(null),v(null),p(null),t());},T=async()=>{if(!(!n.trim()||x)){f(true),k(null),v(null),p(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});v(I.tasks.tasks),p({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){k(I instanceof Error?I.message:"Failed to generate tasks");}finally{f(false);}}},C=()=>{g&&(a(g),S());};if(!e)return null;let A=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(gt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:I=>I.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:S,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:g?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 (",A,"% 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:[g.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((I,N)=>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:["#",N+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:I.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),I.start," \u2192 ",I.end]}),jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:n,onChange:I=>l(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),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:m,onChange:I=>i(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:x})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:x})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((I,N)=>jsx("button",{onClick:()=>l(I),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:I},N))})]})]})}),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:S,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"}),g?jsx("button",{onClick:C,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:T,disabled:!n.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function vs({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(g=>{t&&hn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,p)=>{console.warn(`Retry attempt ${h} after ${p}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=useCallback(async(g,v,h)=>{r(p=>{let w=p.cards.find(I=>I.id===g);if(!w)return p;let x=w.columnId,S={...w,columnId:v,position:h},T=p.cards.map(I=>I.id===g?S:I),C=p.columns.map(I=>{if(I.id===x)return {...I,cardIds:I.cardIds.filter(N=>N!==g)};if(I.id===v){let N=T.filter(z=>z.columnId===v).sort((z,R)=>z.position-R.position);return {...I,cardIds:N.map(z=>z.id)}}return I}),A={...p,cards:T,columns:C};return o(A),A});},[o]),n=useCallback(async(g,v)=>{r(h=>{let p=h.cards.map(x=>x.id===g?{...x,...v}:x),w={...h,cards:p};return o(w),w});},[o]),l=useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v},w=h.columns.map(S=>S.id===g.columnId?{...S,cardIds:[...S.cardIds,v]}:S),x={...h,cards:[...h.cards,p],columns:w};return o(x),x});},[o]),m=useCallback(async g=>{r(v=>{let h=v.cards.find(S=>S.id===g);if(!h)return v;let p=v.cards.filter(S=>S.id!==g),w=v.columns.map(S=>S.id===h.columnId?{...S,cardIds:S.cardIds.filter(T=>T!==g)}:S),x={...v,cards:p,columns:w};return o(x),x});},[o]),i=useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v,cardIds:[]},w={...h,columns:[...h.columns,p]};return o(w),w});},[o]),c=useCallback(async(g,v)=>{r(h=>{let p=h.columns.map(x=>x.id===g?{...x,...v}:x),w={...h,columns:p};return o(w),w});},[o]),d=useCallback(async g=>{r(v=>{let h=v.cards.filter(x=>x.columnId!==g),p=v.columns.filter(x=>x.id!==g),w={...v,cards:h,columns:p};return o(w),w});},[o]),u=useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),v},[l]),f=useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),v},[i]),y=useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:u,addColumn:f,deleteCard:m,deleteColumn:d,clearBoard:y}}}function Xp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=vs({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var ln={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Zp={by:"none",order:"asc"};function Qp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...ln,...e}),[s,n]=useState({...Zp,...t}),l=useCallback(k=>{o(g=>({...g,...k}));},[]),m=useCallback(k=>{n(g=>({...g,...k}));},[]),i=useCallback(()=>{o(ln),n(Zp);},[]),c=useCallback(()=>{a&&o({...ln,assignees:[a]});},[a]),d=useCallback(()=>{o({...ln,dateFilter:"overdue"});},[]),u=useCallback(()=>{o({...ln,priorities:["HIGH","URGENT"]});},[]),f=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=useCallback(k=>{let g=[...k];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),p=String(v.getMonth()+1).padStart(2,"0"),w=String(v.getDate()).padStart(2,"0"),x=`${h}-${p}-${w}`;g=g.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let T=S.endDate||S.dueDate;if(!T)return false;let C;if(typeof T=="string")C=T.split("T")[0]||T;else {let A=T.getUTCFullYear(),I=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");C=`${A}-${I}-${N}`;}switch(r.dateFilter){case "overdue":return C<x;case "today":return C===x;case "this-week":let A=new Date(x+"T00:00:00"),I=new Date(C+"T00:00:00"),N=new Date(A);return N.setDate(N.getDate()+7),I>=A&&I<=N;case "custom":if(r.dateRange){let z=typeof T=="string"?new Date(T):T;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(p=>r.assignees.includes(p)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let p=0;switch(s.by){case "created":let w=v.createdAt?new Date(v.createdAt).getTime():0,x=h.createdAt?new Date(h.createdAt).getTime():0;p=w-x;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=S[v.priority||"LOW"],C=S[h.priority||"LOW"];p=T-C;break;case "dueDate":let A=v.endDate||v.dueDate,I=h.endDate||h.dueDate;if(!A)return 1;if(!I)return -1;let N=typeof A=="string"?new Date(A).getTime():A.getTime(),z=typeof I=="string"?new Date(I).getTime():I.getTime();p=N-z;break;case "title":p=v.title.localeCompare(h.title);break;case "estimate":let R=v.estimatedTime||0,V=h.estimatedTime||0;p=R-V;break;default:p=0;}return s.order==="asc"?p:-p}),g},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:u,applyFilters:y,hasActiveFilters:f}}var tu,au;if(typeof window<"u")try{let e=gn("ai");tu=e.generateObject,au=e.generateText;}catch{}function ru(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(tu&&au&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let f=u instanceof Error?u:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let f=u instanceof Error?u:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(u){let f=u instanceof Error?u:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(u){let f=u instanceof Error?u:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(u){let f=u instanceof Error?u:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function Tl(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function ou(e){let{cards:t}=e,[a,r]=Tl(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,u)=>{if(!u){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=u.ctrlKey||u.metaKey,y=u.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let k=t.find(v=>v.id===d),g=t.find(v=>v.id===a.lastSelectedCardId);if(k&&g&&k.columnId===g.columnId){let v=t.filter(C=>C.columnId===k.columnId).sort((C,A)=>C.position-A.position),h=v.findIndex(C=>C.id===a.lastSelectedCardId),p=v.findIndex(C=>C.id===d),[w,x]=h<p?[h,p]:[p,h],S=v.slice(w,x+1).map(C=>C.id),T=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:T,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(u=>u!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:m,toggleCard:i,getSelectedCards:c}}var nu={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function su(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...nu,...a}),[a]),[s,n]=useState([]),l=useCallback((k,g,v,h,p)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:g,columnId:v,strategy:h,color:p,isExpanded:true,position:s.filter(x=>x.columnId===v).length,createdAt:new Date};n(x=>[...x,w]);},[o.minCardsPerStack,s]),m=useCallback(k=>{n(g=>g.filter(v=>v.id!==k));},[]),i=useCallback(k=>{n(g=>g.map(v=>v.id===k?{...v,isExpanded:!v.isExpanded}:v));},[]),c=useCallback((k,g)=>{n(v=>v.map(h=>h.id===k&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=useCallback((k,g)=>{n(v=>v.map(h=>{if(h.id===k){let p=h.cardIds.filter(w=>w!==g);return p.length<o.minCardsPerStack?null:{...h,cardIds:p}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),u=useCallback(k=>s.filter(g=>g.columnId===k).sort((g,v)=>g.position-v.position),[s]),f=useCallback(async k=>{let g=t.filter(x=>x.columnId===k);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(S=>{h.has(S)||h.set(S,[]),h.get(S).push(x);});}),h.forEach((x,S)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:x.map(T=>T.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${S}"`,confidence:.85});});let p=new Map;g.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(S=>{p.has(S)||p.set(S,[]),p.get(S).push(x);});}),p.forEach((x,S)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:x.map(T=>T.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(g.forEach(x=>{x.priority&&(w.has(x.priority)||w.set(x.priority,[]),w.get(x.priority).push(x));}),w.forEach((x,S)=>{if(x.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";v.push({stack:{title:`${T} ${S} Priority`,cardIds:x.map(C=>C.id),columnId:k,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${S} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of g){let T=(await r.findSimilar(x,g)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let C=[x.id,...T.map(I=>I.card.id)],A=T.reduce((I,N)=>I+N.similarity,0)/T.length;v.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:C,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:A});}}return v.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,S)=>S.confidence-x.confidence).slice(0,5)},[t,o,r]),y=useCallback(k=>{l(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await f(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:l,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:u,getSuggestions:f,applySuggestion:y,config:o}}var iu=createContext(null);function lu({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=gn("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=gn("@libxai/core");n.set(m.id,new i(m));});let l=null;if(t?.board){let{Board:m}=gn("@libxai/core");l=new m(t.board);}r.current=new BoardStore({board:l,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(iu.Provider,{value:{store:o},children:e})}function xs(){let e=useContext(iu);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function cn(){let e=xs(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=useCallback(h=>{e.updateBoard(h);},[e]),m=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,p)=>{e.updateColumn(h,p);},[e]),c=useCallback(h=>{e.deleteColumn(h);},[e]),d=useCallback(h=>e.getColumn(h),[e]),u=useCallback(h=>{e.addCard(h);},[e]),f=useCallback((h,p)=>{e.updateCard(h,p);},[e]),y=useCallback(h=>{e.deleteCard(h);},[e]),k=useCallback((h,p,w)=>{e.moveCard(h,p,w);},[e]),g=useCallback(h=>e.getCard(h),[e]),v=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:d,addCard:u,updateCard:f,deleteCard:y,moveCard:k,getCard:g,getCardsByColumn:v}}function cu(e){let{cards:t}=cn();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 mu(e="position",t="asc"){let{cards:a}=cn();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=m-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 ks=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=rd.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},lx=new ks;function uu({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:m}){let i=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:u,className:o,children:jsx("div",{style:f,children:d.map(y=>{let k=e[y.index];if(!k)return null;let g=m?m(k,y.index):y.index,v={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsx("div",{style:v,"data-index":y.index,children:r(k,y.index)},g)})})})}function gu(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 bu({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:m,horizontal:i=true}){let c=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),u=d.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:c,style:f,className:s,children:jsx("div",{style:y,children:u.map(k=>{let g=e[k.index];if(!g)return null;let v=m?m(g,k.index):k.index,h={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsx("div",{style:h,"data-index":k.index,children:o(g,k.index)},v)})})})}function hu(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 yu(e,t=10){return e>t}var El={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Pl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ml={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ll={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Il={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Bl={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)"},Rl={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)"},Ol={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},zl={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}},Ul={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}},ws={spacing:El,borderRadius:Pl,fontSize:Ml,fontWeight:Fl,lineHeight:Al,zIndex:Ll,duration:Il,easing:Bl,shadows:Rl,opacity:Ol,kanban:zl,gantt:Ul};function vu(e,t,a){return e[t]??a}function $l(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)?$l(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function mx(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Hl(e="asakaa"){let t=$l(ws),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=mx(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
389
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function bm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function xr(e,t){let a=bm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let m=l.name.toLowerCase();return n.every(i=>m.includes(i))})}function qi(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 u=new Date(r);return u.setDate(u.getDate()+1),u}if(a==="yesterday"||a==="ayer"){let u=new Date(r);return u.setDate(u.getDate()-1),u}if(a==="next week"||a==="la pr\xF3xima semana"){let u=new Date(r);return u.setDate(u.getDate()+7),u}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 f={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(f!==void 0){let y=new Date(r),k=y.getDay(),g=f-k;return g<=0&&(g+=7),y.setDate(y.getDate()+g),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),f=s[2].toLowerCase(),y=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?y.setDate(y.getDate()+u):f==="week"||f==="semana"||f==="semanas"?y.setDate(y.getDate()+u*7):(f==="month"||f==="mes"||f==="meses")&&y.setMonth(y.getMonth()+u),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let u=parseInt(l[1],10),f=parseInt(l[2],10)-1,y=parseInt(l[3],10);return new Date(y,f,u)}let m={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 u=parseInt(i[1],10),f=m[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(y,f,u)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let u=c[d[1].toLowerCase()],f=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,f)}return null}function Xi(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 Ji(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 hm(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 ym(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),c=r[2].trim(),d=xr(t,i),u=qi(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(u);return y.setDate(y.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:u,endDate:y},message:`Moved "${d.name}" to ${u.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),d=xr(t,i),u=Xi(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+u),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${u} days. New end date: ${f.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),d=xr(t,i),u=Ji(c);return d?u===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:u},message:`Set "${d.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),d=xr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=xr(t,i),u=xr(t,c);return d?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:d.id,dependencyTo:u.id,message:`Linked "${d.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),c=xr(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function vm(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 B0(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 R0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function rs(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(u=>u.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>rs(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},l=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||l&&m&&Math.abs(m.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:m,progress:e.progress||0,status:B0(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 xm(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:R0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function km(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>rs(r,e,t))}var Zi={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",elapsedTime:"Time Spent",tags:"Tags"},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"}},Qi={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",elapsedTime:"Tiempo",tags:"Etiquetas"},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"}},os={en:Zi,es:Qi};function el(e){return os[e]||os.en}function ns(e,t){let a=el(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 tl=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function wm(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 Cm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let f=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let m=wm(e),i=tl[0],c=tl.find(f=>f.value===m)??i,d=c.icon,u=f=>{switch(wm(f)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:b("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:b("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:u(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(d,{className:b("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:b("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:u(e)}),jsx(ChevronDown,{className:b("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:b("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:tl.map(f=>{let y=f.icon;return jsxs("button",{onClick:k=>{k.stopPropagation(),t(f.value),n(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",m===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(y,{className:b("w-4 h-4",f.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u(f.value)})]},f.value)})})]})}var al=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Nm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=al.find(c=>c.value===e)??al[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:b("w-4 h-4",m.color)}),jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:b("w-4 h-4",m.color)}),jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsx(ChevronDown,{className:b("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:b("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:al.map(c=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:b("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function ls(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ds(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Sm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=useState(false),[m,i]=useState(""),c=useRef(null);useEffect(()=>{let y=k=>{c.current&&!c.current.contains(k.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]);let d=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())||y.email?.toLowerCase().includes(m.toLowerCase())),u=y=>e.some(k=>k.name===y),f=y=>{if(a)if(u(y.name))a(e.filter(k=>k.name!==y.name));else {let k={name:y.name,initials:ls(y.name),color:y.color||ds(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl};a([...e,k]);}};return s||!a?e.length===0?jsx("span",{className:b("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((y,k)=>jsx("div",{className:b("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!y.avatar&&ds(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||ls(y.name)},`${y.name}-${k}`)),e.length>3&&jsxs("div",{className:b("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:c,className:"relative",children:[jsx("button",{onClick:y=>{y.stopPropagation(),l(!n);},className:b("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:b("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:b("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((y,k)=>jsx("div",{className:b("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!y.avatar&&ds(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||ls(y.name)},`${y.name}-${k}`)),e.length>2&&jsxs("span",{className:b("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:b("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:b("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:y=>y.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:d.length===0?jsx("p",{className:b("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):d.map(y=>jsxs("button",{onClick:k=>{k.stopPropagation(),f(y);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:b("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!y.avatarUrl&&ds(y.name)),children:y.avatarUrl?jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):ls(y.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:y.name}),y.email&&jsx("div",{className:b("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:y.email})]}),u(y.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},y.id))}),e.length>0&&jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((y,k)=>jsxs("span",{className:b("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[y.name,jsx("button",{onClick:g=>{g.stopPropagation(),a(e.filter(v=>v.name!==y.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${y.name}-${k}`))})]})]})}var sy={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},iy={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function cs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(()=>{if(e){let g=e instanceof Date?e:new Date(e);return new Date(g.getFullYear(),g.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=useRef(null),c=e?e instanceof Date?e:new Date(e):null,d=r==="es"?"es":"en";useEffect(()=>{let g=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=g=>g?g.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",f=(g,v)=>new Date(g,v+1,0).getDate(),y=(g,v)=>new Date(g,v,1).getDay(),k=()=>{let g=l.getFullYear(),v=l.getMonth(),h=f(g,v),p=y(g,v),w=new Date,x=[];for(let S=0;S<p;S++)x.push(jsx("div",{className:"w-8 h-8"},`empty-${S}`));for(let S=1;S<=h;S++){let T=new Date(g,v,S),C=c&&c.getDate()===S&&c.getMonth()===v&&c.getFullYear()===g,A=w.getDate()===S&&w.getMonth()===v&&w.getFullYear()===g;x.push(jsx("button",{onClick:I=>{I.stopPropagation(),t?.(T),n(false);},className:b("w-8 h-8 rounded-full text-sm transition-colors",C?"bg-[#3B82F6] text-white":A?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:S},S));}return x};return o||!t?jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:b("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)})]}),s&&jsxs("div",{className:b("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(l.getFullYear(),l.getMonth()-1,1));},className:b("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:b("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxs("span",{className:b("text-sm font-medium",a?"text-white":"text-gray-900"),children:[sy[d][l.getMonth()]," ",l.getFullYear()]}),jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(l.getFullYear(),l.getMonth()+1,1));},className:b("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:b("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:iy[d].map(g=>jsx("div",{className:b("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:g},g))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:k()}),jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsx("button",{onClick:g=>{g.stopPropagation(),t?.(new Date),n(false);},className:b("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsx("button",{onClick:g=>{g.stopPropagation();let v=new Date;v.setDate(v.getDate()+1),t?.(v),n(false);},className:b("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Fm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),l=s.clientX-n.left,m=Math.round(l/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:b("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:b("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxs("span",{className:b("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Im({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[l,m]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{m(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=u=>{u.key==="Enter"?c():u.key==="Escape"&&(m(e),n(false));};return o||!t?jsx("span",{className:b("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:u=>m(u.target.value),onBlur:c,onKeyDown:d,onClick:u=>u.stopPropagation(),className:b("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:u=>{u.stopPropagation(),n(true);},className:b("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Om({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[l,m]=useState(false),[i,c]=useState(e?.toString()||""),d=useRef(null);useEffect(()=>{l&&d.current&&(d.current.focus(),d.current.select());},[l]),useEffect(()=>{c(e?.toString()||"");},[e]);let u=()=>{let y=parseFloat(i);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);}m(false);},f=y=>{y.key==="Enter"?u():y.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):l?jsx("input",{ref:d,type:"number",value:i,onChange:y=>c(y.target.value),onBlur:u,onKeyDown:f,onClick:y=>y.stopPropagation(),min:o,max:s,className:b("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:y=>{y.stopPropagation(),m(true);},className:b("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function zm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),m=useRef(null);return useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:b("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:b("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("span",{className:b("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:b("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsx("div",{className:b("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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:b("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:b("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"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-[#3B82F6]"})]},i))})]})}function $m({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:b("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsx(Check,{className:"w-3 h-3 text-white"})})}function Gm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:b("text-sm",t?"text-[#6B7280]":"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-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:b("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function hy(e,t="en"){if(e==null||e===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?t==="es"?`${r}min`:`${r}m`:r===0?`${a}h`:t==="es"?`${a}h ${r}min`:`${a}h ${r}m`}function yy(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a){let l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r){let l=parseFloat(r[1]),m=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+m}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o)return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)?$/);if(s)return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n)}function sl({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false}){let [n,l]=useState(false),[m,i]=useState(""),c=useRef(null),u=hy(e,r);useEffect(()=>{n&&c.current&&(c.current.focus(),c.current.select());},[n]),useEffect(()=>{if(e){let k=Math.floor(e/60),g=e%60;k>0&&g>0?i(`${k}h ${g}m`):k>0?i(`${k}h`):i(`${g}m`);}else i("");},[e,n]);let f=()=>{let k=yy(m);k!==e&&t?.(k),l(false);},y=k=>{k.key==="Enter"?f():k.key==="Escape"&&l(false);};return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e&&e>0&&jsx(Clock,{className:b("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:u})]}):n?jsx("input",{ref:c,type:"text",value:m,onChange:k=>i(k.target.value),onBlur:f,onKeyDown:y,onClick:k=>k.stopPropagation(),placeholder:"1h 30m",className:b("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:k=>{k.stopPropagation(),l(true);},className:b("flex items-center gap-1.5 text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400"),children:[e&&e>0&&jsx(Clock,{className:b("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{children:u})]})}function Ay(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ly(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 Jm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let d=useRef(null),u=r==="es"?qm.es:qm.en;if(useEffect(()=>{let v=p=>{d.current&&!d.current.contains(p.target)&&t();},h=p=>{p.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:u.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),l&&(v.push({id:"status",label:u.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:u.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:u.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:u.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:u.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:u.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:u.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:u.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let p=e.task.assignees||[],x=p.some(S=>S.name===h.name)?p.filter(S=>S.name!==h.name):[...p,{name:h.name,initials:Ay(h.name),color:h.color||Ly(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:x}),t();}}))})),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:u.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:u.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},y=()=>{if(!e.columnId)return [];let v=[];return i&&(v.push({id:"sort-asc",label:u.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:u.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:u.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),v},k=e.type==="task"?f():y(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:d,style:g,className:b("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:k.map(v=>v.separator?jsx("div",{className:b("my-1 h-px",a?"bg-white/10":"bg-gray-200")},v.id):v.submenu?jsx(Iy,{item:v,isDark:a},v.id):jsxs("button",{onClick:v.onClick,className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:b(v.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Iy({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:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:b("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:b("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var qm={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"},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"}};var ep={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"}),elapsedTime:jsx(Timer,{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"})},Zy=["name","status","priority","assignees","startDate","endDate","progress","tags","estimatedTime","elapsedTime"];function ap({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[m,i]=useState(""),c=useRef(null),d=l==="es"?tp.es:tp.en;if(useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let h=w=>{c.current&&!c.current.contains(w.target)&&t();},p=w=>{w.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",p),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let u=v=>d.columns[v]||v,f=v=>{if(v==="name")return;let h=a.map(p=>p.id===v?{...p,visible:!p.visible}:p);o(h);},y=(v,h)=>{let p=a.find(x=>x.type===v&&(!h||x.customFieldId===h));if(p){f(p.id);return}let w={id:h||v,type:v,label:h?r.find(x=>x.id===h)?.name||v:u(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,w]);},k=Zy.filter(v=>u(v).toLowerCase().includes(m.toLowerCase())),g=r.filter(v=>v.name.toLowerCase().includes(m.toLowerCase()));return jsxs("div",{ref:c,className:b("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:b("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:b("font-medium",n?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:b("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:b("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:b("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:m,onChange:v=>i(v.target.value),placeholder:d.searchPlaceholder,className:b("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:b("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.standardFields}),jsx("div",{className:"space-y-1",children:k.map(v=>{let h=a.find(x=>x.type===v&&!x.customFieldId),p=h?.visible??false,w=v==="name";return jsxs("button",{onClick:()=>{w||(h?f(h.id):y(v));},disabled:w,className:b("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",w&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:b("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:ep[v]}),jsx("span",{className:n?"text-white":"text-gray-900",children:u(v)})]},v)})})]}),g.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:b("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:d.customFields}),jsx("div",{className:"space-y-1",children:g.map(v=>{let p=a.find(w=>w.customFieldId===v.id)?.visible??false;return jsxs("button",{onClick:()=>y(v.type,v.id),className:b("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:b("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:ep[v.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:v.name})]},v.id)})})]}),s&&jsx("div",{className:b("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:s,className:b("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.createField]})})]})}var tp={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",elapsedTime:"Time Spent",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",elapsedTime:"Tiempo",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var iv=[{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 np({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[l,m]=useState("text"),[i,c]=useState([""]),d=o==="es"?op.es:op.en;useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),useEffect(()=>{let g=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let u=()=>{if(!s.trim())return;let g={name:s.trim(),type:l};l==="dropdown"&&(g.options=i.filter(v=>v.trim())),a(g),t();},f=()=>{c([...i,""]);},y=(g,v)=>{let h=[...i];h[g]=v,c(h);},k=g=>{i.length>1&&c(i.filter((v,h)=>h!==g));};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:b("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:b("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsx("h2",{className:b("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:b("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:b("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:b("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:d.fieldNamePlaceholder,className:b("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:b("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:iv.map(g=>jsxs("button",{onClick:()=>m(g.type),className:b("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsx("span",{className:b("text-xs",l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[g.type]})]},g.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:b("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((g,v)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:g,onChange:h=>y(v,h.target.value),placeholder:`${d.option} ${v+1}`,className:b("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>k(v),className:b("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},v)),jsxs("button",{onClick:f,className:b("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:b("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:b("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:u,disabled:!s.trim(),className:b("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var op={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 lp={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 dp({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=useState(false),m=useRef(null),i=useRef(0),c=s==="es"?lp.es:lp.en;useEffect(()=>{if(!n)return;let f=k=>{Date.now()-i.current<100||m.current&&!m.current.contains(k.target)&&l(false);},y=k=>{k.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(y=>!y);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),c.filters,u&&jsx("span",{className:b("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxs("div",{className:b("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:b("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsx("span",{className:b("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(f=>{let y=e===f.value&&!t,k=()=>f.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxs("button",{onClick:()=>{a(f.value),r(false),l(false);},className:b("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:b(y?f.color:"text-gray-400","flex-shrink-0"),children:k()}),jsx("span",{className:b("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),y&&jsx(Check,{className:b("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsx("div",{className:b("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),l(false);},className:b("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsx(EyeOff,{className:b("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:b("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:b("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var Tv=[{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 gp(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(...gp(r.subtasks,t+1));return a}function Nv({status:e,progress:t}){return t===100||e==="completed"?jsx(CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsx(PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsx(Circle,{className:"w-5 h-5 text-gray-400"})}function fp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:d,showSearch:u=true,showHierarchy:f=true,tableColumns:y,allowColumnCustomization:k=true,allowColumnResize:g=true,enableContextMenu:v=true,showCreateTaskButton:h=false,onCreateTask:p}=t,w=ns(c,d),x=i==="dark",[S,T]=useState("startDate"),[C,A]=useState("asc"),[I,N]=useState(""),[z,R]=useState("all"),[_,se]=useState(false),[te,ie]=useState(y||Tv),[xe,Ne]=useState(false),[Ae,F]=useState(false),[B,E]=useState({isOpen:false,x:0,y:0,type:"task"}),[W,J]=useState(null),[ue,be]=useState(0),[Ce,Y]=useState(0),V=useRef(null);useEffect(()=>{y&&ie(y);},[y]);let Oe=useMemo(()=>{let H=new Set;function K(ke){for(let Ie of ke)Ie.subtasks?.length&&(Ie.isExpanded!==false&&H.add(Ie.id),K(Ie.subtasks));}return K(e),H},[e]),pe=useMemo(()=>te.filter(H=>H.visible),[te]),Le=useCallback(H=>{a.onTaskToggleExpand?.(H);},[a]),Je=useCallback(H=>{S===H?A(K=>K==="asc"?"desc":"asc"):(T(H),A("asc")),a.onSortChange?.({column:H,direction:C==="asc"?"desc":"asc"});},[S,C,a]),st=useCallback(H=>{ie(H),a.onColumnsChange?.(H);},[a]),Ge=useCallback(H=>{let K=te.map(ke=>ke.id===H?{...ke,visible:false}:ke);st(K);},[te,st]),bt=useCallback((H,K)=>{T(H),A(K);},[]),ut=useCallback((H,K,ke)=>{v&&(H.preventDefault(),E({isOpen:true,x:H.clientX,y:H.clientY,type:K?"task":"header",task:K,columnId:ke}));},[v]),Pt=useCallback(()=>{E(H=>({...H,isOpen:false}));},[]),ge=useCallback((H,K)=>{if(!g)return;H.preventDefault(),H.stopPropagation();let ke=te.find(Ie=>Ie.id===K);ke&&(J(K),be(H.clientX),Y(ke.width));},[te,g]);useEffect(()=>{if(!W)return;let H=ke=>{let Ie=ke.clientX-ue,_e=Math.max(50,Ce+Ie),We=te.map(ne=>ne.id===W?{...ne,width:_e}:ne);ie(We);},K=()=>{W&&a.onColumnsChange?.(te),J(null);};return document.addEventListener("mousemove",H),document.addEventListener("mouseup",K),()=>{document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",K);}},[W,ue,Ce,te,a]);let L=useCallback(async H=>{if(a.onCreateCustomField){let K={...H,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(K);}F(false);},[a]),re=useCallback(H=>H.progress===100||H.status==="completed"?"completed":H.progress&&H.progress>0||H.status==="in-progress"?"in-progress":"todo",[]),Te=useMemo(()=>{let H=gp(e);if(I.trim()){let K=I.toLowerCase();H=H.filter(ke=>ke.name.toLowerCase().includes(K));}return z!=="all"&&(H=H.filter(K=>re(K)===z)),_&&(H=H.filter(K=>re(K)!=="completed")),H.sort((K,ke)=>{let Ie,_e;switch(S){case "name":Ie=K.name.toLowerCase(),_e=ke.name.toLowerCase();break;case "startDate":Ie=K.startDate?.getTime()||0,_e=ke.startDate?.getTime()||0;break;case "endDate":Ie=K.endDate?.getTime()||0,_e=ke.endDate?.getTime()||0;break;case "progress":Ie=K.progress||0,_e=ke.progress||0;break;case "status":Ie=K.status||"todo",_e=ke.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};Ie=We[K.priority]??4,_e=We[ke.priority]??4;break;default:return 0}return Ie<_e?C==="asc"?-1:1:Ie>_e?C==="asc"?1:-1:0}),H},[e,I,z,_,S,C,re]),Ue=useCallback((H,K)=>{let ke=We=>{a.onTaskUpdate?.({...H,...We});},Ie=We=>We?H.customFields?.find(Be=>Be.fieldId===We)?.value:void 0,_e=(We,ne)=>{if(!We)return;let ee=[...H.customFields||[]],Ye=ee.findIndex(Pa=>Pa.fieldId===We);Ye>=0?ee[Ye]={fieldId:We,value:ne}:ee.push({fieldId:We,value:ne}),ke({customFields:ee});};switch(K.type){case "name":return null;case "status":return jsx(Cm,{value:H.status||(H.progress===100?"completed":H.progress&&H.progress>0?"in-progress":"todo"),onChange:ne=>{ke({status:ne,progress:ne==="completed"?100:ne==="in-progress"?50:0});},isDark:x,locale:c,translations:w.status});case "priority":return jsx(Nm,{value:H.priority,onChange:ne=>ke({priority:ne}),isDark:x,locale:c});case "assignees":return jsx(Sm,{value:H.assignees||[],availableUsers:l,onChange:ne=>ke({assignees:ne}),isDark:x,locale:c});case "startDate":return jsx(cs,{value:H.startDate,onChange:ne=>ke({startDate:ne}),isDark:x,locale:c});case "endDate":return jsx(cs,{value:H.endDate,onChange:ne=>ke({endDate:ne}),isDark:x,locale:c});case "progress":return jsx(Fm,{value:H.progress||0,onChange:ne=>{let Be=ne===100?"completed":ne>0?"in-progress":"todo";ke({progress:ne,status:Be});},isDark:x});case "tags":return jsx(Gm,{value:H.tags||[],isDark:x});case "text":return jsx(Im,{value:Ie(K.customFieldId)||"",onChange:ne=>_e(K.customFieldId,ne),isDark:x});case "number":return jsx(Om,{value:Ie(K.customFieldId)||0,onChange:ne=>_e(K.customFieldId,ne),isDark:x});case "date":let We=Ie(K.customFieldId);return jsx(cs,{value:We?new Date(We):void 0,onChange:ne=>_e(K.customFieldId,ne),isDark:x,locale:c});case "dropdown":return jsx(zm,{value:Ie(K.customFieldId)||"",options:K.options||[],onChange:ne=>_e(K.customFieldId,ne),isDark:x});case "checkbox":return jsx($m,{value:Ie(K.customFieldId)||false,onChange:ne=>_e(K.customFieldId,ne),isDark:x});case "estimatedTime":return jsx(sl,{value:H.estimatedTime,onChange:ne=>ke({estimatedTime:ne}),isDark:x,locale:c});case "elapsedTime":return jsx(sl,{value:H.elapsedTime,onChange:ne=>ke({elapsedTime:ne}),isDark:x,locale:c});default:return jsx("span",{className:b("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,c,l,w]),Z=useCallback(H=>{let ke={name:w.columns.name,status:w.columns.status,priority:w.columns.priority,assignees:w.columns.assignees,startDate:w.columns.startDate,endDate:w.columns.endDate,progress:w.columns.progress,tags:w.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:w.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),elapsedTime:w.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent")}[H.type]||H.label;return typeof ke=="string"?ke:String(ke||H.type)},[w,c]),Re=useMemo(()=>pe.reduce((H,K)=>H+K.width,0)+(k?48:0),[pe,k]);return r?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"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-[#3B82F6]"}),jsxs("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[w.empty.noTasks,"..."]})]})}):o?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"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:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"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-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:w.empty.noTasks}),jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:w.empty.addFirstTask})]})}):jsxs("div",{ref:V,className:b("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",W&&"select-none",s),style:n,children:[jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(dp,{value:z,hideCompleted:_,onChange:R,onHideCompletedChange:se,isDark:x,locale:c}),jsxs("div",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[Te.length," ",w.pagination.tasks]}),u&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:b("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:I,onChange:H=>N(H.target.value),placeholder:w.toolbar.searchPlaceholder,className:b("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),h&&p&&jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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-4 h-4"}),jsx("span",{children:w.toolbar.newTask})]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:Re},children:[jsxs("div",{className:b("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[pe.map(H=>jsxs("div",{className:b("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:H.width,minWidth:H.minWidth},onContextMenu:K=>ut(K,void 0,H.id),children:[H.sortable?jsxs("button",{onClick:()=>Je(H.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[Z(H),jsx(ArrowUpDown,{className:b("w-3 h-3",S===H.id&&"text-[#3B82F6]")})]}):jsx("span",{children:Z(H)}),g&&H.resizable&&jsx("div",{className:b("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",W===H.id&&"bg-[#3B82F6]"),onMouseDown:K=>ge(K,H.id)})]},H.id)),k&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:H=>{H.stopPropagation(),Ne(K=>!K);},className:b("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",xe&&(x?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx(ap,{isOpen:xe,onClose:()=>Ne(false),columns:te,customFields:m,onColumnsChange:st,onCreateCustomField:()=>{Ne(false),F(true);},isDark:x,locale:c})]})]}),jsx(AnimatePresence,{children:Te.map((H,K)=>{let ke=Oe.has(H.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:K*.02},className:b("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(H),onDoubleClick:()=>a.onTaskDoubleClick?.(H),onContextMenu:Ie=>ut(Ie,H),children:[pe.map(Ie=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Ie.width,minWidth:Ie.minWidth},children:Ie.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&H.level>0&&jsx("div",{style:{width:`${H.level*24}px`},className:"flex-shrink-0"}),f&&H.hasChildren&&jsx("button",{onClick:_e=>{_e.stopPropagation(),Le(H.id);},className:b("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:ke?jsx(ChevronDown,{className:b("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:b("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),f&&!H.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("button",{onClick:_e=>{_e.stopPropagation(),a.onTaskUpdate?.({...H,progress:H.progress===100?0:100,status:H.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(Nv,{status:H.status,progress:H.progress})}),jsx("span",{className:b("truncate font-medium",x?"text-white":"text-gray-900",H.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:H.name})]}):Ue(H,Ie)},Ie.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},H.id)})}),Te.length===0&&I&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:b("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:b(x?"text-[#9CA3AF]":"text-gray-600"),children:w.empty.noResults})]})})]})}),jsx(Jm,{state:B,onClose:Pt,isDark:x,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ge,onColumnSort:bt,availableUsers:l}),jsx(np,{isOpen:Ae,onClose:()=>F(false),onSave:L,isDark:x,locale:c})]})}var bp=[{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:"estimatedTime",type:"estimatedTime",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"elapsedTime",type:"elapsedTime",label:"Time Spent",width:100,visible:false,sortable:true,resizable:true}],hp=[{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:"estimatedTime",labelKey:"columns.estimatedTime",icon:"Clock"},{type:"elapsedTime",labelKey:"columns.elapsedTime",icon:"Timer"}],yp=[{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 dl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},cl={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"},ml={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"},us={dark:dl,light:cl,neutral:ml};function vp(e){return us[e]||us.dark}var pl={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"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},ul={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"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},gs={en:pl,es:ul};function an(e){return gs[e]||gs.en}function fs(e,t){let a=an(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 xp(e){let t=an(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 kp(e,t=0,a=true){let r=an(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 Dp(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 fl(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 Sp({task:e}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Pp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:u,currentUser:f,mentionableUsers:y,onUploadCommentAttachments:k,onTaskOpen:g}){let{theme:v="dark",locale:h="en",customTranslations:p}=t,w=fs(h,p),x=v==="dark",[S,T]=useState(r||new Date),[C,A]=useState(null),[I,N]=useState(null),[z,R]=useState({}),_=4,se=3,[te,ie]=useState(null),[xe,Ne]=useState(""),[Ae,F]=useState(void 0),[B,E]=useState(null),[W,J]=useState(false),[ue,be]=useState(false),[Ce,Y]=useState(null),[V,Oe]=useState(false),[pe,Le]=useState(new Date),Je=useCallback(()=>{T(new Date(S.getFullYear(),S.getMonth()-1,1));},[S]),st=useCallback(()=>{T(new Date(S.getFullYear(),S.getMonth()+1,1));},[S]),Ge=useCallback(()=>{T(new Date);},[]),bt=useMemo(()=>{let ge=S.getFullYear(),L=S.getMonth(),re=new Date(ge,L,1),Te=new Date(ge,L+1,0),Ue=re.getDay(),Z=Te.getDate(),Re=Dp(e),H=new Date;H.setHours(0,0,0,0);let K=[],ke=Ue,Ie=new Date(ge,L,0).getDate();for(let We=ke-1;We>=0;We--){let ne=new Date(ge,L-1,Ie-We);K.push({date:ne,isCurrentMonth:false,isToday:false,isWeekend:ne.getDay()===0||ne.getDay()===6,events:Re.filter(Be=>fl(ne,Be)).map(Be=>({id:Be.id,title:Be.name,start:Be.startDate,end:Be.endDate,task:Be}))});}for(let We=1;We<=Z;We++){let ne=new Date(ge,L,We),Be=ne.getTime()===H.getTime();K.push({date:ne,isCurrentMonth:true,isToday:Be,isWeekend:ne.getDay()===0||ne.getDay()===6,events:Re.filter(ee=>fl(ne,ee)).map(ee=>({id:ee.id,title:ee.name,start:ee.startDate,end:ee.endDate,task:ee}))});}let _e=42-K.length;for(let We=1;We<=_e;We++){let ne=new Date(ge,L+1,We);K.push({date:ne,isCurrentMonth:false,isToday:false,isWeekend:ne.getDay()===0||ne.getDay()===6,events:Re.filter(Be=>fl(ne,Be)).map(Be=>({id:Be.id,title:Be.name,start:Be.startDate,end:Be.endDate,task:Be}))});}return K},[S,e]),ut=h==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Pt=S.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[w.labels.noEvents,"..."]})]})}):s?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"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:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:b("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:b("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:w.labels.noEvents}),jsx("p",{className:b("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:w.labels.newTask})]})}):jsxs("div",{className:b("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:b("text-xl font-semibold capitalize",x?"text-white":"text-gray-900"),children:Pt}),jsx("button",{onClick:Ge,className:b("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:w.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:Je,className:b("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:b("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:st,className:b("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:b("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:ut.map(ge=>jsx("div",{className:b("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:ge},ge))}),jsx("div",{className:b("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:bt.map((ge,L)=>{let re=ge.date.getDay()===0||ge.date.getDay()===6;return jsxs("div",{className:b("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?re?"bg-[#1C1F26]":ge.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":re?"bg-gray-100":ge.isCurrentMonth?"bg-white":"bg-gray-50",ge.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Te=z[L]||_,Ue=ge.events.slice(0,Te),Z=ge.events.length-Te;return jsxs("div",{className:"space-y-1 flex-1",children:[Ue.map(Re=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{A(Re.task),a.onEventClick?.(Re),g?.(Re.task.id);},whileHover:{scale:1.02},className:b("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Re.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(Sp,{task:Re.task}),jsx("span",{className:"truncate",children:Re.title})]})},Re.id)),Z>0&&jsxs("button",{onClick:Re=>{Re.stopPropagation(),R(H=>({...H,[L]:Te+se}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Z," ",h==="es"?"M\xC1S":"MORE"]}),Te>_&&ge.events.length>_&&jsx("button",{onClick:Re=>{Re.stopPropagation(),R(H=>({...H,[L]:_}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:h==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Te=L>=28,Ue=L%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Z=>{Z.stopPropagation(),te===L?ie(null):(ie(L),Ne(""),F(void 0),E(null),Y(null),J(false),be(false),Oe(false),Le(ge.date));},className:b("w-5 h-5 rounded flex items-center justify-center transition-all",te===L?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:b("w-3.5 h-3.5 transition-transform",te===L&&"rotate-45")})}),jsx(AnimatePresence,{children:te===L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ie(null),Ne(""),F(void 0),E(null),Y(null),J(false),be(false),Oe(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Te?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Te?-5:5,scale:.95},transition:{duration:.12},className:b("absolute w-[320px] rounded-lg shadow-2xl z-50",Te?"bottom-full mb-1":"top-full mt-1",Ue?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>{Z.stopPropagation(),J(false),be(false),Oe(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:xe,onChange:Z=>Ne(Z.target.value),placeholder:h==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:b("w-full bg-transparent text-sm outline-none placeholder:opacity-40",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Z=>{if(Z.key==="Enter"&&xe.trim()){let Re=t.availableUsers?.find(K=>K.id===B),H=Ce||ge.date;a.onTaskCreate?.({name:xe.trim(),startDate:H,endDate:H,priority:Ae,assignees:Re?[Re]:void 0}),Ne(""),F(void 0),E(null),Y(null),ie(null);}Z.key==="Escape"&&(ie(null),Ne(""),F(void 0),E(null),Y(null));}})}),jsxs("div",{className:b("px-2.5 py-2 flex items-center justify-between border-t",x?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:Z=>{Z.stopPropagation(),J(!W),be(false);},className:b("p-1 rounded transition-colors",Ae?Ae==="urgent"||Ae==="high"?"text-red-400 bg-red-500/20":Ae==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:W&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[{id:"urgent",label:h==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:h==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:h==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:h==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:h==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Z=>jsxs("button",{onClick:()=>{F(Z.id),J(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Ae===Z.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:b("w-2 h-2 rounded-full",Z.color)}),jsx("span",{className:x?"text-white":"text-gray-900",children:Z.label})]},Z.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:Z=>{Z.stopPropagation(),Oe(!V),J(false),be(false),Le(Ce||ge.date);},className:b("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Ce?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(Ce||ge.date).toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:V&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsx("div",{className:b("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let Z=new Date,Re=new Date(Z);Re.setDate(Z.getDate()+1);let H=new Date(Z);H.setDate(Z.getDate()+((6-Z.getDay()+7)%7||7));let K=new Date(Z);K.setDate(Z.getDate()+((1-Z.getDay()+7)%7||7));let ke=new Date(Z);ke.setDate(Z.getDate()+14);let Ie=new Date(Z);return Ie.setDate(Z.getDate()+28),[{label:h==="es"?"Hoy":"Today",date:Z,display:Z.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Ma\xF1ana":"Tomorrow",date:Re,display:Re.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Este fin de semana":"This weekend",date:H,display:h==="es"?"s\xE1b.":"sat."},{label:h==="es"?"Pr\xF3xima semana":"Next week",date:K,display:h==="es"?"lun.":"mon."},{label:h==="es"?"2 semanas":"2 weeks",date:ke,display:ke.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:h==="es"?"4 semanas":"4 weeks",date:Ie,display:Ie.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((We,ne)=>jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Y(We.date),Oe(false);},children:[jsx("span",{children:We.label}),jsx("span",{className:b("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:We.display})]},ne))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:b("text-xs font-medium",x?"text-white":"text-gray-900"),children:pe.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>Le(new Date),className:b("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:h==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Le(new Date(pe.getFullYear(),pe.getMonth()-1)),className:b("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>Le(new Date(pe.getFullYear(),pe.getMonth()+1)),className:b("p-0.5 rounded",x?"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:(h==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Z=>jsx("div",{className:b("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:Z},Z))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Z=pe.getFullYear(),Re=pe.getMonth(),H=new Date(Z,Re,1).getDay(),K=new Date(Z,Re+1,0).getDate(),ke=new Date(Z,Re,0).getDate(),Ie=new Date,_e=[];for(let ne=H-1;ne>=0;ne--)_e.push({dayNum:ke-ne,isCurrentMonth:false,date:new Date(Z,Re-1,ke-ne)});for(let ne=1;ne<=K;ne++)_e.push({dayNum:ne,isCurrentMonth:true,date:new Date(Z,Re,ne)});let We=42-_e.length;for(let ne=1;ne<=We;ne++)_e.push({dayNum:ne,isCurrentMonth:false,date:new Date(Z,Re+1,ne)});return _e.map((ne,Be)=>{let ee=ne.date.toDateString()===Ie.toDateString(),Ye=(Ce||ge.date).toDateString()===ne.date.toDateString();return jsx("button",{className:b("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ne.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),ne.isCurrentMonth&&(x?"text-white":"text-gray-900"),ee&&"ring-1 ring-[#3B82F6]",Ye&&"bg-[#7C3AED] text-white",!Ye&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Y(ne.date),Oe(false);},children:ne.dayNum},Be)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:Z=>{Z.stopPropagation(),be(!ue),J(false);},className:b("p-1 rounded transition-colors",B?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:B?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(Z=>Z.id===B)?.color||"#7C3AED"},children:t.availableUsers?.find(Z=>Z.id===B)?.initials||t.availableUsers?.find(Z=>Z.id===B)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:ue&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Z=>Z.stopPropagation(),children:[jsxs("button",{onClick:()=>{E(null),be(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!B&&(x?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:b("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:h==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Z=>jsxs("button",{onClick:()=>{E(Z.id),be(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",B===Z.id&&(x?"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-medium",style:{backgroundColor:Z.color||"#7C3AED"},children:Z.initials||Z.name?.slice(0,2).toUpperCase()}),jsx("span",{className:x?"text-white":"text-gray-900",children:Z.name})]},Z.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:b("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:h==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(xe.trim()){let Z=t.availableUsers?.find(H=>H.id===B),Re=Ce||ge.date;a.onTaskCreate?.({name:xe.trim(),startDate:Re,endDate:Re,priority:Ae,assignees:Z?[Z]:void 0}),Ne(""),F(void 0),E(null),Y(null),ie(null);}},disabled:!xe.trim(),className:b("px-2.5 py-1 rounded text-xs font-medium transition-colors",xe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:h==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:b("text-sm font-medium",ge.isToday?"text-[#3B82F6]":ge.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:ge.date.getDate()})]})]},L)})})]})}),jsx(fr,{task:C,isOpen:!!C,onClose:()=>A(null),onTaskUpdate:ge=>{a.onTaskUpdate?.(ge),A(ge);},theme:v==="dark"?"dark":"light",locale:h,availableUsers:t.availableUsers?.map(ge=>({id:ge.id,name:ge.name,avatar:ge.avatar,initials:ge.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:C?c?.get(C.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Dp(e).filter(ge=>ge.id!==C?.id),comments:d?.filter(ge=>ge.taskId===C?.id).map(ge=>({...ge,createdAt:ge.createdAt instanceof Date?ge.createdAt:new Date(ge.createdAt),updatedAt:ge.updatedAt instanceof Date?ge.updatedAt:ge.updatedAt?new Date(ge.updatedAt):void 0})),onAddComment:u,currentUser:f,mentionableUsers:y,onUploadCommentAttachments:k}),jsx(AnimatePresence,{children:I&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(null),className:"fixed inset-0 bg-black/30 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:b("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",x?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:b("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsx("span",{className:b("font-medium",x?"text-white":"text-gray-900"),children:I.date.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>N(null),className:b("p-1 rounded",x?"hover:bg-white/10 text-[#9CA3AF]":"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-2",children:I.events.map(ge=>jsxs("button",{onClick:()=>{N(null),A(ge.task),g?.(ge.task.id);},className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(Sp,{task:ge.task}),jsx("span",{className:b("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:ge.title}),ge.task.priority==="high"||ge.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},ge.id))})]})]})})]})}var bl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},hl={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"},yl={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"},bs={dark:bl,light:hl,neutral:yl};function Mp(e){return bs[e]||bs.dark}function Bv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[m,i]=useState(false),c=useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=useMemo(()=>{let f=c.length,y=new Set(c.flatMap(v=>v.assignedUserIds||[])).size,k=c.map(v=>v.priority).filter(Boolean),g=new Set(c.flatMap(v=>v.labels||[])).size;return {totalCards:f,uniqueAssignees:y,priorities:k,labels:g}},[c]),u=()=>{o?.(e.id);};return jsxs("div",{className:b("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:u,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:b("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:f=>{f.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:c.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:c.map(f=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsx("h4",{children:f.title}),f.description&&jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Ap={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function on(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 nn(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 Lp(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 Ip({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let m=useMemo(()=>({...Ap,...n}),[n]),[i,c]=useState(new Set),d=useRef(null),u=useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(p=>{let w=p.timestamp.toISOString().split("T")[0],x=h.get(w);x?x.push(p):h.set(w,[p]);}),Array.from(h.entries()).sort((p,w)=>w[0].localeCompare(p[0])).map(([p,w])=>({date:new Date(p),events:w.sort((x,S)=>S.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:f,uniqueTypes:y}=useMemo(()=>{let h=new Set,p=new Set;return e.forEach(w=>{h.add(w.userId),p.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(p)}},[e]),k=h=>{c(p=>{let w=new Set(p);return w.has(h)?w.delete(h):w.add(h),w});},g=h=>{let w=new Date().getTime()-h.getTime(),x=Math.floor(w/6e4),S=Math.floor(w/36e5),T=Math.floor(w/864e5);return x<1?"just now":x<60?`${x}m ago`:S<24?`${S}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},v=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&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:b("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:b("history-timeline",m.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let p=h.target.value;a({...t,types:p?[p]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxs("option",{value:h,children:[nn(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let p=h.target.value;a({...t,users:p?[p]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),f.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})})]}),v>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:u.map(h=>jsxs("div",{className:"history-timeline-group",children:[m.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((p,w)=>{let x=i.has(p.id),S=s===p.id,T=Lp(p.type);return jsxs("div",{"data-event-id":p.id,className:b("history-timeline-event",x&&"expanded",S&&"selected"),onClick:()=>o?.(p),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:nn(p.type)})}),w<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),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:[m.showAvatars&&p.userAvatar&&jsx("img",{src:p.userAvatar,alt:p.userName||p.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:p.userName||p.userId}),jsx("span",{className:"history-timeline-event-action",children:on(p)})]})]}),jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(p.timestamp):p.timestamp.toLocaleString()})]}),Object.keys(p.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),k(p.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(p.changes).map(([C,A])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(A.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},C)),p.metadata&&Object.keys(p.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(p.metadata).map(([C,A])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(A)})]},C))]})]})]})]},p.id)})})]},h.date?.toISOString()||"all"))})]})}function Rp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:b("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:b("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&nn(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&on(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:f=>l(parseInt(f.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((f,y)=>jsx("div",{className:b("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:on(f)},f.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:c.map(f=>jsxs("button",{className:b("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>m(f),children:[f,"x"]},f))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(f=>jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxs("div",{className:b("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 vl(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 xl(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 Op(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 zp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Hv(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let d=a/2,u=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(u-c.y)*o.centerForce*i,n.forEach(f=>{if(c.id===f.id)return;let y=c.x-f.x,k=c.y-f.y,g=Math.sqrt(y*y+k*k)||1,v=o.chargeStrength*i/(g*g);c.vx+=y/g*v,c.vy+=k/g*v;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),u=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!u)return;let f=u.x-d.x,y=u.y-d.y,k=Math.sqrt(f*f+y*y)||1,g=(k-o.linkDistance)/k*o.forceStrength*i;d.vx+=f*g,d.vy+=y*g,u.vx-=f*g,u.vy-=y*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Up({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:m}){let i=useRef(null),[c,d]=useState([]),[u,f]=useState(null),[y,k]=useState(null),[g,v]=useState(null),[h,p]=useState(1),[w,x]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let R=Hv(e,t,a.width,a.height,a,150);d(R);},[e,t,a]);let S=useCallback((R,_)=>{a.enableDragging&&(_.stopPropagation(),f(R));},[a.enableDragging]),T=useCallback(R=>{if(!u||!i.current)return;let se=i.current.getBoundingClientRect(),te=(R.clientX-se.left-w.x)/h,ie=(R.clientY-se.top-w.y)/h;d(xe=>xe.map(Ne=>Ne.id===u?{...Ne,x:te,y:ie,fx:te,fy:ie}:Ne));},[u,h,w]),C=useCallback(()=>{f(null);},[]),A=useCallback((R,_)=>{_.stopPropagation(),l?.({type:"node-click",node:R,position:{x:_.clientX,y:_.clientY}});},[l]),I=useCallback((R,_)=>{_.stopPropagation(),l?.({type:"edge-click",edge:R,position:{x:_.clientX,y:_.clientY}});},[l]),N=useCallback(R=>{let _=c.find(se=>se.id===R);return _?{x:_.x,y:_.y}:{x:0,y:0}},[c]),z=useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let _=R.card.priority;return _==="URGENT"?"#ef4444":_==="HIGH"?"#f59e0b":_==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:b("relationships-graph-empty",m),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:b("relationships-graph",m),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:()=>p(R=>Math.min(R+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>p(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{p(1),x({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:vl(R)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Op(R)," ",xl(R)]})]},R))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:C,onMouseLeave:C,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let _=N(typeof R.source=="string"?R.source:R.source.id),se=N(typeof R.target=="string"?R.target:R.target.id),te=zp(R.type),ie=g===R.id,xe=R.onCriticalPath;return jsxs("g",{className:b("relationships-graph-edge",ie&&"hovered",xe&&"critical"),onMouseEnter:()=>v(R.id),onMouseLeave:()=>v(null),onClick:Ne=>I(R,Ne),children:[jsx("line",{x1:_.x,y1:_.y,x2:se.x,y2:se.y,stroke:vl(R.type),strokeWidth:xe?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ie?1:.6,markerEnd:te?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ie&&jsx("text",{x:(_.x+se.x)/2,y:(_.y+se.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:xl(R.type)})]},R.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(R=>{let _=y===R.id,se=R.onCriticalPath;return jsxs("g",{className:b("relationships-graph-node",_&&"hovered",se&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:te=>S(R.id,te),onMouseEnter:()=>k(R.id),onMouseLeave:()=>k(null),onClick:te=>A(R,te),children:[jsx("circle",{r:se?a.nodeSize*1.2:a.nodeSize,fill:z(R),stroke:se?"#fbbf24":"#ffffff",strokeWidth:se?3:2,opacity:_?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.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 Wp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[l,m]=useState(false),[i,c]=useState(null),[d,u]=useState(null),f=useRef(null),y=l||o;useEffect(()=>{e&&f.current&&f.current.focus();},[e]),useEffect(()=>{let h=p=>{p.key==="Escape"&&!y&&k();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let k=()=>{y||(n(""),c(null),u(null),t());},g=async()=>{if(!(!s.trim()||y)){m(true),c(null),u(null);try{let h=await r(s.trim());u(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{d&&(a(d),k());};return e?jsxs(gt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),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:k,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((h,p)=>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},p))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((h,p)=>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})]})},p)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:f,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:y}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,p)=>jsx("button",{onClick:()=>n(h),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},p))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:k,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:g,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var kl={"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 Gv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},_v={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 Vv(e,t,a){let r=kl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function sn(e){return `$${e.toFixed(4)}`}var wl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Vv(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,u)=>d+u.cost,0),s=a.reduce((d,u)=>d+u.inputTokens,0),n=a.reduce((d,u)=>d+u.outputTokens,0),l=a.filter(d=>d.success),m=a.reduce((d,u)=>d+u.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:m,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},so=new wl;function Vp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(so.getStats()),[s,n]=useState(so.checkLimit(a));if(useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(so.getStats()),n(so.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let l=so.getRecentOperations(5);return jsxs(gt,{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:m=>m.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:sn(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(([m,i])=>{let c=r.costsByFeature[m]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.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:sn(c)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(m=>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:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:sn(m.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.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 Yp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[m,i]=useState(""),[c,d]=useState(""),[u,f]=useState(false),[y,k]=useState(null),[g,v]=useState(null),[h,p]=useState(null),w=useRef(null),x=u||o;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let I=N=>{N.key==="Escape"&&!x&&S();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,x]);let S=()=>{x||(l(""),i(""),d(""),k(null),v(null),p(null),t());},T=async()=>{if(!(!n.trim()||x)){f(true),k(null),v(null),p(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});v(I.tasks.tasks),p({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){k(I instanceof Error?I.message:"Failed to generate tasks");}finally{f(false);}}},C=()=>{g&&(a(g),S());};if(!e)return null;let A=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(gt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:I=>I.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:S,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:g?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 (",A,"% 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:[g.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((I,N)=>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:["#",N+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:I.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),I.start," \u2192 ",I.end]}),jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:n,onChange:I=>l(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:x}),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:m,onChange:I=>i(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:x})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:x})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((I,N)=>jsx("button",{onClick:()=>l(I),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:I},N))})]})]})}),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:S,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"}),g?jsx("button",{onClick:C,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:T,disabled:!n.trim()||x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function vs({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(g=>{t&&hn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,p)=>{console.warn(`Retry attempt ${h} after ${p}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=useCallback(async(g,v,h)=>{r(p=>{let w=p.cards.find(I=>I.id===g);if(!w)return p;let x=w.columnId,S={...w,columnId:v,position:h},T=p.cards.map(I=>I.id===g?S:I),C=p.columns.map(I=>{if(I.id===x)return {...I,cardIds:I.cardIds.filter(N=>N!==g)};if(I.id===v){let N=T.filter(z=>z.columnId===v).sort((z,R)=>z.position-R.position);return {...I,cardIds:N.map(z=>z.id)}}return I}),A={...p,cards:T,columns:C};return o(A),A});},[o]),n=useCallback(async(g,v)=>{r(h=>{let p=h.cards.map(x=>x.id===g?{...x,...v}:x),w={...h,cards:p};return o(w),w});},[o]),l=useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v},w=h.columns.map(S=>S.id===g.columnId?{...S,cardIds:[...S.cardIds,v]}:S),x={...h,cards:[...h.cards,p],columns:w};return o(x),x});},[o]),m=useCallback(async g=>{r(v=>{let h=v.cards.find(S=>S.id===g);if(!h)return v;let p=v.cards.filter(S=>S.id!==g),w=v.columns.map(S=>S.id===h.columnId?{...S,cardIds:S.cardIds.filter(T=>T!==g)}:S),x={...v,cards:p,columns:w};return o(x),x});},[o]),i=useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v,cardIds:[]},w={...h,columns:[...h.columns,p]};return o(w),w});},[o]),c=useCallback(async(g,v)=>{r(h=>{let p=h.columns.map(x=>x.id===g?{...x,...v}:x),w={...h,columns:p};return o(w),w});},[o]),d=useCallback(async g=>{r(v=>{let h=v.cards.filter(x=>x.columnId!==g),p=v.columns.filter(x=>x.id!==g),w={...v,cards:h,columns:p};return o(w),w});},[o]),u=useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),v},[l]),f=useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),v},[i]),y=useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:u,addColumn:f,deleteCard:m,deleteColumn:d,clearBoard:y}}}function Xp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=vs({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:i??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var ln={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Zp={by:"none",order:"asc"};function Qp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...ln,...e}),[s,n]=useState({...Zp,...t}),l=useCallback(k=>{o(g=>({...g,...k}));},[]),m=useCallback(k=>{n(g=>({...g,...k}));},[]),i=useCallback(()=>{o(ln),n(Zp);},[]),c=useCallback(()=>{a&&o({...ln,assignees:[a]});},[a]),d=useCallback(()=>{o({...ln,dateFilter:"overdue"});},[]),u=useCallback(()=>{o({...ln,priorities:["HIGH","URGENT"]});},[]),f=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=useCallback(k=>{let g=[...k];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),p=String(v.getMonth()+1).padStart(2,"0"),w=String(v.getDate()).padStart(2,"0"),x=`${h}-${p}-${w}`;g=g.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let T=S.endDate||S.dueDate;if(!T)return false;let C;if(typeof T=="string")C=T.split("T")[0]||T;else {let A=T.getUTCFullYear(),I=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");C=`${A}-${I}-${N}`;}switch(r.dateFilter){case "overdue":return C<x;case "today":return C===x;case "this-week":let A=new Date(x+"T00:00:00"),I=new Date(C+"T00:00:00"),N=new Date(A);return N.setDate(N.getDate()+7),I>=A&&I<=N;case "custom":if(r.dateRange){let z=typeof T=="string"?new Date(T):T;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(p=>r.assignees.includes(p)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let p=0;switch(s.by){case "created":let w=v.createdAt?new Date(v.createdAt).getTime():0,x=h.createdAt?new Date(h.createdAt).getTime():0;p=w-x;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=S[v.priority||"LOW"],C=S[h.priority||"LOW"];p=T-C;break;case "dueDate":let A=v.endDate||v.dueDate,I=h.endDate||h.dueDate;if(!A)return 1;if(!I)return -1;let N=typeof A=="string"?new Date(A).getTime():A.getTime(),z=typeof I=="string"?new Date(I).getTime():I.getTime();p=N-z;break;case "title":p=v.title.localeCompare(h.title);break;case "estimate":let R=v.estimatedTime||0,_=h.estimatedTime||0;p=R-_;break;default:p=0;}return s.order==="asc"?p:-p}),g},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:u,applyFilters:y,hasActiveFilters:f}}var tu,au;if(typeof window<"u")try{let e=gn("ai");tu=e.generateObject,au=e.generateText;}catch{}function ru(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(tu&&au&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let f=u instanceof Error?u:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let f=u instanceof Error?u:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("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(u){let f=u instanceof Error?u:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(u){let f=u instanceof Error?u:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(u){let f=u instanceof Error?u:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function Tl(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function ou(e){let{cards:t}=e,[a,r]=Tl(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,u)=>{if(!u){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=u.ctrlKey||u.metaKey,y=u.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let k=t.find(v=>v.id===d),g=t.find(v=>v.id===a.lastSelectedCardId);if(k&&g&&k.columnId===g.columnId){let v=t.filter(C=>C.columnId===k.columnId).sort((C,A)=>C.position-A.position),h=v.findIndex(C=>C.id===a.lastSelectedCardId),p=v.findIndex(C=>C.id===d),[w,x]=h<p?[h,p]:[p,h],S=v.slice(w,x+1).map(C=>C.id),T=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:T,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(u=>u!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:m,toggleCard:i,getSelectedCards:c}}var nu={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function su(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...nu,...a}),[a]),[s,n]=useState([]),l=useCallback((k,g,v,h,p)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:g,columnId:v,strategy:h,color:p,isExpanded:true,position:s.filter(x=>x.columnId===v).length,createdAt:new Date};n(x=>[...x,w]);},[o.minCardsPerStack,s]),m=useCallback(k=>{n(g=>g.filter(v=>v.id!==k));},[]),i=useCallback(k=>{n(g=>g.map(v=>v.id===k?{...v,isExpanded:!v.isExpanded}:v));},[]),c=useCallback((k,g)=>{n(v=>v.map(h=>h.id===k&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=useCallback((k,g)=>{n(v=>v.map(h=>{if(h.id===k){let p=h.cardIds.filter(w=>w!==g);return p.length<o.minCardsPerStack?null:{...h,cardIds:p}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),u=useCallback(k=>s.filter(g=>g.columnId===k).sort((g,v)=>g.position-v.position),[s]),f=useCallback(async k=>{let g=t.filter(x=>x.columnId===k);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(S=>{h.has(S)||h.set(S,[]),h.get(S).push(x);});}),h.forEach((x,S)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:x.map(T=>T.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${S}"`,confidence:.85});});let p=new Map;g.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(S=>{p.has(S)||p.set(S,[]),p.get(S).push(x);});}),p.forEach((x,S)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:x.map(T=>T.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(g.forEach(x=>{x.priority&&(w.has(x.priority)||w.set(x.priority,[]),w.get(x.priority).push(x));}),w.forEach((x,S)=>{if(x.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";v.push({stack:{title:`${T} ${S} Priority`,cardIds:x.map(C=>C.id),columnId:k,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${S} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of g){let T=(await r.findSimilar(x,g)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let C=[x.id,...T.map(I=>I.card.id)],A=T.reduce((I,N)=>I+N.similarity,0)/T.length;v.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:C,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:A});}}return v.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,S)=>S.confidence-x.confidence).slice(0,5)},[t,o,r]),y=useCallback(k=>{l(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await f(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:l,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:u,getSuggestions:f,applySuggestion:y,config:o}}var iu=createContext(null);function lu({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=gn("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=gn("@libxai/core");n.set(m.id,new i(m));});let l=null;if(t?.board){let{Board:m}=gn("@libxai/core");l=new m(t.board);}r.current=new BoardStore({board:l,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(iu.Provider,{value:{store:o},children:e})}function xs(){let e=useContext(iu);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function cn(){let e=xs(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=useCallback(h=>{e.updateBoard(h);},[e]),m=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,p)=>{e.updateColumn(h,p);},[e]),c=useCallback(h=>{e.deleteColumn(h);},[e]),d=useCallback(h=>e.getColumn(h),[e]),u=useCallback(h=>{e.addCard(h);},[e]),f=useCallback((h,p)=>{e.updateCard(h,p);},[e]),y=useCallback(h=>{e.deleteCard(h);},[e]),k=useCallback((h,p,w)=>{e.moveCard(h,p,w);},[e]),g=useCallback(h=>e.getCard(h),[e]),v=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:d,addCard:u,updateCard:f,deleteCard:y,moveCard:k,getCard:g,getCardsByColumn:v}}function cu(e){let{cards:t}=cn();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 mu(e="position",t="asc"){let{cards:a}=cn();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=m-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 ks=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=rd.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},lx=new ks;function uu({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:m}){let i=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:u,className:o,children:jsx("div",{style:f,children:d.map(y=>{let k=e[y.index];if(!k)return null;let g=m?m(k,y.index):y.index,v={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsx("div",{style:v,"data-index":y.index,children:r(k,y.index)},g)})})})}function gu(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 bu({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:m,horizontal:i=true}){let c=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),u=d.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:c,style:f,className:s,children:jsx("div",{style:y,children:u.map(k=>{let g=e[k.index];if(!g)return null;let v=m?m(g,k.index):k.index,h={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsx("div",{style:h,"data-index":k.index,children:o(g,k.index)},v)})})})}function hu(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 yu(e,t=10){return e>t}var El={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Pl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Ml={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Al={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ll={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Il={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Bl={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)"},Rl={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)"},Ol={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},zl={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}},Ul={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}},ws={spacing:El,borderRadius:Pl,fontSize:Ml,fontWeight:Fl,lineHeight:Al,zIndex:Ll,duration:Il,easing:Bl,shadows:Rl,opacity:Ol,kanban:zl,gantt:Ul};function vu(e,t,a){return e[t]??a}function $l(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)?$l(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function mx(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Hl(e="asakaa"){let t=$l(ws),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=mx(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
390
390
|
${a.join(`
|
|
391
391
|
`)}
|
|
392
392
|
}`}function mn(e,t="asakaa"){let a=[],r=$l(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
@@ -416,5 +416,5 @@ ${mn(Gl,"asakaa").split(`
|
|
|
416
416
|
`)}
|
|
417
417
|
}
|
|
418
418
|
`}var px=({theme:e})=>{switch(e){case "dark":return jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function ku({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=wo();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let m=n,i=m===r;return jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(px,{theme:m})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},m)})})}
|
|
419
|
-
export{Vp as AIUsageDashboard,_v as AI_FEATURES,kl as AI_MODELS,Zs as AddCardButton,Js as AddColumnButton,dr as AttachmentUploader,lu as BoardProvider,In as BulkOperationsToolbar,ci as BurnDownChart,yp as CUSTOM_FIELD_TYPES,Pp as CalendarBoard,gr as Card,oi as CardDetailModal,ii as CardDetailModalV2,Rp as CardHistoryReplay,Ip as CardHistoryTimeline,Up as CardRelationshipsGraph,Bv as CardStack,hi as CardTemplateSelector,Bs as CircuitBreaker,bo as Column,Hn as ColumnManager,ti as CommandPalette,ki as ConfigMenu,No as ContextMenu,Ko as DEFAULT_SHORTCUTS,bp as DEFAULT_TABLE_COLUMNS,bi as DEFAULT_TEMPLATES,Ro as DateRangePicker,zo as DependenciesSelector,qn as DependencyLine,mi as DistributionCharts,Gs as EditableColumnTitle,yo as ErrorBoundary,vi as ExportImportModal,xi as FilterBar,gm as GANTT_AI_SYSTEM_PROMPT,es as GanttAIAssistant,dm as GanttBoard,To as GanttI18nContext,Jn as GanttMilestone,$n as GanttToolbar,Yp as GenerateGanttTasksDialog,Wp as GeneratePlanModal,gi as GroupBySelector,Mr as KanbanBoard,qs as KanbanToolbar,_o as KanbanViewAdapter,fi as KeyboardShortcutsHelp,fp as ListView,
|
|
419
|
+
export{Vp as AIUsageDashboard,_v as AI_FEATURES,kl as AI_MODELS,Zs as AddCardButton,Js as AddColumnButton,dr as AttachmentUploader,lu as BoardProvider,In as BulkOperationsToolbar,ci as BurnDownChart,yp as CUSTOM_FIELD_TYPES,Pp as CalendarBoard,gr as Card,oi as CardDetailModal,ii as CardDetailModalV2,Rp as CardHistoryReplay,Ip as CardHistoryTimeline,Up as CardRelationshipsGraph,Bv as CardStack,hi as CardTemplateSelector,Bs as CircuitBreaker,bo as Column,Hn as ColumnManager,ti as CommandPalette,ki as ConfigMenu,No as ContextMenu,Ko as DEFAULT_SHORTCUTS,bp as DEFAULT_TABLE_COLUMNS,bi as DEFAULT_TEMPLATES,Ro as DateRangePicker,zo as DependenciesSelector,qn as DependencyLine,mi as DistributionCharts,Gs as EditableColumnTitle,yo as ErrorBoundary,vi as ExportImportModal,xi as FilterBar,gm as GANTT_AI_SYSTEM_PROMPT,es as GanttAIAssistant,dm as GanttBoard,To as GanttI18nContext,Jn as GanttMilestone,$n as GanttToolbar,Yp as GenerateGanttTasksDialog,Wp as GeneratePlanModal,gi as GroupBySelector,Mr as KanbanBoard,qs as KanbanToolbar,_o as KanbanViewAdapter,fi as KeyboardShortcutsHelp,fp as ListView,Ot as MenuIcons,ks as PluginManager,Kr as PrioritySelector,Gv as RATE_LIMITS,hp as STANDARD_FIELDS,pi as SwimlaneBoardView,Vs as TagBadge,Ud as TagList,Sr as TagPicker,jn as TaskBar,fr as TaskDetailModal,um as TaskFormModal,_n as TaskGrid,Ni as ThemeModal,Ec as ThemeProvider,ku as ThemeSwitcher,Qn as Timeline,qr as UserAssignmentSelector,di as VelocityChart,bu as VirtualGrid,uu as VirtualList,so as aiUsageTracker,Pl as borderRadius,bn as calculatePosition,bl as calendarDarkTheme,pl as calendarEnTranslations,ul as calendarEsTranslations,hl as calendarLightTheme,yl as calendarNeutralTheme,bs as calendarThemes,gs as calendarTranslations,rs as cardToGanttTask,km as cardsToGanttTasks,b as cn,ic as createKanbanView,Yu as createRetryWrapper,wi as darkTheme,Cs as darkTokenTheme,Rn as defaultTheme,ws as designTokens,Il as duration,Bl as easing,xu as exportTokensToCSS,xr as findTaskByName,Ml as fontSize,Fl as fontWeight,sn as formatCost,zn as ganttEnTranslations,Mc as ganttEsTranslations,xm as ganttTaskToCardUpdate,et as ganttThemes,Ul as ganttTokens,Di as ganttTranslations,ve as ganttUtils,Hl as generateCSSVariables,_l as generateCompleteCSS,_u as generateInitialPositions,fm as generateTasksContext,mn as generateThemeVariables,Mp as getCalendarTheme,an as getCalendarTranslations,vp as getListViewTheme,el as getListViewTranslations,xp as getMonthNames,vu as getToken,Fc as getTranslations,kp as getWeekdayNames,zl as kanbanTokens,Ci as lightTheme,Wl as lightTokenTheme,Al as lineHeight,dl as listViewDarkTheme,Zi as listViewEnTranslations,Qi as listViewEsTranslations,cl as listViewLightTheme,ml as listViewNeutralTheme,us as listViewThemes,os as listViewTranslations,fs as mergeCalendarTranslations,ns as mergeListViewTranslations,Si as mergeTranslations,Ti as neutralTheme,Gl as neutralTokenTheme,Ol as opacity,ym as parseLocalCommand,qi as parseNaturalDate,Xi as parseNaturalDuration,Ji as parseProgress,hm as parseStatus,lx as pluginManager,Ku as retrySyncOperation,hn as retryWithBackoff,Rl as shadows,yu as shouldVirtualizeGrid,El as spacing,to as themes,ru as useAI,Xp as useBoard,cn as useBoardCore,xs as useBoardStore,su as useCardStacking,Ks as useDragState,cu as useFilteredCards,Qp as useFilters,Br as useGanttI18n,vs as useKanbanState,Nc as useKeyboardShortcuts,ou as useMultiSelect,Tl as useSelectionState,mu as useSortedCards,wo as useTheme,hu as useVirtualGrid,gu as useVirtualList,vm as validateAIResponse,Qs as withErrorBoundary,vn as wouldCreateCircularDependency,Ll as zIndex};//# sourceMappingURL=index.js.map
|
|
420
420
|
//# sourceMappingURL=index.js.map
|